mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
use new hidapi api
This commit is contained in:
parent
57151ce1b3
commit
2587eff8fd
2
cmd.py
2
cmd.py
@ -114,6 +114,8 @@ class Commands(object):
|
||||
return self.client.load_device(seed, args.pin)
|
||||
|
||||
def firmware_update(self, args):
|
||||
if not args.file:
|
||||
raise Exception("Must provide firmware filename")
|
||||
fp = open(args.file, 'r')
|
||||
if fp.read(4) != 'TRZR':
|
||||
raise Exception("Trezor firmware header expected")
|
||||
|
@ -40,7 +40,8 @@ class HidTransport(Transport):
|
||||
def _open(self):
|
||||
self.buffer = ''
|
||||
path = self.device.split(':')
|
||||
self.hid = hid.device(int(path[0], 16), int(path[1], 16))#, path[2])
|
||||
self.hid = hid.device()
|
||||
self.hid.open(int(path[0], 16), int(path[1], 16))
|
||||
self.hid.set_nonblocking(True)
|
||||
self.hid.send_feature_report([0x41, 0x01]) # enable UART
|
||||
self.hid.send_feature_report([0x43, 0x03]) # purge TX/RX FIFOs
|
||||
|
Loading…
Reference in New Issue
Block a user