From 0cb800e001fc443b82f827119597cb2b8167c031 Mon Sep 17 00:00:00 2001 From: Steven Bingler Date: Fri, 1 Dec 2017 16:41:31 -0600 Subject: mpm: Fix python2 vs python3 zlib.crc32 output difference Zlib's crc32 outputs signed values in python2 and unsigned values in python3. As per this page (https://docs.python.org/2/library/zlib.html) 0xffffffff can be AND'd to the result to get the same value between Python versions --- mpm/python/usrp_mpm/eeprom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mpm') diff --git a/mpm/python/usrp_mpm/eeprom.py b/mpm/python/usrp_mpm/eeprom.py index 53a4919e4..0ac649ce7 100644 --- a/mpm/python/usrp_mpm/eeprom.py +++ b/mpm/python/usrp_mpm/eeprom.py @@ -131,7 +131,7 @@ def read_eeprom( parsed_data = eeprom_parser.unpack_from(data) read_crc = parsed_data[-1] rawdata_without_crc = eeprom_parser_no_crc.pack(*(parsed_data[0:-1])) - expected_crc = zlib.crc32(rawdata_without_crc) + expected_crc = zlib.crc32(rawdata_without_crc) & 0xffffffff if read_crc != expected_crc: raise RuntimeError( "Received incorrect CRC."\ -- cgit v1.2.3