1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 13:01:12 +00:00

Fix error when using trezorctl to connect to the trezor-core emulator. (#152)

* Fix error when using trezorctl to connect to the trezor-core emulator.

* Restore the ability to specify the host without the port
This commit is contained in:
Nicola Larosa 2017-11-13 22:15:09 +01:00 committed by Pavol Rusnak
parent 0d9ee4376d
commit 5d2d621055

View File

@ -36,9 +36,9 @@ class UdpTransport(Transport):
host = UdpTransport.DEFAULT_HOST host = UdpTransport.DEFAULT_HOST
port = UdpTransport.DEFAULT_PORT port = UdpTransport.DEFAULT_PORT
else: else:
host = device.split(':').get(0) devparts = device.split(':')
port = device.split(':').get(1, UdpTransport.DEFAULT_PORT) host = devparts[0]
port = int(port) port = int(devparts[1]) if len(devparts) > 1 else UdpTransport.DEFAULT_PORT
if not protocol: if not protocol:
protocol = ProtocolV2() protocol = ProtocolV2()
self.device = (host, port) self.device = (host, port)