1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

Fix for older python version

This commit is contained in:
Jochen Hoenicke 2016-07-19 21:37:54 +02:00
parent a129b072d3
commit 90122cf29a

View File

@ -145,7 +145,7 @@ class TransportV1(Transport):
try: try:
headerlen = struct.calcsize(">HL") headerlen = struct.calcsize(">HL")
(msg_type, datalen) = struct.unpack(">HL", chunk[3:3 + headerlen]) (msg_type, datalen) = struct.unpack(">HL", bytes(chunk[3:3 + headerlen]))
except: except:
raise Exception("Cannot parse header") raise Exception("Cannot parse header")
@ -205,7 +205,7 @@ class TransportV2(Transport):
try: try:
headerlen = struct.calcsize(">LLL") headerlen = struct.calcsize(">LLL")
(session_id, msg_type, datalen) = struct.unpack(">LLL", chunk[2:2 + headerlen]) (session_id, msg_type, datalen) = struct.unpack(">LLL", bytes(chunk[2:2 + headerlen]))
except: except:
raise Exception("Cannot parse header") raise Exception("Cannot parse header")
@ -218,7 +218,7 @@ class TransportV2(Transport):
try: try:
headerlen = struct.calcsize(">L") headerlen = struct.calcsize(">L")
(session_id,) = struct.unpack(">L", chunk[1:1 + headerlen]) (session_id,) = struct.unpack(">L", bytes(chunk[1:1 + headerlen]))
except: except:
raise Exception("Cannot parse header") raise Exception("Cannot parse header")