mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-08 22:40:59 +00:00
autodetect type of device in config
This commit is contained in:
parent
6ee8d7d949
commit
33d4fc9f24
@ -5,38 +5,30 @@ from trezorlib.transport_pipe import PipeTransport
|
||||
from trezorlib.transport_hid import HidTransport
|
||||
from trezorlib.transport_socket import SocketTransportClient
|
||||
|
||||
use_real = True
|
||||
use_pipe = False
|
||||
|
||||
if use_real:
|
||||
|
||||
devices = HidTransport.enumerate()
|
||||
TRANSPORT = HidTransport
|
||||
TRANSPORT_ARGS = (devices[0],)
|
||||
TRANSPORT_KWARGS = {'debug_link': False}
|
||||
|
||||
DEBUG_TRANSPORT = HidTransport
|
||||
DEBUG_TRANSPORT_ARGS = (devices[0],)
|
||||
DEBUG_TRANSPORT_KWARGS = {'debug_link': True}
|
||||
|
||||
elif use_pipe:
|
||||
devices = HidTransport.enumerate()
|
||||
|
||||
if len(devices) > 0:
|
||||
if devices[0][1] != None:
|
||||
print 'Using TREZOR'
|
||||
TRANSPORT = HidTransport
|
||||
TRANSPORT_ARGS = (devices[0],)
|
||||
TRANSPORT_KWARGS = {'debug_link': False}
|
||||
DEBUG_TRANSPORT = HidTransport
|
||||
DEBUG_TRANSPORT_ARGS = (devices[0],)
|
||||
DEBUG_TRANSPORT_KWARGS = {'debug_link': True}
|
||||
else:
|
||||
print 'Using Raspberry Pi'
|
||||
TRANSPORT = HidTransport
|
||||
TRANSPORT_ARGS = (devices[0],)
|
||||
TRANSPORT_KWARGS = {'debug_link': False}
|
||||
DEBUG_TRANSPORT = SocketTransportClient
|
||||
DEBUG_TRANSPORT_ARGS = ('trezor.bo:2000',)
|
||||
DEBUG_TRANSPORT_KWARGS = {}
|
||||
else:
|
||||
print 'Using Emulator'
|
||||
TRANSPORT = PipeTransport
|
||||
TRANSPORT_ARGS = ('../../trezor-emu/pipe.trezor', False)
|
||||
TRANSPORT_KWARGS = {}
|
||||
|
||||
DEBUG_TRANSPORT = PipeTransport
|
||||
DEBUG_TRANSPORT_ARGS = ('../../trezor-emu/pipe.trezor_debug', False)
|
||||
DEBUG_TRANSPORT_KWARGS = {}
|
||||
|
||||
else:
|
||||
|
||||
devices = HidTransport.enumerate()
|
||||
TRANSPORT = HidTransport
|
||||
TRANSPORT_ARGS = (devices[0],)
|
||||
TRANSPORT_KWARGS = {'debug_link': False}
|
||||
|
||||
DEBUG_TRANSPORT = SocketTransportClient
|
||||
DEBUG_TRANSPORT_ARGS = ('trezor.bo:2000', )
|
||||
# DEBUG_TRANSPORT_ARGS = ('trezor.dyn:2000')
|
||||
DEBUG_TRANSPORT_KWARGS = {}
|
||||
|
Loading…
Reference in New Issue
Block a user