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
1 changed files with 3 additions and 3 deletions

View File

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