diff --git a/core/src/apps/debug/__init__.py b/core/src/apps/debug/__init__.py index e5ea8379b9..6a3c67dd07 100644 --- a/core/src/apps/debug/__init__.py +++ b/core/src/apps/debug/__init__.py @@ -102,6 +102,7 @@ if __debug__: async def return_layout_change() -> None: content = await layout_change_chan.take() + layout_change_chan.putters.clear() assert DEBUG_CONTEXT is not None if storage.layout_watcher is LAYOUT_WATCHER_LAYOUT: await DEBUG_CONTEXT.write(DebugLinkLayout(lines=content)) @@ -126,6 +127,9 @@ if __debug__: if msg.watch: await ui.wait_until_layout_is_running() storage.watch_layout_changes = bool(msg.watch) + if msg.watch and ui.RUNNING_LAYOUT: + ui.RUNNING_LAYOUT.should_notify_layout_change = False + notify_layout_change(ui.RUNNING_LAYOUT) log.debug(__name__, "Watch layout changes: %s", storage.watch_layout_changes) return Success() diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index f2c974b848..e7d0701131 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -33,6 +33,7 @@ if __debug__: class RustLayout(ui.Layout): # pylint: disable=super-init-not-called def __init__(self, layout: Any, is_backup: bool = False): + super().__init__() self.layout = layout self.timer = loop.Timer() self.layout.attach_timer_fn(self.set_timer) diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index ce98a881a0..285d53e045 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -141,6 +141,10 @@ if __debug__: PROTOBUF_BUFFER_SIZE_DEBUG = 1024 WIRE_BUFFER_DEBUG = bytearray(PROTOBUF_BUFFER_SIZE_DEBUG) +if __debug__: + PROTOBUF_BUFFER_SIZE_DEBUG = 1024 + WIRE_BUFFER_DEBUG = bytearray(PROTOBUF_BUFFER_SIZE_DEBUG) + class Context: def __init__(self, iface: WireInterface, sid: int, buffer: bytearray) -> None: diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index a05c38809e..b0100cc120 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -705,6 +705,14 @@ class TrezorClientDebugLink(TrezorClient): # - TT < 2.3.0 does not reply to unknown debuglink messages due to a bug self.debug.watch_layout(watch) + if self.version >= (2, 5, 2) and watch: + first_layout = self.debug.wait_layout() + assert(any(hs in first_layout.text) for hs in ( + "Homescreen", + "Lockscreen", + "RecoveryHomescreen", + )) + def __enter__(self) -> "TrezorClientDebugLink": # For usage in with/expected_responses if self.in_with_statement: diff --git a/tests/device_tests/bitcoin/test_getaddress_show.py b/tests/device_tests/bitcoin/test_getaddress_show.py index 7cee35a45f..e47bf8a7c5 100644 --- a/tests/device_tests/bitcoin/test_getaddress_show.py +++ b/tests/device_tests/bitcoin/test_getaddress_show.py @@ -178,8 +178,6 @@ VECTORS_MULTISIG = ( # script_type, bip48_type, address, xpubs, ignore_xpub_mag ) -# NOTE: contains wait_layout race that manifests on hw sometimes -@pytest.mark.flaky(max_runs=5) @pytest.mark.skip_t1 @pytest.mark.multisig @pytest.mark.parametrize( diff --git a/tests/device_tests/bitcoin/test_signmessage.py b/tests/device_tests/bitcoin/test_signmessage.py index 5fa0d3037a..613763bf6c 100644 --- a/tests/device_tests/bitcoin/test_signmessage.py +++ b/tests/device_tests/bitcoin/test_signmessage.py @@ -328,7 +328,7 @@ def test_signmessage_pagination(client: Client, message: str): with client: client.set_input_flow(input_flow) - client.debug.watch_layout(True) + client.watch_layout() btc.sign_message( client, coin_name="Bitcoin",