aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-04-20 17:43:31 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-04-26 15:08:27 -0500
commitd28593d2dc859009f439ea676e5e665870862ff6 (patch)
treed2bbbd40bd0d1921230c0f2a802d2d776348393a /mpm
parent65617b2f67dd7c6176f467d2f2920e2026583ba3 (diff)
downloaduhd-d28593d2dc859009f439ea676e5e665870862ff6.tar.gz
uhd-d28593d2dc859009f439ea676e5e665870862ff6.tar.bz2
uhd-d28593d2dc859009f439ea676e5e665870862ff6.zip
mpm: db_flash: Check mount status before mounting
This will make sure the flash partition is not already mounted before trying to re-mount.
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/sys_utils/db_flash.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/db_flash.py b/mpm/python/usrp_mpm/sys_utils/db_flash.py
index c9c357aff..76827c069 100644
--- a/mpm/python/usrp_mpm/sys_utils/db_flash.py
+++ b/mpm/python/usrp_mpm/sys_utils/db_flash.py
@@ -26,6 +26,9 @@ class DBFlash():
self.log = get_logger("DBFlash")
else:
self.log = log.getChild("DBFlash")
+ self.mount = None
+ self.mtd_devpath = None
+ self.mtdblock_devpath = None
self.initialized = False
def init(self):
@@ -38,15 +41,19 @@ class DBFlash():
time.sleep(0.2)
try:
self.mtd_devpath = get_device_from_symbol(self.dt_symbol, ['*', 'mtd'])
- self.mtdblock_devpath = get_device_from_symbol(self.dt_symbol, ['*', 'block'])
+ self.mtdblock_devpath = get_device_from_symbol(
+ self.dt_symbol, ['*', 'block'])
except FileNotFoundError:
- raise ValueError("could not find MTD/-block device for device tree symbol {}".format(self.dt_symbol))
+ raise ValueError(
+ "could not find MTD/-block device for device tree symbol {}".format(
+ self.dt_symbol))
try:
self.mount = Mount(self.mtdblock_devpath, '/mnt/' + self.dt_symbol,
['-t', 'jffs2'], log=self.log)
- ret = self.mount.mount()
- if not ret:
- raise RuntimeError()
+ if not self.mount.ismounted():
+ ret = self.mount.mount()
+ if not ret:
+ raise RuntimeError()
self.initialized = True
except:
self.log.warning("Failed to initialize daughterboard flash")
@@ -71,8 +78,7 @@ class DBFlash():
dtoverlay.rm_overlay_safe(self.overlay)
self.initialized = False
return ret
- else:
- return False
+ return False
def clear_flash(self):
"""