diff --git a/common/protob/messages-debug.proto b/common/protob/messages-debug.proto index d660360c2..e3ff1cd9a 100644 --- a/common/protob/messages-debug.proto +++ b/common/protob/messages-debug.proto @@ -10,7 +10,7 @@ import "messages-common.proto"; /** * Request: "Press" the button on the device * @start - * @next Success + * @next DebugLinkLayout */ message DebugLinkDecision { optional bool yes_no = 1; // true for "Confirm", false for "Cancel" @@ -25,6 +25,18 @@ message DebugLinkDecision { LEFT = 2; RIGHT = 3; } + + optional uint32 x = 4; // touch X coordinate + optional uint32 y = 5; // touch Y coordinate + optional bool wait = 6; // wait for layout change +} + +/** + * Response: Device text layout + * @end + */ +message DebugLinkLayout { + repeated string lines = 1; } /** @@ -54,6 +66,7 @@ message DebugLinkState { optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow optional uint32 reset_word_pos = 11; // index of mnemonic word the device is expecting during ResetDevice workflow optional uint32 mnemonic_type = 12; // current mnemonic type (BIP-39/SLIP-39) + repeated string layout_lines = 13; // current layout text } /** diff --git a/common/protob/messages.proto b/common/protob/messages.proto index 4bfa3e941..92d71162c 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -103,6 +103,7 @@ enum MessageType { MessageType_DebugLinkMemory = 111 [(wire_debug_out) = true]; MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true]; MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true]; + MessageType_DebugLinkLayout = 9001 [(wire_debug_out) = true]; // Ethereum MessageType_EthereumGetPublicKey = 450 [(wire_in) = true]; diff --git a/core/src/trezor/messages/DebugLinkDecision.py b/core/src/trezor/messages/DebugLinkDecision.py index 55d2a4092..715269cc3 100644 --- a/core/src/trezor/messages/DebugLinkDecision.py +++ b/core/src/trezor/messages/DebugLinkDecision.py @@ -19,10 +19,16 @@ class DebugLinkDecision(p.MessageType): yes_no: bool = None, swipe: EnumTypeDebugSwipeDirection = None, input: str = None, + x: int = None, + y: int = None, + wait: bool = None, ) -> None: self.yes_no = yes_no self.swipe = swipe self.input = input + self.x = x + self.y = y + self.wait = wait @classmethod def get_fields(cls) -> Dict: @@ -30,4 +36,7 @@ class DebugLinkDecision(p.MessageType): 1: ('yes_no', p.BoolType, 0), 2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3)), 0), 3: ('input', p.UnicodeType, 0), + 4: ('x', p.UVarintType, 0), + 5: ('y', p.UVarintType, 0), + 6: ('wait', p.BoolType, 0), } diff --git a/core/src/trezor/messages/DebugLinkLayout.py b/core/src/trezor/messages/DebugLinkLayout.py new file mode 100644 index 000000000..8fca66cd2 --- /dev/null +++ b/core/src/trezor/messages/DebugLinkLayout.py @@ -0,0 +1,26 @@ +# Automatically generated by pb2py +# fmt: off +import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class DebugLinkLayout(p.MessageType): + MESSAGE_WIRE_TYPE = 9001 + + def __init__( + self, + lines: List[str] = None, + ) -> None: + self.lines = lines if lines is not None else [] + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('lines', p.UnicodeType, p.FLAG_REPEATED), + } diff --git a/core/src/trezor/messages/DebugLinkState.py b/core/src/trezor/messages/DebugLinkState.py index 14b79c704..2c7a17fcf 100644 --- a/core/src/trezor/messages/DebugLinkState.py +++ b/core/src/trezor/messages/DebugLinkState.py @@ -29,6 +29,7 @@ class DebugLinkState(p.MessageType): recovery_word_pos: int = None, reset_word_pos: int = None, mnemonic_type: int = None, + layout_lines: List[str] = None, ) -> None: self.layout = layout self.pin = pin @@ -42,6 +43,7 @@ class DebugLinkState(p.MessageType): self.recovery_word_pos = recovery_word_pos self.reset_word_pos = reset_word_pos self.mnemonic_type = mnemonic_type + self.layout_lines = layout_lines if layout_lines is not None else [] @classmethod def get_fields(cls) -> Dict: @@ -58,4 +60,5 @@ class DebugLinkState(p.MessageType): 10: ('recovery_word_pos', p.UVarintType, 0), 11: ('reset_word_pos', p.UVarintType, 0), 12: ('mnemonic_type', p.UVarintType, 0), + 13: ('layout_lines', p.UnicodeType, p.FLAG_REPEATED), } diff --git a/core/src/trezor/messages/MessageType.py b/core/src/trezor/messages/MessageType.py index 5215fb445..3f58f8a0e 100644 --- a/core/src/trezor/messages/MessageType.py +++ b/core/src/trezor/messages/MessageType.py @@ -70,6 +70,7 @@ DebugLinkMemoryRead = 110 # type: Literal[110] DebugLinkMemory = 111 # type: Literal[111] DebugLinkMemoryWrite = 112 # type: Literal[112] DebugLinkFlashErase = 113 # type: Literal[113] +DebugLinkLayout = 9001 # type: Literal[9001] if not utils.BITCOIN_ONLY: EthereumGetPublicKey = 450 # type: Literal[450] EthereumPublicKey = 451 # type: Literal[451] diff --git a/python/src/trezorlib/messages/DebugLinkDecision.py b/python/src/trezorlib/messages/DebugLinkDecision.py index 177c0dc57..08030c611 100644 --- a/python/src/trezorlib/messages/DebugLinkDecision.py +++ b/python/src/trezorlib/messages/DebugLinkDecision.py @@ -19,10 +19,16 @@ class DebugLinkDecision(p.MessageType): yes_no: bool = None, swipe: EnumTypeDebugSwipeDirection = None, input: str = None, + x: int = None, + y: int = None, + wait: bool = None, ) -> None: self.yes_no = yes_no self.swipe = swipe self.input = input + self.x = x + self.y = y + self.wait = wait @classmethod def get_fields(cls) -> Dict: @@ -30,4 +36,7 @@ class DebugLinkDecision(p.MessageType): 1: ('yes_no', p.BoolType, 0), 2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3)), 0), 3: ('input', p.UnicodeType, 0), + 4: ('x', p.UVarintType, 0), + 5: ('y', p.UVarintType, 0), + 6: ('wait', p.BoolType, 0), } diff --git a/python/src/trezorlib/messages/DebugLinkLayout.py b/python/src/trezorlib/messages/DebugLinkLayout.py new file mode 100644 index 000000000..7b8b41b78 --- /dev/null +++ b/python/src/trezorlib/messages/DebugLinkLayout.py @@ -0,0 +1,26 @@ +# Automatically generated by pb2py +# fmt: off +from .. import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class DebugLinkLayout(p.MessageType): + MESSAGE_WIRE_TYPE = 9001 + + def __init__( + self, + lines: List[str] = None, + ) -> None: + self.lines = lines if lines is not None else [] + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('lines', p.UnicodeType, p.FLAG_REPEATED), + } diff --git a/python/src/trezorlib/messages/DebugLinkState.py b/python/src/trezorlib/messages/DebugLinkState.py index bce8b84b4..a0548c6a7 100644 --- a/python/src/trezorlib/messages/DebugLinkState.py +++ b/python/src/trezorlib/messages/DebugLinkState.py @@ -29,6 +29,7 @@ class DebugLinkState(p.MessageType): recovery_word_pos: int = None, reset_word_pos: int = None, mnemonic_type: int = None, + layout_lines: List[str] = None, ) -> None: self.layout = layout self.pin = pin @@ -42,6 +43,7 @@ class DebugLinkState(p.MessageType): self.recovery_word_pos = recovery_word_pos self.reset_word_pos = reset_word_pos self.mnemonic_type = mnemonic_type + self.layout_lines = layout_lines if layout_lines is not None else [] @classmethod def get_fields(cls) -> Dict: @@ -58,4 +60,5 @@ class DebugLinkState(p.MessageType): 10: ('recovery_word_pos', p.UVarintType, 0), 11: ('reset_word_pos', p.UVarintType, 0), 12: ('mnemonic_type', p.UVarintType, 0), + 13: ('layout_lines', p.UnicodeType, p.FLAG_REPEATED), } diff --git a/python/src/trezorlib/messages/MessageType.py b/python/src/trezorlib/messages/MessageType.py index 39ca8b2ff..2b216a8de 100644 --- a/python/src/trezorlib/messages/MessageType.py +++ b/python/src/trezorlib/messages/MessageType.py @@ -68,6 +68,7 @@ DebugLinkMemoryRead = 110 # type: Literal[110] DebugLinkMemory = 111 # type: Literal[111] DebugLinkMemoryWrite = 112 # type: Literal[112] DebugLinkFlashErase = 113 # type: Literal[113] +DebugLinkLayout = 9001 # type: Literal[9001] EthereumGetPublicKey = 450 # type: Literal[450] EthereumPublicKey = 451 # type: Literal[451] EthereumGetAddress = 56 # type: Literal[56] diff --git a/python/src/trezorlib/messages/__init__.py b/python/src/trezorlib/messages/__init__.py index 85fa35eab..8aa242e52 100644 --- a/python/src/trezorlib/messages/__init__.py +++ b/python/src/trezorlib/messages/__init__.py @@ -41,6 +41,7 @@ from .CosiSignature import CosiSignature from .DebugLinkDecision import DebugLinkDecision from .DebugLinkFlashErase import DebugLinkFlashErase from .DebugLinkGetState import DebugLinkGetState +from .DebugLinkLayout import DebugLinkLayout from .DebugLinkLog import DebugLinkLog from .DebugLinkMemory import DebugLinkMemory from .DebugLinkMemoryRead import DebugLinkMemoryRead