From 9d55c5885800ac6659d93ab90af849ba0e5d5b97 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 26 Feb 2018 18:41:14 -0800 Subject: mpm: n300/n310: Select correct overlay based on product ID --- mpm/python/usrp_mpm/periph_manager/base.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'mpm/python/usrp_mpm/periph_manager/base.py') 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')) -- cgit v1.2.3