From 476b65f35e2871b78be118e7bfe15b9e08de41b6 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Thu, 26 Jul 2018 16:54:55 -0700 Subject: n3xx: Fixup for parsing the EEPROM EEPROM parsing in MPM was ignoring the dt_compat number (MPM doesn't need it), so when the dt_compat number was non-zero, the CRC calculation was incorrect. CRC calculations are now done on the raw data. --- mpm/python/usrp_mpm/eeprom.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mpm/python') diff --git a/mpm/python/usrp_mpm/eeprom.py b/mpm/python/usrp_mpm/eeprom.py index d189f7a8b..97a450ca6 100644 --- a/mpm/python/usrp_mpm/eeprom.py +++ b/mpm/python/usrp_mpm/eeprom.py @@ -142,13 +142,12 @@ def read_eeprom( Returns a dictionary. """ eeprom_parser = struct.Struct(eeprom_header_format[version]) - eeprom_parser_no_crc = struct.Struct(eeprom_header_format[version][0:-1]) eeprom_keys = eeprom_header_keys[version] parsed_data = eeprom_parser.unpack_from(data) read_crc = parsed_data[-1] - rawdata_without_crc = eeprom_parser_no_crc.pack(*(parsed_data[0:-1])) + rawdata_without_crc = data[:eeprom_parser.size-4] expected_crc = zlib.crc32(rawdata_without_crc) & 0xffffffff - if read_crc != expected_crc: + if read_crc != expected_crc: raise RuntimeError( "Received incorrect CRC."\ "Read: {:08X} Expected: {:08X}".format( -- cgit v1.2.3