1
0
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:
matejcik 2023-02-02 16:33:57 +01:00 committed by matejcik
parent 8d44db5270
commit 0846f3a9e3
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1 @@
Fixed behavior of UDP transport search by path when full path is provided and prefix_search is True

View File

@ -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: