mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
fix(python/transport): fix UDP prefix search if correct full path is given
This commit is contained in:
parent
8d44db5270
commit
0846f3a9e3
1
python/.changelog.d/2786.fixed
Normal file
1
python/.changelog.d/2786.fixed
Normal file
@ -0,0 +1 @@
|
||||
Fixed behavior of UDP transport search by path when full path is provided and prefix_search is True
|
@ -84,11 +84,17 @@ class UdpTransport(ProtocolBasedTransport):
|
||||
|
||||
@classmethod
|
||||
def find_by_path(cls, path: str, prefix_search: bool = False) -> "UdpTransport":
|
||||
try:
|
||||
path = path.replace(f"{cls.PATH_PREFIX}:", "")
|
||||
return cls._try_path(path)
|
||||
except TransportException:
|
||||
if not prefix_search:
|
||||
raise
|
||||
|
||||
if prefix_search:
|
||||
return super().find_by_path(path, prefix_search)
|
||||
else:
|
||||
path = path.replace(f"{cls.PATH_PREFIX}:", "")
|
||||
return cls._try_path(path)
|
||||
raise TransportException(f"No UDP device at {path}")
|
||||
|
||||
def wait_until_ready(self, timeout: float = 10) -> None:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user