1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

fix(core): properly respond to USB events while on a paginated screen

This commit is contained in:
matejcik 2021-07-15 10:59:43 +02:00 committed by matejcik
parent 13b8a6e54d
commit 2b3c75c4de
4 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1 @@
Properly respond to USB events while on a paginated screen.

View File

@ -114,7 +114,7 @@ class Paginated(ui.Layout):
await ctx.call(ButtonRequest(code=code, pages=len(self.pages)), ButtonAck)
result = WAS_PAGED
while result is WAS_PAGED:
result = await self
result = await ctx.wait(self)
return result

View File

@ -67,3 +67,27 @@ def test_cancel_message_via_initialize(client, message):
resp = client._raw_read()
assert isinstance(resp, m.Features)
@pytest.mark.skip_t1
def test_cancel_on_paginated(client):
"""Check that device is responsive on paginated screen. See #1708."""
# In #1708, the device would ignore USB (or UDP) events while waiting for the user
# to page through the screen. This means that this testcase, instead of failing,
# would get stuck waiting for the _raw_read result.
# I'm not spending the effort to modify the testcase to cause a _failure_ if that
# happens again. Just be advised that this should not get stuck.
message = m.SignMessage(
message=b"hello" * 64,
address_n=TEST_ADDRESS_N,
coin_name="Testnet",
)
resp = client.call_raw(message)
assert isinstance(resp, m.ButtonRequest)
assert resp.pages is not None
client._raw_write(m.ButtonAck())
client._raw_write(m.Cancel())
resp = client._raw_read()
assert isinstance(resp, m.Failure)
assert resp.code == m.FailureType.ActionCancelled

View File

@ -128,6 +128,7 @@
"test_cancel.py::test_cancel_message_via_cancel[message1]": "83a76ca8054759209fc06244ee303f95e20da9e6ccdfe268d16fba5e0065de69",
"test_cancel.py::test_cancel_message_via_initialize[message0]": "83a76ca8054759209fc06244ee303f95e20da9e6ccdfe268d16fba5e0065de69",
"test_cancel.py::test_cancel_message_via_initialize[message1]": "83a76ca8054759209fc06244ee303f95e20da9e6ccdfe268d16fba5e0065de69",
"test_cancel.py::test_cancel_on_paginated": "83a76ca8054759209fc06244ee303f95e20da9e6ccdfe268d16fba5e0065de69",
"test_debuglink.py::test_softlock_instability": "bdc28bcdb709f6ffd74ba89bc34ff87a2516c9277bad701c1c6d9e9926ce6871",
"test_descriptors.py::test_descriptors[Bitcoin-0-InputScriptType.SPENDADDRESS-descriptors0]": "2cfe6b7b4d74644c8bdef3f18d8a9be8c20787ab5e9af2588bac2c426a5f1da7",
"test_descriptors.py::test_descriptors[Bitcoin-0-InputScriptType.SPENDP2SHWITNESS-descriptors4]": "5b87cbe3b60327d699545bf61101cf633f66d66bc485d692c51505c18519948a",