Skip to content

Commit

Permalink
Add getObjectFrom* interfaces back in
Browse files Browse the repository at this point in the history
Got a bit zealous with the removal of "legacy" interfaces
from system_manager.py in https://gerrit.openbmc-project.xyz/#/c/8874/
and removed some still required by phosphor-host-ipmid code for
some of the legacy sensors.

Only adding the minimum required back in with this commit.

Tested: Flashed image on witherspoon and verified host errors
are no longer reported.

Resolves openbmc/openbmc#2975

Change-Id: I6ba601be6310c57122f5e2f1dc37c6eae5417771
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
  • Loading branch information
geissonator committed Mar 27, 2018
1 parent d65b2d5 commit f6e918e
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion pysystemmgr/system_manager.py
Expand Up @@ -12,11 +12,12 @@
from obmc.dbuslib.bindings import DbusProperties, DbusObjectManager, get_dbus
import obmc.enums
import obmc_system_config as System
import obmc.inventory
import obmc.system

DBUS_NAME = 'org.openbmc.managers.System'
OBJ_NAME = '/org/openbmc/managers/System'

INTF_SENSOR = 'org.openbmc.SensorValue'

class SystemManager(DbusProperties, DbusObjectManager):
def __init__(self, bus, obj_name):
Expand All @@ -25,8 +26,39 @@ def __init__(self, bus, obj_name):
object_path=obj_name)
self.bus = bus

# replace symbolic path in ID_LOOKUP
for category in System.ID_LOOKUP:
for key in System.ID_LOOKUP[category]:
val = System.ID_LOOKUP[category][key]
new_val = val.replace(
"<inventory_root>", obmc.inventory.INVENTORY_ROOT)
System.ID_LOOKUP[category][key] = new_val

print("SystemManager Init Done")

def doObjectLookup(self, category, key):
obj_path = ""
intf_name = INTF_SENSOR
try:
obj_path = System.ID_LOOKUP[category][key]
parts = obj_path.split('/')
if (parts[3] != 'sensors'):
print ("ERROR SystemManager: SENSOR only supported type")
intf_name = ""
except Exception as e:
print ("ERROR SystemManager: "+str(e)+" not found in lookup")

return [obj_path, intf_name]

@dbus.service.method(DBUS_NAME, in_signature='ss', out_signature='(ss)')
def getObjectFromId(self, category, key):
return self.doObjectLookup(category, key)

@dbus.service.method(DBUS_NAME, in_signature='sy', out_signature='(ss)')
def getObjectFromByteId(self, category, key):
byte = int(key)
return self.doObjectLookup(category, byte)

@dbus.service.method(DBUS_NAME, in_signature='s', out_signature='sis')
def gpioInit(self, name):
gpio_path = ''
Expand Down

0 comments on commit f6e918e

Please sign in to comment.