1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

Working HID transport

This commit is contained in:
slush 2013-04-01 16:59:16 +02:00
parent a2ad820ac1
commit 5d1e1a79ae

View File

@ -32,13 +32,16 @@ class HidTransport(Transport):
serial_number = d.get('serial_number')
if (vendor_id, product_id) in DEVICE_IDS:
devices.append((vendor_id, product_id, serial_number))
devices.append("0x%04x:0x%04x:%s" % (vendor_id, product_id, serial_number))
return devices
def _open(self):
self.buffer = ''
self.hid = hid.device(self.device[0], self.device[1])#, self.device[2])
path = self.device.split(':')
self.hid = hid.device(int(path[0], 16), int(path[1], 16))#, path[2])
self.hid.send_feature_report([0x41, 0x01]) # enable UART
self.hid.send_feature_report([0x43, 0x03]) # purge TX/RX FIFOs
def _close(self):
self.hid.close()