From 90f2d1579a6ad9eb05cacae82acdcd2f8ba06952 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Wed, 15 Aug 2018 14:17:54 -0700 Subject: 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. --- mpm/python/usrp_mpm/periph_manager/base.py | 9 +++++++++ mpm/python/usrp_mpm/periph_manager/n3xx.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'mpm/python') 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 -- cgit v1.2.3