mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
tools: update to new transport api
This commit is contained in:
parent
8202971109
commit
259a61878b
@ -41,7 +41,7 @@ def choose_device(devices):
|
||||
|
||||
if len(devices) == 1:
|
||||
try:
|
||||
return HidTransport(devices[0])
|
||||
return devices[0]
|
||||
except IOError:
|
||||
raise Exception("Device is currently in use")
|
||||
|
||||
@ -50,18 +50,16 @@ def choose_device(devices):
|
||||
sys.stderr.write("Available devices:\n")
|
||||
for d in devices:
|
||||
try:
|
||||
t = HidTransport(d)
|
||||
client = TrezorClient(d)
|
||||
except IOError:
|
||||
sys.stderr.write("[-] <device is currently in use>\n")
|
||||
continue
|
||||
|
||||
client = TrezorClient(t)
|
||||
|
||||
if client.features.label:
|
||||
sys.stderr.write("[%d] %s\n" % (i, client.features.label))
|
||||
else:
|
||||
sys.stderr.write("[%d] <no label>\n" % i)
|
||||
t.close()
|
||||
client.close()
|
||||
i += 1
|
||||
|
||||
sys.stderr.write("----------------------------\n")
|
||||
@ -69,7 +67,7 @@ def choose_device(devices):
|
||||
|
||||
try:
|
||||
device_id = int(input())
|
||||
return HidTransport(devices[device_id])
|
||||
return devices[device_id]
|
||||
except:
|
||||
raise Exception("Invalid choice, exiting...")
|
||||
|
||||
|
@ -15,7 +15,7 @@ def main():
|
||||
return
|
||||
|
||||
# Use first connected device
|
||||
transport = HidTransport(devices[0])
|
||||
transport = devices[0]
|
||||
|
||||
# Creates object for manipulating TREZOR
|
||||
client = TrezorClient(transport)
|
||||
|
@ -25,10 +25,10 @@ def main():
|
||||
return
|
||||
|
||||
# Use first connected device
|
||||
transport = HidTransport(devices[0])
|
||||
transport = devices[0]
|
||||
debug_transport = devices[0].find_debug()
|
||||
|
||||
# Creates object for manipulating TREZOR
|
||||
debug_transport = HidTransport(devices[0], **{'debug_link': True})
|
||||
client = TrezorClient(transport)
|
||||
debug = DebugLink(debug_transport)
|
||||
|
||||
|
@ -18,10 +18,10 @@ def main():
|
||||
return
|
||||
|
||||
# Use first connected device
|
||||
transport = HidTransport(devices[0])
|
||||
transport = devices[0]
|
||||
debug_transport = devices[0].find_debug()
|
||||
|
||||
# Creates object for manipulating TREZOR
|
||||
debug_transport = HidTransport(devices[0], **{'debug_link': True})
|
||||
client = TrezorClient(transport)
|
||||
debug = DebugLink(debug_transport)
|
||||
|
||||
|
@ -15,7 +15,7 @@ def get_client():
|
||||
devices = HidTransport.enumerate() # list all connected TREZORs on USB
|
||||
if len(devices) == 0: # check whether we found any
|
||||
return None
|
||||
transport = HidTransport(devices[0]) # use first connected device
|
||||
transport = devices[0] # use first connected device
|
||||
return TrezorClient(transport) # creates object for communicating with TREZOR
|
||||
|
||||
|
||||
|
@ -161,9 +161,8 @@ def main():
|
||||
return
|
||||
|
||||
# Use first connected device
|
||||
print(devices[0][0])
|
||||
# transport = BridgeTransport(devices[0][0])
|
||||
transport = HidTransport(devices[0])
|
||||
transport = devices[0]
|
||||
print(transport)
|
||||
|
||||
txstore = MyTxApiBitcoin()
|
||||
|
||||
|
@ -34,7 +34,7 @@ def get_client():
|
||||
devices = HidTransport.enumerate() # list all connected TREZORs on USB
|
||||
if len(devices) == 0: # check whether we found any
|
||||
return None
|
||||
transport = HidTransport(devices[0]) # use first connected device
|
||||
transport = devices[0] # use first connected device
|
||||
return TrezorClient(transport) # creates object for communicating with TREZOR
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user