debug: add support for general layout waiting

pull/632/head
matejcik 5 years ago
parent 97525654bb
commit a8fc569016

@ -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
}
/**

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

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

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

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

Loading…
Cancel
Save