use new hidapi api

pull/25/head
Pavol Rusnak 11 years ago
parent 57151ce1b3
commit 2587eff8fd

@ -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…
Cancel
Save