diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-11-17 12:03:43 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:06 -0800 |
commit | 2ab5a0f6aa582ee542ab0c8f02835b935985b6b4 (patch) | |
tree | bbd06ebf84c140932e033cabf154c3fc1cfc1317 /mpm | |
parent | 5e5f40923974c94eaacccd46bd3ba19fb9955982 (diff) | |
download | uhd-2ab5a0f6aa582ee542ab0c8f02835b935985b6b4.tar.gz uhd-2ab5a0f6aa582ee542ab0c8f02835b935985b6b4.tar.bz2 uhd-2ab5a0f6aa582ee542ab0c8f02835b935985b6b4.zip |
mpm: Made PeriphManagerBase.__init__ more exception-safe
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index a619247ad..f5b3f39e8 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -148,11 +148,16 @@ class PeriphManagerBase(object): # Set up logging self.log = get_logger('PeriphManager') self.claimed = False - self._init_mboard_with_eeprom() - self._init_mboard_overlays(self._eeprom_head, args) - self._init_dboards(args.override_db_pids) - self._available_endpoints = list(range(256)) self._init_args = {} + self._available_endpoints = list(range(256)) + try: + self._init_mboard_with_eeprom() + self._init_mboard_overlays(self._eeprom_head, args) + self._init_dboards(args.override_db_pids) + self._device_initialized = True + except Exception as ex: + self.log.error("Failed to initialize device: %s", str(ex)) + self._device_initialized = False def _init_mboard_with_eeprom(self): """ @@ -326,6 +331,10 @@ class PeriphManagerBase(object): self.log.info("Mboard init() called with device args `{}'.".format( ",".join(['{}={}'.format(x, args[x]) for x in args]) )) + if not self._device_initialized: + self.log.error( + "Cannot run init(), device was never fully initialized!") + return False self._init_args = args self.log.debug("Initializing dboards...") return all((dboard.init(args) for dboard in self.dboards)) |