summaryrefslogtreecommitdiffstats
path: root/pysystemmgr
diff options
context:
space:
mode:
authorXo Wang <xow@google.com>2016-09-21 12:46:29 -0700
committerPatrick Williams <patrick@stwcx.xyz>2016-10-06 02:39:29 +0000
commit605620d24059f968654ae1c15bed2847a15a4c80 (patch)
treefe5c57fe334b08b26dcb345548a97dd7cfe172f2 /pysystemmgr
parentc9972aebe02f1aa4b7eaabf202695e4df101545f (diff)
downloadtalos-skeleton-605620d24059f968654ae1c15bed2847a15a4c80.tar.gz
talos-skeleton-605620d24059f968654ae1c15bed2847a15a4c80.zip
gpio: Raise exception on GPIO lookup failure
This allows dbus calls to gpioInit to fail instead of only returning a default value. This behavior allows the C-side GPIO lookup to error out as expected. Signed-off-by: Xo Wang <xow@google.com> Change-Id: I13ad20de5d209716f26e46c12ca6941eb3dd5997
Diffstat (limited to 'pysystemmgr')
-rw-r--r--pysystemmgr/system_manager.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py
index 6f4bf81..e6bdd29 100644
--- a/pysystemmgr/system_manager.py
+++ b/pysystemmgr/system_manager.py
@@ -161,8 +161,10 @@ class SystemManager(DbusProperties, DbusObjectManager):
gpio_num = -1
r = ['', gpio_num, '']
if name not in System.GPIO_CONFIG:
- # TODO: Error handling
- print "ERROR: "+name+" not found in GPIO config table"
+ # TODO: Better error handling
+ msg = "ERROR: "+name+" not found in GPIO config table"
+ print msg
+ raise Exception(msg)
else:
gpio_num = -1
@@ -173,7 +175,9 @@ class SystemManager(DbusProperties, DbusObjectManager):
if 'gpio_pin' in System.GPIO_CONFIG[name]:
gpio_num = obmc.system.convertGpio(gpio['gpio_pin'])
else:
- print "ERROR: SystemManager - GPIO lookup failed for "+name
+ msg = "ERROR: SystemManager - GPIO lookup failed for "+name
+ print msg
+ raise Exception(msg)
if (gpio_num != -1):
r = [obmc.enums.GPIO_DEV, gpio_num, gpio['direction']]
OpenPOWER on IntegriCloud