mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-15 19:08:07 +00:00
fix(python): opportunistically catch a debuglink desync
In certain cases a DebugLinkState response can get stalled and debuglink will not read it -- i.e., a situation analogous to wirelink de-sync. There doesn't seem to be a good way to force-sync debuglink the same way wirelink does it, but we can detect a wrong response to a DebugLinkGetState and skip it.
This commit is contained in:
parent
a4bd771e3b
commit
ef90546324
@ -521,6 +521,8 @@ class DebugLink:
|
||||
self, wait_type: DebugWaitType = DebugWaitType.CURRENT_LAYOUT
|
||||
) -> messages.DebugLinkState:
|
||||
result = self._call(messages.DebugLinkGetState(wait_layout=wait_type))
|
||||
while not isinstance(result, (messages.Failure, messages.DebugLinkState)):
|
||||
result = self._read()
|
||||
if isinstance(result, messages.Failure):
|
||||
raise TrezorFailure(result)
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user