moved to using dbus properties
diff --git a/Makefile b/Makefile
index b11c405..23b53ce 100644
--- a/Makefile
+++ b/Makefile
@@ -74,4 +74,4 @@
$(CC) -o bin/$@.exe obj/hwmon_intf.o $(LDFLAGS) $(LIBS)
-all: setup libopenbmc_intf power_control led_controller sensor_ambient button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher
+all: setup libopenbmc_intf power_control led_controller sensor_ambient button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher control_bmc_barreleye
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 9f9ba03..e77a438 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -22,7 +22,7 @@
'HOST_POWERING_ON',
'HOST_POWERED_ON',
'HOST_BOOTING',
- 'HOST_UP',
+ 'HOST_BOOTED',
'HOST_POWERED_DOWN',
]
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index 1518f74..b11c7be 100755
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -6,27 +6,6 @@
GPIO_DEV = '/sys/class/gpio'
BUS = "system"
-FRU_TYPES = {
- 'SYSTEM' : 0,
- 'CPU' : 1,
- 'DIMM' : 2,
- 'MAIN_PLANAR' : 3,
- 'RISER_CARD' : 4,
- 'DAUGHTER_CARD' : 5,
- 'FAN' : 6,
- 'BMC' : 7,
- 'CORE' : 8,
- 'PCIE_CARD' : 9,
- 'MEMORY_BUFFER' : 10,
-}
-FRU_STATES = {
- 'NORMAL' : 0,
- 'RECOVERABLE_ERROR' : 1,
- 'FATAL_ERROR' : 2,
- 'NOT_PRESENT' : 3,
-}
-
-
ENUMS = {
'org.openbmc.SensorIntegerThreshold.state' :
['NOT_SET','NORMAL','LOWER_CRITICAL','LOWER_WARNING','UPPER_WARNING','UPPER_CRITICAL'],
@@ -145,6 +124,28 @@
except:
self.properties[interface_name][property_name] = new_value
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='sa{sv}')
+ def SetAll(self, interface_name, prop_dict):
+ if (self.properties.has_key(interface_name) == False):
+ self.properties[interface_name] = {}
+
+ value_changed = False
+ for property_name in prop_dict:
+ new_value = prop_dict[property_name]
+ try:
+ old_value = self.properties[interface_name][property_name]
+ if (old_value != new_value):
+ self.properties[interface_name][property_name] = new_value
+ value_changed = True
+
+ except:
+ self.properties[interface_name][property_name] = new_value
+ value_changed = True
+ if (value_changed == True):
+ self.PropertiesChanged(interface_name, prop_dict, [])
+
+
@dbus.service.signal(dbus.PROPERTIES_IFACE,
signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index 286c9cf..13ae975 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -22,7 +22,7 @@
'HOST_POWERING_ON',
'HOST_POWERED_ON',
'HOST_BOOTING',
- 'HOST_UP',
+ 'HOST_BOOTED',
'HOST_POWERED_DOWN',
]
@@ -53,6 +53,15 @@
SYSTEM_CONFIG = {}
+SYSTEM_CONFIG['org.openbmc.managers.Property'] = {
+ 'system_state' : 'BMC_INIT',
+ 'start_process' : False,
+ 'monitor_process' : False,
+ 'process_name' : 'property_manager.py',
+ 'heartbeat' : 'no',
+ 'instances' : [ { 'name' : SYSTEM_NAME } ]
+ }
+
SYSTEM_CONFIG['org.openbmc.control.Bmc'] = {
'system_state' : 'BMC_INIT',
'start_process' : True,
@@ -205,13 +214,10 @@
'instances' : [ {'name' : 'Fan_0' }, {'name' : 'Fan_1'}, {'name' : 'Fan_2'} ]
}
-NON_CACHABLE_PROPERTIES = {
- 'name' : True,
- 'user_label' : True,
- 'location' : True,
- 'state' : True,
- 'cache' : True
-}
+CACHED_INTERFACES = {
+ "org.openbmc.InventoryItem" : True,
+ "org.openbmc.control.Chassis" : True,
+ }
INVENTORY_ROOT = '/org/openbmc/inventory'
FRU_INSTANCES = {
@@ -310,7 +316,7 @@
0x04 : '<inventory_root>/system/chassis/motherboard/dimm1',
0x05 : '<inventory_root>/system/chassis/motherboard/dimm2',
0x06 : '<inventory_root>/system/chassis/motherboard/dimm3',
- 0xff : '<inventory_root>/system',
+ 0x35 : '<inventory_root>/system',
},
'FRU_STR' : {
'PRODUCT_15' : '<inventory_root>/system',
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index e3f6e6a..7eda9a0 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -24,10 +24,10 @@
intf = dbus.Interface(obj, 'org.openbmc.Watchdog' )
return intf
-class ChassisControlObject(dbus.service.Object):
+class ChassisControlObject(Openbmc.DbusProperties):
def __init__(self,bus,name):
self.dbus_objects = { }
-
+ Openbmc.DbusProperties.__init__(self)
dbus.service.Object.__init__(self,bus,name)
## load utilized objects
self.dbus_objects = {
@@ -42,12 +42,12 @@
'interface_name' : 'org.openbmc.Led'
}
}
- #self.power_sequence = 0
- self.reboot = 0
- self.last_power_state = 0
#uuid
- self.id = 0
+ self.Set(DBUS_NAME,"uuid",str(uuid.uuid1()))
+ self.Set(DBUS_NAME,"reboot",0)
+ self.Set(DBUS_NAME,"power_policy",0)
+ self.Set(DBUS_NAME,"last_system_state","")
bus.add_signal_receiver(self.power_button_signal_handler,
dbus_interface = "org.openbmc.Button", signal_name = "ButtonPressed",
@@ -62,13 +62,6 @@
obj = bus.get_object(o['bus_name'],o['object_name'])
return dbus.Interface(obj,o['interface_name'])
- @dbus.service.method(DBUS_NAME,
- in_signature='', out_signature='s')
- def getID(self):
- if (self.id==0):
- #calculate uuuid
- self.id = uuid.uuid1()
- return str(self.id)
@dbus.service.method(DBUS_NAME,
in_signature='', out_signature='')
@@ -90,7 +83,7 @@
in_signature='', out_signature='')
def powerOn(self):
print "Turn on power and boot"
- self.reboot = 0
+ self.Set(DBUS_NAME,"reboot",0)
if (self.getPowerState()==0):
intf = self.getInterface('power_control')
intf.setPowerState(POWER_ON)
@@ -113,14 +106,16 @@
in_signature='', out_signature='')
def softPowerOff(self):
print "Soft off power"
- ## Somehow tell host to shutdown via ipmi
+ ## TODO: Somehow tell host to shutdown via ipmi
+ ## for now hard power off
+ self.powerOff()
return None
@dbus.service.method(DBUS_NAME,
in_signature='', out_signature='')
def reboot(self):
print "Rebooting"
- self.reboot=1
+ self.Set(DBUS_NAME,"reboot",1)
intf.softPowerOff()
return None
@@ -138,13 +133,15 @@
@dbus.service.method(DBUS_NAME,
in_signature='i', out_signature='')
def setPowerPolicy(self,policy):
+ self.Set(DBUS_NAME,"power_policy",policy)
return None
## Signal handler
def SystemStateHandler(self,state_name):
- if (state_name == "HOST_POWERED_OFF" and self.reboot==1):
+ self.Set(DBUS_NAME,"last_system_state",state_name)
+ if (state_name == "HOST_POWERED_OFF" and self.Get(DBUS_NAME,"reboot")==1):
self.powerOn()
@@ -160,8 +157,8 @@
def host_watchdog_signal_handler(self):
print "Watchdog Error, Hard Rebooting"
- #self.reboot = 1
- #self.powerOff()
+ self.Set(DBUS_NAME,"reboot",1)
+ self.powerOff()
if __name__ == '__main__':
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index a162bad..78691d6 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -30,7 +30,7 @@
if not os.path.exists(FRU_PATH):
os.makedirs(FRU_PATH)
-
+
self.objects = [ ]
def addItem(self,item):
@@ -63,10 +63,8 @@
in_signature='a{sv}', out_signature='')
def update(self,data):
## translate dbus data into basic data types
- for k in data.keys():
- self.setField(k,data[k])
-
- self.saveToCache()
+ self.SetAll(INTF_NAME,data)
+ #self.saveToCache()
@dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
@@ -135,7 +133,7 @@
obj = InventoryItem(bus,obj_path)
obj.setField('is_fru',FRUS[f]['is_fru'])
obj.setField('fru_type',FRUS[f]['fru_type'])
- obj.loadFromCache();
+ #obj.loadFromCache();
obj_parent.addItem(obj)
print "Running Inventory Manager"
diff --git a/bin/ipmid.py b/bin/ipmid.py
index 4f01421..35bd7e9 100755
--- a/bin/ipmid.py
+++ b/bin/ipmid.py
@@ -33,8 +33,8 @@
@dbus.service.signal(DBUS_NAME, "yyyay")
def ReceivedMessage(self, seq, netfn, cmd, data):
- print("IPMI packet from host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
- (ord(seq), ord(netfn), ord(cmd)))
+ #print("IPMI packet from host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
+ # (ord(seq), ord(netfn), ord(cmd)))
print_packet(seq, netfn, cmd, data)
@dbus.service.method(DBUS_NAME, "", "")
@@ -43,8 +43,8 @@
@dbus.service.method(DBUS_NAME, "yyyay", "x")
def sendMessage(self, seq, netfn, cmd, data):
- print("IPMI packet sent to host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
- (int(seq), int(netfn), int(cmd)))
+ #print("IPMI packet sent to host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
+ # (int(seq), int(netfn), int(cmd)))
#print_packet(seq, netfn, cmd, data)
self.reader.write(seq, netfn, cmd, data)
@@ -55,7 +55,7 @@
def __init__(self, ipmi_obj):
self.ipmi_obj = ipmi_obj
flags = os.O_NONBLOCK | os.O_RDWR
- self.bt = os.open("/dev/bt", flags)
+ self.bt = os.open("/dev/bt-host", flags)
glib.io_add_watch(self.bt, glib.IO_IN, self.io_callback)
ipmi_obj.setReader(self)
diff --git a/bin/system_manager.py b/bin/system_manager.py
index f7bfdad..03ad9f4 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -192,11 +192,16 @@
Openbmc.get_objs(bus,bus_name,"",objects)
for instance_name in objects.keys():
obj_path = objects[instance_name]['PATH']
+ #obj = bus.get_object("org.openbmc.managers.Property",
+ # "/org/openbmc/managers/Property")
+ #intf = dbus.Interface(obj,"org.openbmc.managers.Property")
+ #intf.loadFromCache(bus_name,obj_path)
self.bus_name_lookup[obj_path] = bus_name
if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
- except:
+ except Exception as e:
+ print e
pass
if (System.SYSTEM_CONFIG.has_key(bus_name)):