aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2018-07-26 16:54:55 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-07-30 18:17:29 -0700
commit476b65f35e2871b78be118e7bfe15b9e08de41b6 (patch)
tree098023267af1a0594314987fb052cf6f839c5559
parent508023e0c77b0e92ee454f9771e4386e70fda359 (diff)
downloaduhd-476b65f35e2871b78be118e7bfe15b9e08de41b6.tar.gz
uhd-476b65f35e2871b78be118e7bfe15b9e08de41b6.tar.bz2
uhd-476b65f35e2871b78be118e7bfe15b9e08de41b6.zip
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.
-rw-r--r--mpm/python/usrp_mpm/eeprom.py5
1 files changed, 2 insertions, 3 deletions
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(