mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-22 04:22:07 +00:00
transport_udp: Support TREZOR_TRANSPORT_V1
This commit is contained in:
parent
de95c44ad1
commit
1193b0ee85
@ -18,8 +18,10 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import socket
|
||||
|
||||
from .protocol_v1 import ProtocolV1
|
||||
from .protocol_v2 import ProtocolV2
|
||||
from .transport import Transport
|
||||
|
||||
@ -40,7 +42,11 @@ class UdpTransport(Transport):
|
||||
host = devparts[0]
|
||||
port = int(devparts[1]) if len(devparts) > 1 else UdpTransport.DEFAULT_PORT
|
||||
if not protocol:
|
||||
protocol = ProtocolV2()
|
||||
force_v1 = os.environ.get('TREZOR_TRANSPORT_V1', '0')
|
||||
if not int(force_v1):
|
||||
protocol = ProtocolV2()
|
||||
else:
|
||||
protocol = ProtocolV1()
|
||||
self.device = (host, port)
|
||||
self.protocol = protocol
|
||||
self.socket = None
|
||||
|
Loading…
Reference in New Issue
Block a user