Skip to content

Commit

Permalink
Revert "fix(python/debuglink): time out after waiting for empty-state…
Browse files Browse the repository at this point in the history
… response"

This reverts commit fd2f3a8.
  • Loading branch information
matejcik committed Feb 21, 2025
1 parent 237540f commit ef0638f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions python/src/trezorlib/debuglink.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ def _write(self, msg: protobuf.MessageType) -> None:
)
self.transport.write(msg_type, msg_bytes)

def _read(self, timeout: float | None = None) -> protobuf.MessageType:
ret_type, ret_bytes = self.transport.read(timeout=timeout)
def _read(self) -> protobuf.MessageType:
ret_type, ret_bytes = self.transport.read()
LOG.log(
DUMP_BYTES,
f"received type {ret_type} ({len(ret_bytes)} bytes): {ret_bytes.hex()}",
Expand All @@ -513,9 +513,9 @@ def _read(self, timeout: float | None = None) -> protobuf.MessageType:
)
return msg

def _call(self, msg: protobuf.MessageType, timeout: float | None = None) -> Any:
def _call(self, msg: protobuf.MessageType) -> Any:
self._write(msg)
return self._read(timeout=timeout)
return self._read()

def state(self, wait_type: DebugWaitType | None = None) -> messages.DebugLinkState:
if wait_type is None:
Expand Down Expand Up @@ -640,10 +640,7 @@ def _decision(self, decision: messages.DebugLinkDecision) -> None:
if self.model is models.T1B1:
return
# When the call below returns, we know that `decision` has been processed in Core.
# XXX Due to a bug, the reply may get lost at the end of a workflow.
# We assume that no single input event takes more than 5 seconds to process,
# and give up waiting after that.
self._call(messages.DebugLinkGetState(return_empty_state=True), timeout=5)
self._call(messages.DebugLinkGetState(return_empty_state=True))

press_yes = _make_input_func(button=messages.DebugButton.YES)
"""Confirm current layout. See `_decision` for more details."""
Expand Down

0 comments on commit ef0638f

Please sign in to comment.