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

debug: add support for general layout waiting

This commit is contained in:
matejcik 2019-10-16 17:38:48 +02:00
parent 97525654bb
commit a8fc569016
5 changed files with 16 additions and 1 deletions

View File

@ -47,6 +47,7 @@ message DebugLinkLayout {
message DebugLinkGetState { message DebugLinkGetState {
optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown 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_word_pos = 2; // Trezor T only - wait until reset word position is requested
optional bool wait_layout = 3; // wait until current layout changes
} }
/** /**

View File

@ -94,6 +94,10 @@ if __debug__:
m.mnemonic_type = mnemonic.get_type() m.mnemonic_type = mnemonic.get_type()
m.passphrase_protection = has_passphrase() m.passphrase_protection = has_passphrase()
m.reset_entropy = reset_internal_entropy m.reset_entropy = reset_internal_entropy
if msg.wait_layout:
m.layout_lines = await layout_change_chan.take()
else:
m.layout_lines = current_content m.layout_lines = current_content
if msg.wait_word_pos: if msg.wait_word_pos:

View File

@ -17,13 +17,16 @@ class DebugLinkGetState(p.MessageType):
self, self,
wait_word_list: bool = None, wait_word_list: bool = None,
wait_word_pos: bool = None, wait_word_pos: bool = None,
wait_layout: bool = None,
) -> None: ) -> None:
self.wait_word_list = wait_word_list self.wait_word_list = wait_word_list
self.wait_word_pos = wait_word_pos self.wait_word_pos = wait_word_pos
self.wait_layout = wait_layout
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
1: ('wait_word_list', p.BoolType, 0), 1: ('wait_word_list', p.BoolType, 0),
2: ('wait_word_pos', p.BoolType, 0), 2: ('wait_word_pos', p.BoolType, 0),
3: ('wait_layout', p.BoolType, 0),
} }

View File

@ -46,6 +46,10 @@ class DebugLink:
def state(self): def state(self):
return self._call(proto.DebugLinkGetState()) 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): def read_pin(self):
state = self.state() state = self.state()
return state.pin, state.matrix return state.pin, state.matrix

View File

@ -17,13 +17,16 @@ class DebugLinkGetState(p.MessageType):
self, self,
wait_word_list: bool = None, wait_word_list: bool = None,
wait_word_pos: bool = None, wait_word_pos: bool = None,
wait_layout: bool = None,
) -> None: ) -> None:
self.wait_word_list = wait_word_list self.wait_word_list = wait_word_list
self.wait_word_pos = wait_word_pos self.wait_word_pos = wait_word_pos
self.wait_layout = wait_layout
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
1: ('wait_word_list', p.BoolType, 0), 1: ('wait_word_list', p.BoolType, 0),
2: ('wait_word_pos', p.BoolType, 0), 2: ('wait_word_pos', p.BoolType, 0),
3: ('wait_layout', p.BoolType, 0),
} }