aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-12 18:17:54 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-12 18:17:54 -0800
commit4e873a4cb19552f6903f69739f0a6818c8a5e263 (patch)
tree8b8f4b402acb3bf944ec33361ff1141aa8702fb9
parentdeccab5a1b90df299b7b194bfef9da046f8f319b (diff)
downloaduhd-4e873a4cb19552f6903f69739f0a6818c8a5e263.tar.gz
uhd-4e873a4cb19552f6903f69739f0a6818c8a5e263.tar.bz2
uhd-4e873a4cb19552f6903f69739f0a6818c8a5e263.zip
mpm: n310: Check all periphs for initialization status
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py4
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n310.py25
2 files changed, 22 insertions, 7 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py
index 4db74e8dd..265d286e5 100644
--- a/mpm/python/usrp_mpm/periph_manager/base.py
+++ b/mpm/python/usrp_mpm/periph_manager/base.py
@@ -334,6 +334,10 @@ class PeriphManagerBase(object):
This must be safe to call multiple times. The default behaviour is to
call deinit() on all the daughterboards.
"""
+ if not self._device_initialized:
+ self.log.error(
+ "Cannot run deinit(), device was never fully initialized!")
+ return
self.log.trace("Mboard deinit() called.")
for dboard in self.dboards:
dboard.deinit()
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py
index f16dbc2b6..d24526792 100644
--- a/mpm/python/usrp_mpm/periph_manager/n310.py
+++ b/mpm/python/usrp_mpm/periph_manager/n310.py
@@ -581,6 +581,10 @@ class n310(PeriphManagerBase):
Calls init() on the parent class, and then programs the Ethernet
dispatchers accordingly.
"""
+ if not self._device_initialized:
+ self.log.warning(
+ "Cannot run init(), device was never fully initialized!")
+ return
result = super(n310, self).init(args)
for xport_mgr in itervalues(self._xport_mgrs):
xport_mgr.init(args)
@@ -590,6 +594,10 @@ class n310(PeriphManagerBase):
"""
Clean up after a UHD session terminates.
"""
+ if not self._device_initialized:
+ self.log.warning(
+ "Cannot run deinit(), device was never fully initialized!")
+ return
super(n310, self).deinit()
for xport_mgr in itervalues(self._xport_mgrs):
xport_mgr.deinit()
@@ -604,9 +612,10 @@ class n310(PeriphManagerBase):
"""
self.log.trace("Tearing down N3xx device...")
self._tear_down = True
- self._status_monitor_thread.join(3 * N3XX_MONITOR_THREAD_INTERVAL)
- if self._status_monitor_thread.is_alive():
- self.log.error("Could not terminate monitor thread!")
+ if self._device_initialized:
+ self._status_monitor_thread.join(3 * N3XX_MONITOR_THREAD_INTERVAL)
+ if self._status_monitor_thread.is_alive():
+ self.log.error("Could not terminate monitor thread!")
active_overlays = self.list_active_overlays()
self.log.trace("N310 has active device tree overlays: {}".format(
active_overlays
@@ -1115,14 +1124,16 @@ class n310(PeriphManagerBase):
This is called when the device is claimed, in case the device needs to
run any actions on claiming (e.g., light up an LED).
"""
- # Light up LINK
- self._bp_leds.set(self._bp_leds.LED_LINK, 1)
+ if self._device_initialized:
+ # Light up LINK
+ self._bp_leds.set(self._bp_leds.LED_LINK, 1)
def unclaim(self):
"""
This is called when the device is unclaimed, in case the device needs
to run any actions on claiming (e.g., turn off an LED).
"""
- # Turn off LINK
- self._bp_leds.set(self._bp_leds.LED_LINK, 0)
+ if self._device_initialized:
+ # Turn off LINK
+ self._bp_leds.set(self._bp_leds.LED_LINK, 0)