diff --git a/tests/config.py b/tests/config.py index a5c3661c8f..4829a07903 100644 --- a/tests/config.py +++ b/tests/config.py @@ -5,6 +5,15 @@ sys.path = ['../',] + sys.path from trezorlib.transport_pipe import PipeTransport from trezorlib.transport_hid import HidTransport +from trezorlib.transport_udp import UdpTransport + +def pipe_exists(path): + import os + try: + os.stat(path) + return True + except: + return False devices = HidTransport.enumerate() @@ -16,11 +25,21 @@ if len(devices) > 0: DEBUG_TRANSPORT = HidTransport DEBUG_TRANSPORT_ARGS = (devices[0],) DEBUG_TRANSPORT_KWARGS = {'debug_link': True} -else: - print('Using Emulator(v1)') + +elif pipe_exists('/tmp/pipe.trezor.to'): + print('Using Emulator (v1=pipe)') TRANSPORT = PipeTransport TRANSPORT_ARGS = ('/tmp/pipe.trezor', False) TRANSPORT_KWARGS = {} DEBUG_TRANSPORT = PipeTransport DEBUG_TRANSPORT_ARGS = ('/tmp/pipe.trezor_debug', False) DEBUG_TRANSPORT_KWARGS = {} + +elif True: + print('Using Emulator (v2=udp)') + TRANSPORT = UdpTransport + TRANSPORT_ARGS = ('127.0.0.1:21324') + TRANSPORT_KWARGS = {} + DEBUG_TRANSPORT = UdpTransport + DEBUG_TRANSPORT_ARGS = ('127.0.0.1:21324') + DEBUG_TRANSPORT_KWARGS = {}