mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
use hid_version=2 for HidTransportV2
This commit is contained in:
parent
ec4e85b008
commit
25672288cf
@ -68,15 +68,18 @@ class _HidTransport(object):
|
|||||||
self.hid.set_nonblocking(True)
|
self.hid.set_nonblocking(True)
|
||||||
|
|
||||||
# determine hid_version
|
# determine hid_version
|
||||||
r = self.hid.write([0, 63, ] + [0xFF] * 63)
|
if isinstance(self, HidTransportV2):
|
||||||
if r == 65:
|
|
||||||
self.hid_version = 2
|
self.hid_version = 2
|
||||||
return
|
else:
|
||||||
r = self.hid.write([63, ] + [0xFF] * 63)
|
r = self.hid.write([0, 63, ] + [0xFF] * 63)
|
||||||
if r == 64:
|
if r == 65:
|
||||||
self.hid_version = 1
|
self.hid_version = 2
|
||||||
return
|
return
|
||||||
raise ConnectionError("Unknown HID version")
|
r = self.hid.write([63, ] + [0xFF] * 63)
|
||||||
|
if r == 64:
|
||||||
|
self.hid_version = 1
|
||||||
|
return
|
||||||
|
raise ConnectionError("Unknown HID version")
|
||||||
|
|
||||||
def _close(self):
|
def _close(self):
|
||||||
self.hid.close()
|
self.hid.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user