From 0f48e15c48c20101c81ef327b8d7200f40cd6fbe Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 13 Jul 2016 17:41:08 +0200 Subject: [PATCH] fix v2 transport --- trezorlib/transport.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trezorlib/transport.py b/trezorlib/transport.py index 3e26089..cdc6a52 100644 --- a/trezorlib/transport.py +++ b/trezorlib/transport.py @@ -188,12 +188,12 @@ class TransportV2(Transport): while len(data) < datalen: 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") - data.extend(data) + data.extend(next_data) # Strip padding zeros data = data[:datalen] @@ -218,7 +218,7 @@ class TransportV2(Transport): try: headerlen = struct.calcsize(">L") - session_id = struct.unpack(">L", chunk[1:1 + headerlen]) + (session_id,) = struct.unpack(">L", chunk[1:1 + headerlen]) except: raise Exception("Cannot parse header")