diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-03-08 10:54:19 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-08 10:54:19 -0800 |
commit | 37e49f56b1ff9f2e0fd5f8987538b7589b6cc68a (patch) | |
tree | 6b21788e7f60ee116aa05ac4aace685c2e651c19 /mpm/python | |
parent | f602d0f4091c46e33c426e04806544d1dedcb725 (diff) | |
download | uhd-37e49f56b1ff9f2e0fd5f8987538b7589b6cc68a.tar.gz uhd-37e49f56b1ff9f2e0fd5f8987538b7589b6cc68a.tar.bz2 uhd-37e49f56b1ff9f2e0fd5f8987538b7589b6cc68a.zip |
mpm: sysfs_gpio: Throw exception on unsuccessful init
In case of a lost connection to a sysfs-gpio device, this will trigger
the correct errors.
Diffstat (limited to 'mpm/python')
-rw-r--r-- | mpm/python/usrp_mpm/sys_utils/sysfs_gpio.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/sysfs_gpio.py b/mpm/python/usrp_mpm/sys_utils/sysfs_gpio.py index ccc597785..d30898a50 100644 --- a/mpm/python/usrp_mpm/sys_utils/sysfs_gpio.py +++ b/mpm/python/usrp_mpm/sys_utils/sysfs_gpio.py @@ -107,12 +107,17 @@ class SysFSGPIO(object): self._use_mask = use_mask self._ddr = ddr self._init_value = init_value - self.log.trace("Generating SysFSGPIO object for label `{}'...".format(label)) + self.log.trace("Generating SysFSGPIO object for label `{}'..." + .format(label)) self._gpio_dev, self._map_info = \ find_gpio_device(label, parent_dev, self.log) if self._gpio_dev is None: - self.log.error("Could not find GPIO device with label `{}'.".format(label)) - self.log.trace("GPIO base number is {}".format(self._map_info.get("sys_number"))) + error_msg = \ + "Could not find GPIO device with label `{}'.".format(label) + self.log.error(error_msg) + raise RuntimeError(error_msg) + self.log.trace("GPIO base number is {}" + .format(self._map_info.get("sys_number"))) self._base_gpio = self._map_info.get("sys_number") self.init(self._map_info['ngpio'], self._base_gpio, |