mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-06 08:59:15 +00:00
Fix handling of find_by_path in transports.
This commit is contained in:
parent
d45cba1ddb
commit
6a22cf481c
@ -97,7 +97,7 @@ class HidTransport(Transport):
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_by_path(cls, path=None):
|
def find_by_path(cls, path):
|
||||||
if isinstance(path, str):
|
if isinstance(path, str):
|
||||||
path = path.encode()
|
path = path.encode()
|
||||||
path = path.replace(b'%s:' % cls.PATH_PREFIX.encode(), b'')
|
path = path.replace(b'%s:' % cls.PATH_PREFIX.encode(), b'')
|
||||||
|
@ -69,11 +69,8 @@ class UdpTransport(Transport):
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_by_path(cls, path=None):
|
def find_by_path(cls, path):
|
||||||
if isinstance(path, str):
|
path = path.replace('%s:' % cls.PATH_PREFIX, '')
|
||||||
path = path.encode()
|
|
||||||
|
|
||||||
path = path.replace(b'%s:' % cls.PATH_PREFIX.encode(), b'')
|
|
||||||
return UdpTransport(path)
|
return UdpTransport(path)
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
|
@ -106,7 +106,7 @@ class WebUsbTransport(Transport):
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_by_path(cls, path=None):
|
def find_by_path(cls, path):
|
||||||
path = path.replace('%s:' % cls.PATH_PREFIX, '') # Remove prefix from __str__()
|
path = path.replace('%s:' % cls.PATH_PREFIX, '') # Remove prefix from __str__()
|
||||||
for transport in WebUsbTransport.enumerate():
|
for transport in WebUsbTransport.enumerate():
|
||||||
if path is None or dev_to_str(transport.device) == path:
|
if path is None or dev_to_str(transport.device) == path:
|
||||||
|
Loading…
Reference in New Issue
Block a user