|
|
|
@ -30,23 +30,23 @@ TREZOR_VERSION = None
|
|
|
|
|
|
|
|
|
|
def get_device():
|
|
|
|
|
path = os.environ.get("TREZOR_PATH")
|
|
|
|
|
interact = int(os.environ.get("INTERACT", 0))
|
|
|
|
|
if path:
|
|
|
|
|
transport = get_transport(path)
|
|
|
|
|
try:
|
|
|
|
|
transport = get_transport(path)
|
|
|
|
|
return TrezorClientDebugLink(transport, auto_interact=not interact)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise RuntimeError("Failed to open debuglink for {}".format(path)) from e
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
devices = enumerate_devices()
|
|
|
|
|
for device in devices:
|
|
|
|
|
if hasattr(device, "find_debug"):
|
|
|
|
|
transport = device
|
|
|
|
|
break
|
|
|
|
|
try:
|
|
|
|
|
return TrezorClientDebugLink(device, auto_interact=not interact)
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
raise RuntimeError("No debuggable device found")
|
|
|
|
|
env_interactive = int(os.environ.get("INTERACT", 0))
|
|
|
|
|
try:
|
|
|
|
|
return TrezorClientDebugLink(transport, auto_interact=not env_interactive)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise RuntimeError(
|
|
|
|
|
"Failed to open debuglink for {}".format(transport.get_path())
|
|
|
|
|
) from e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def device_version():
|
|
|
|
|