From fcd793e6e47ff4822a48e79f092d50afbf553550 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Tue, 31 Oct 2017 13:51:13 +0100 Subject: [PATCH] transport_hid: force V1 transport with env var --- trezorlib/transport_hid.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trezorlib/transport_hid.py b/trezorlib/transport_hid.py index 72ee8f1ff..d9b028a4a 100644 --- a/trezorlib/transport_hid.py +++ b/trezorlib/transport_hid.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import time import hid +import os from .protocol_v1 import ProtocolV1 from .protocol_v2 import ProtocolV2 @@ -63,7 +64,9 @@ class HidTransport(Transport): hid_handle = HidHandle(device['path']) if protocol is None: - if is_trezor2(device): + force_v1 = os.environ.get('TREZOR_TRANSPORT_V1', '0') + + if is_trezor2(device) and not int(force_v1): protocol = ProtocolV2() else: protocol = ProtocolV1() @@ -74,7 +77,7 @@ class HidTransport(Transport): self.hid_version = None def __str__(self): - return self.device['path'] + return self.device['path'].decode() @staticmethod def enumerate(debug=False):