aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2018-08-15 14:17:54 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-08-20 17:57:16 -0700
commit90f2d1579a6ad9eb05cacae82acdcd2f8ba06952 (patch)
treec8d13bc35378bdd4aa9f1c02ec0a8f12d0b730e9 /mpm/python
parent8e3ea14c9406f3f3e5fe613bfe59906447a195e0 (diff)
downloaduhd-90f2d1579a6ad9eb05cacae82acdcd2f8ba06952.tar.gz
uhd-90f2d1579a6ad9eb05cacae82acdcd2f8ba06952.tar.bz2
uhd-90f2d1579a6ad9eb05cacae82acdcd2f8ba06952.zip
mpm: add Git hash, version to device info
Adding MPM Git hash and version to the MPM device info. This information is currently only available through logs when MPM starts (it is the first log message in usrp_hwd.py). Adding it to the device info makes it accessible to any application which checks that, such as uhd_usrp_probe.
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py9
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n3xx.py5
2 files changed, 13 insertions, 1 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py
index b698f661b..1206289b9 100644
--- a/mpm/python/usrp_mpm/periph_manager/base.py
+++ b/mpm/python/usrp_mpm/periph_manager/base.py
@@ -140,6 +140,15 @@ class PeriphManagerBase(object):
mboard_info -- Dictionary; motherboard info
device_args -- List of dictionaries; daughterboard info
"""
+ # Try to add the MPM Git hash and version
+ try:
+ from usrp_mpm import __version__, __githash__
+ version_string = __version__
+ if len(__githash__):
+ version_string += "-g" + __githash__
+ except ImportError:
+ version_string = ""
+ mboard_info["mpm_version"] = version_string
return mboard_info
@staticmethod
diff --git a/mpm/python/usrp_mpm/periph_manager/n3xx.py b/mpm/python/usrp_mpm/periph_manager/n3xx.py
index 72aa17b11..08ddf6e9e 100644
--- a/mpm/python/usrp_mpm/periph_manager/n3xx.py
+++ b/mpm/python/usrp_mpm/periph_manager/n3xx.py
@@ -155,12 +155,15 @@ class n3xx(ZynqComponents, PeriphManagerBase):
"""
Hard-code our product map
"""
+ # Add the default PeriphManagerBase information first
+ device_info = super().generate_device_info(
+ eeprom_md, mboard_info, dboard_infos)
+ # Then add N3xx-specific information
mb_pid = eeprom_md.get('pid')
lookup_key = (
n3xx.pids.get(mb_pid, 'unknown'),
tuple([x['pid'] for x in dboard_infos]),
)
- device_info = mboard_info
device_info['product'] = cls.product_map.get(lookup_key, 'unknown')
return device_info