1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +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 {
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
}
/**

View File

@ -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()

View File

@ -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),
}

View File

@ -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

View File

@ -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),
}