1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

fix v2 protocol

This commit is contained in:
Pavol Rusnak 2016-09-26 17:32:54 +02:00
parent ed9f7d838f
commit ec4e85b008
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -247,12 +247,12 @@ class TransportV2(Transport):
return session_id
def _session_begin(self):
self._write_chunk(b'O' + b'\0' * 63)
self._write_chunk(bytearray(b'O' + b'\0' * 63))
self.session_id = self.parse_session_open(self._read_chunk())
def _session_end(self):
header = struct.pack(">L", self.session_id)
self._write_chunk(b'C' + header + b'\0' * (63 - len(header)))
self._write_chunk(bytearray(b'C' + header + b'\0' * (63 - len(header))))
if self._read_chunk()[0] != ord('C'):
raise Exception("Expected session close")
self.session_id = None