mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-26 09:52:34 +00:00
fix v2 transport
This commit is contained in:
parent
e00453661d
commit
0f48e15c48
@ -188,12 +188,12 @@ class TransportV2(Transport):
|
|||||||
|
|
||||||
while len(data) < datalen:
|
while len(data) < datalen:
|
||||||
chunk = self._read_chunk()
|
chunk = self._read_chunk()
|
||||||
(session_id2, data) = self.parse_next(chunk)
|
(next_session_id, next_data) = self.parse_next(chunk)
|
||||||
|
|
||||||
if session_id != session_id2:
|
if next_session_id != session_id:
|
||||||
raise Exception("Session id mismatch")
|
raise Exception("Session id mismatch")
|
||||||
|
|
||||||
data.extend(data)
|
data.extend(next_data)
|
||||||
|
|
||||||
# Strip padding zeros
|
# Strip padding zeros
|
||||||
data = data[:datalen]
|
data = data[:datalen]
|
||||||
@ -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", chunk[1:1 + headerlen])
|
||||||
except:
|
except:
|
||||||
raise Exception("Cannot parse header")
|
raise Exception("Cannot parse header")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user