Skip to content

test(core): send Cancel only on T1B1 #5567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions python/src/trezorlib/debuglink.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,17 +1423,20 @@ def sync_responses(self) -> None:
"""
import secrets

# Start by canceling whatever is on screen. This will work to cancel T1 PIN
# prompt, which is in TINY mode and does not respond to `Ping`.
if self.protocol_version is ProtocolVersion.V1:
assert isinstance(self.protocol, ProtocolV1Channel)
self.protocol.write(messages.Cancel())
resp = self.protocol.read()
if self.model is models.T1B1:
# Start by canceling whatever is on screen. This will work to cancel T1 PIN
# prompt, which is in TINY mode and does not respond to `Ping`.
self.protocol.write(messages.Cancel())

message = "SYNC" + secrets.token_hex(8)
self.protocol.write(messages.Ping(message=message))
while resp != messages.Success(message=message):
success = messages.Success(message=message)
while True:
try:
resp = self.protocol.read()
if self.protocol.read() == success:
return
except Exception:
pass

Expand Down
Loading