diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-02-26 18:41:14 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-05 15:56:41 -0800 |
commit | 9d55c5885800ac6659d93ab90af849ba0e5d5b97 (patch) | |
tree | 59760e33950382192b6dc93f730e0f50b5166813 /mpm/python/usrp_mpm/periph_manager/base.py | |
parent | 9c8edf8fd4b4bb42f5911f7a8240686a69077f80 (diff) | |
download | uhd-9d55c5885800ac6659d93ab90af849ba0e5d5b97.tar.gz uhd-9d55c5885800ac6659d93ab90af849ba0e5d5b97.tar.bz2 uhd-9d55c5885800ac6659d93ab90af849ba0e5d5b97.zip |
mpm: n300/n310: Select correct overlay based on product ID
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager/base.py')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index 079635bb1..83096c994 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -52,9 +52,9 @@ class PeriphManagerBase(object): # # These values are meant to be overridden by the according subclasses ######################################################################### - # Very important: A list of PIDs that apply to the current device. Must be - # list, even if there's only one entry. - pids = [] + # Very important: A map of PIDs that apply to the current device. Format is + # pid -> product name. + pids = {} # A textual description of this device type description = "MPM Device" # Address of the motherboard EEPROM. This could be something like @@ -195,16 +195,19 @@ class PeriphManagerBase(object): ) except TypeError: self.mboard_info[key] = str(self._eeprom_head.get(key, '')) - if 'pid' in self._eeprom_head \ - and self._eeprom_head['pid'] not in self.pids: - self.log.error( - "Found invalid PID in EEPROM: 0x{:04X}. " \ - "Valid PIDs are: {}".format( - self._eeprom_head['pid'], - ", ".join(["0x{:04X}".format(x) for x in self.pids]), + if 'pid' in self._eeprom_head: + if self._eeprom_head['pid'] not in self.pids.keys(): + self.log.error( + "Found invalid PID in EEPROM: 0x{:04X}. " \ + "Valid PIDs are: {}".format( + self._eeprom_head['pid'], + ", ".join(["0x{:04X}".format(x) + for x in self.pids.keys()]), + ) ) - ) - raise RuntimeError("Invalid PID found in EEPROM.") + raise RuntimeError("Invalid PID found in EEPROM.") + self.mboard_info['product'] = \ + self.pids[self._eeprom_head['pid']] if 'rev' in self._eeprom_head: try: rev_numeric = int(self._eeprom_head.get('rev')) |