diff --git a/common/protob/messages-debug.proto b/common/protob/messages-debug.proto index e3ff1cd9a..8465cb22c 100644 --- a/common/protob/messages-debug.proto +++ b/common/protob/messages-debug.proto @@ -47,6 +47,7 @@ message DebugLinkLayout { message DebugLinkGetState { optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown optional bool wait_word_pos = 2; // Trezor T only - wait until reset word position is requested + optional bool wait_layout = 3; // wait until current layout changes } /** diff --git a/core/src/apps/debug/__init__.py b/core/src/apps/debug/__init__.py index b4e1ee9b9..e74df7c1e 100644 --- a/core/src/apps/debug/__init__.py +++ b/core/src/apps/debug/__init__.py @@ -94,7 +94,11 @@ if __debug__: m.mnemonic_type = mnemonic.get_type() m.passphrase_protection = has_passphrase() m.reset_entropy = reset_internal_entropy - m.layout_lines = current_content + + if msg.wait_layout: + m.layout_lines = await layout_change_chan.take() + else: + m.layout_lines = current_content if msg.wait_word_pos: m.reset_word_pos = await reset_word_index.take() diff --git a/core/src/trezor/messages/DebugLinkGetState.py b/core/src/trezor/messages/DebugLinkGetState.py index 74403cb42..0eb5d7278 100644 --- a/core/src/trezor/messages/DebugLinkGetState.py +++ b/core/src/trezor/messages/DebugLinkGetState.py @@ -17,13 +17,16 @@ class DebugLinkGetState(p.MessageType): self, wait_word_list: bool = None, wait_word_pos: bool = None, + wait_layout: bool = None, ) -> None: self.wait_word_list = wait_word_list self.wait_word_pos = wait_word_pos + self.wait_layout = wait_layout @classmethod def get_fields(cls) -> Dict: return { 1: ('wait_word_list', p.BoolType, 0), 2: ('wait_word_pos', p.BoolType, 0), + 3: ('wait_layout', p.BoolType, 0), } diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index fb2364247..ca48682fa 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -46,6 +46,10 @@ class DebugLink: def state(self): return self._call(proto.DebugLinkGetState()) + def wait_layout(self): + obj = self._call(proto.DebugLinkGetState(wait_layout=True)) + return obj.layout_lines + def read_pin(self): state = self.state() return state.pin, state.matrix diff --git a/python/src/trezorlib/messages/DebugLinkGetState.py b/python/src/trezorlib/messages/DebugLinkGetState.py index d84d2ddc6..188493d0e 100644 --- a/python/src/trezorlib/messages/DebugLinkGetState.py +++ b/python/src/trezorlib/messages/DebugLinkGetState.py @@ -17,13 +17,16 @@ class DebugLinkGetState(p.MessageType): self, wait_word_list: bool = None, wait_word_pos: bool = None, + wait_layout: bool = None, ) -> None: self.wait_word_list = wait_word_list self.wait_word_pos = wait_word_pos + self.wait_layout = wait_layout @classmethod def get_fields(cls) -> Dict: return { 1: ('wait_word_list', p.BoolType, 0), 2: ('wait_word_pos', p.BoolType, 0), + 3: ('wait_layout', p.BoolType, 0), }