support reboot and state property
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 2a8ff49..6e213a5 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -34,6 +34,7 @@
'/org/openbmc/control/host0' : 0,
'/org/openbmc/control/flash/bios' : 0,
'/org/openbmc/sensors/speed/fan5': 0,
+ '/org/openbmc/inventory/system/chassis/io_board' : 0,
},
'BMC_STARTING2' : {
'/org/openbmc/control/fans' : 0,
@@ -164,6 +165,13 @@
'monitor_process' : True,
'process_name' : 'chassis_control.py',
},
+ 'board_vpd' : {
+ 'system_state' : 'BMC_STARTING2',
+ 'start_process' : True,
+ 'monitor_process' : False,
+ 'process_name' : 'phosphor-read-eeprom',
+ 'args' : ['--eeprom','/sys/devices/platform/ahb/ahb:apb/1e78a000.i2c/1e78a040.i2c-bus/i2c-0/0-0050/eeprom','--fruid','64'],
+ },
'hwmon_barreleye' : {
'system_state' : 'BMC_STARTING',
'start_process' : True,
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index 4428cf7..8d19d1e 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -39,7 +39,12 @@
'bus_name' : 'org.openbmc.watchdog.Host',
'object_name' : '/org/openbmc/watchdog/host0',
'interface_name' : 'org.openbmc.Watchdog'
- }
+ },
+ 'host_services' : {
+ 'bus_name' : 'org.openbmc.HostServices',
+ 'object_name' : '/org/openbmc/HostServices',
+ 'interface_name' : 'org.openbmc.HostServices'
+ },
}
#uuid
@@ -110,9 +115,9 @@
in_signature='', out_signature='')
def softPowerOff(self):
print "Soft off power"
- ## TODO: Somehow tell host to shutdown via ipmi
- ## for now hard power off
- self.powerOff()
+ intf = self.getInterface('host_services')
+ ## host services will call power off when ready
+ intf.SoftPowerOff()
return None
@dbus.service.method(DBUS_NAME,
diff --git a/bin/system_manager.py b/bin/system_manager.py
index 6554e75..156f4ab 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -27,15 +27,16 @@
INTF_CONTROL = 'org.openbmc.Control'
-class SystemManager(dbus.service.Object):
- def __init__(self,bus,name):
- dbus.service.Object.__init__(self,bus,name)
+class SystemManager(Openbmc.DbusProperties):
+ def __init__(self,bus,obj_name):
+ Openbmc.DbusProperties.__init__(self)
+ dbus.service.Object.__init__(self,bus,obj_name)
bus.add_signal_receiver(self.NewObjectHandler,
signal_name = "ObjectAdded", sender_keyword = 'bus_name')
bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
- self.current_state = ""
+ self.Set(DBUS_NAME,"current_state","")
self.system_states = {}
self.bus_name_lookup = {}
self.bin_path = os.path.dirname(os.path.realpath(sys.argv[0]))
@@ -59,14 +60,16 @@
print "Creating cache directory: "+PropertyCacher.CACHE_PATH
os.makedirs(PropertyCacher.CACHE_PATH)
+ self.ObjectAdded(obj_name,DBUS_NAME)
print "SystemManager Init Done"
def SystemStateHandler(self,state_name):
## clearing object started flags
+ current_state = self.Get(DBUS_NAME,"current_state")
try:
- for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
- System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 0
+ for obj_path in System.EXIT_STATE_DEPEND[current_state]:
+ System.EXIT_STATE_DEPEND[current_state][obj_path] = 0
except:
pass
@@ -88,12 +91,13 @@
except:
pass
- self.current_state = state_name
+ self.Set(DBUS_NAME,"current_state",state_name)
def gotoNextState(self):
s = 0
+ current_state = self.Get(DBUS_NAME,"current_state")
for i in range(len(System.SYSTEM_STATES)):
- if (System.SYSTEM_STATES[i] == self.current_state):
+ if (System.SYSTEM_STATES[i] == current_state):
s = i+1
if (s == len(System.SYSTEM_STATES)):
@@ -107,7 +111,7 @@
@dbus.service.method(DBUS_NAME,
in_signature='', out_signature='s')
def getSystemState(self):
- return self.current_state
+ return self.Get(DBUS_NAME,"current_state")
def doObjectLookup(self,category,key):
bus_name = ""
@@ -169,22 +173,23 @@
return True
def NewObjectHandler(self,obj_path, interface_name, bus_name = None):
+ current_state = self.Get(DBUS_NAME,"current_state")
if (self.bus_name_lookup.has_key(obj_path)):
if (self.bus_name_lookup[obj_path] == bus_name):
return
self.bus_name_lookup[obj_path] = bus_name
print "New object: "+obj_path+" ("+bus_name+")"
try:
- if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
- System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
+ if (System.EXIT_STATE_DEPEND[current_state].has_key(obj_path) == True):
+ System.EXIT_STATE_DEPEND[current_state][obj_path] = 1
## check if all required objects are started to move to next state
state = 1
- for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
- if (System.EXIT_STATE_DEPEND[self.current_state][obj_path] == 0):
+ for obj_path in System.EXIT_STATE_DEPEND[current_state]:
+ if (System.EXIT_STATE_DEPEND[current_state][obj_path] == 0):
state = 0
## all required objects have started so go to next state
if (state == 1):
- print "All required objects started for "+self.current_state
+ print "All required objects started for "+current_state
self.gotoNextState()
except:
pass