Add getObjectFrom* interfaces back in
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>
diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py
index cd13f7b..d9761b5 100644
--- a/pysystemmgr/system_manager.py
+++ b/pysystemmgr/system_manager.py
@@ -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):
@@ -25,8 +26,39 @@
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 = ''