blob: 236bd01e59ecc162c20ae0b7fab9d89f011bba84 [file] [log] [blame]
Norman Jamesf20dd6b2015-12-18 15:00:55 -06001#!/usr/bin/python
2
3import sys
4import gobject
5import dbus
6import dbus.service
7import dbus.mainloop.glib
8
9
10dbus_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
28def 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
32def 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
38bus = dbus.SystemBus()
39pgood = getProperty(bus,dbus_objects,'power','pgood')
40
41if (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