mirror of
https://github.com/romanz/amodem.git
synced 2026-05-04 09:06:27 +08:00
Allow using TREZOR bridge (instead of HID transport)
This commit is contained in:
@@ -17,6 +17,10 @@ class Trezor(interface.Device):
|
|||||||
@property
|
@property
|
||||||
def _defs(self):
|
def _defs(self):
|
||||||
from . import trezor_defs
|
from . import trezor_defs
|
||||||
|
# Allow using TREZOR bridge transport (instead of the HID default)
|
||||||
|
trezor_defs.Transport = {
|
||||||
|
'bridge': trezor_defs.BridgeTransport,
|
||||||
|
}.get(os.environ.get('TREZOR_TRANSPORT'), trezor_defs.HidTransport)
|
||||||
return trezor_defs
|
return trezor_defs
|
||||||
|
|
||||||
required_version = '>=1.4.0'
|
required_version = '>=1.4.0'
|
||||||
@@ -29,9 +33,9 @@ class Trezor(interface.Device):
|
|||||||
'non-empty' if self.passphrase else 'empty', self)
|
'non-empty' if self.passphrase else 'empty', self)
|
||||||
return self._defs.PassphraseAck(passphrase=self.passphrase)
|
return self._defs.PassphraseAck(passphrase=self.passphrase)
|
||||||
|
|
||||||
for d in self._defs.HidTransport.enumerate():
|
for d in self._defs.Transport.enumerate():
|
||||||
log.debug('endpoint: %s', d)
|
log.debug('endpoint: %s', d)
|
||||||
transport = self._defs.HidTransport(d)
|
transport = self._defs.Transport(d)
|
||||||
connection = self._defs.Client(transport)
|
connection = self._defs.Client(transport)
|
||||||
connection.callback_PassphraseRequest = passphrase_handler
|
connection.callback_PassphraseRequest = passphrase_handler
|
||||||
f = connection.features
|
f = connection.features
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
from trezorlib.client import CallException as Error
|
from trezorlib.client import CallException as Error
|
||||||
from trezorlib.client import TrezorClient as Client
|
from trezorlib.client import TrezorClient as Client
|
||||||
from trezorlib.messages_pb2 import PassphraseAck
|
from trezorlib.messages_pb2 import PassphraseAck
|
||||||
|
from trezorlib.transport_bridge import BridgeTransport
|
||||||
from trezorlib.transport_hid import HidTransport
|
from trezorlib.transport_hid import HidTransport
|
||||||
from trezorlib.types_pb2 import IdentityType
|
from trezorlib.types_pb2 import IdentityType
|
||||||
|
|||||||
Reference in New Issue
Block a user