mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +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
|
@classmethod
|
||||||
def find_by_path(cls, path: str, prefix_search: bool = False) -> "UdpTransport":
|
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:
|
if prefix_search:
|
||||||
return super().find_by_path(path, prefix_search)
|
return super().find_by_path(path, prefix_search)
|
||||||
else:
|
else:
|
||||||
path = path.replace(f"{cls.PATH_PREFIX}:", "")
|
raise TransportException(f"No UDP device at {path}")
|
||||||
return cls._try_path(path)
|
|
||||||
|
|
||||||
def wait_until_ready(self, timeout: float = 10) -> None:
|
def wait_until_ready(self, timeout: float = 10) -> None:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user