Norman James | f20dd6b | 2015-12-18 15:00:55 -0600 | [diff] [blame^] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import sys |
| 4 | import gobject |
| 5 | import dbus |
| 6 | import dbus.service |
| 7 | import dbus.mainloop.glib |
| 8 | |
| 9 | |
| 10 | dbus_objects = { |
| 11 | 'power' : { |
| 12 | 'bus_name' : 'org.openbmc.control.Power', |
| 13 | 'object_name' : '/org/openbmc/control/power0', |
| 14 | 'interface_name' : 'org.openbmc.control.Power' |
| 15 | }, |
| 16 | 'occstatus' : { |
| 17 | 'bus_name' : 'org.openbmc.Sensors', |
| 18 | 'object_name' : '/org/openbmc/sensors/host/OccStatus', |
| 19 | 'interface_name' : 'org.openbmc.SensorValue' |
| 20 | }, |
| 21 | 'bootprogress' : { |
| 22 | 'bus_name' : 'org.openbmc.Sensors', |
| 23 | 'object_name' : '/org/openbmc/sensors/host/BootProgress', |
| 24 | 'interface_name' : 'org.openbmc.SensorValue' |
| 25 | }, |
| 26 | } |
| 27 | |
| 28 | def getInterface(bus,objs,key): |
| 29 | obj = bus.get_object(objs[key]['bus_name'],objs[key]['object_name'],introspect=False) |
| 30 | return dbus.Interface(obj,objs[key]['interface_name']) |
| 31 | |
| 32 | def getProperty(bus,objs,key,prop): |
| 33 | obj = bus.get_object(objs[key]['bus_name'],objs[key]['object_name'],introspect=False) |
| 34 | intf = dbus.Interface(obj,dbus.PROPERTIES_IFACE) |
| 35 | return intf.Get(objs[key]['interface_name'],prop) |
| 36 | |
| 37 | |
| 38 | bus = dbus.SystemBus() |
| 39 | pgood = getProperty(bus,dbus_objects,'power','pgood') |
| 40 | |
| 41 | if (pgood == 1): |
| 42 | intf = getInterface(bus,dbus_objects,'bootprogress') |
| 43 | intf.setValue("FW Progress, Starting OS") |
| 44 | intf = getInterface(bus,dbus_objects,'occstatus') |
| 45 | intf.setValue("Enabled") |
| 46 | |
| 47 | |
| 48 | |
| 49 | |