From e3570f7d6dac9594729b31ee79c10c8066e8c97d Mon Sep 17 00:00:00 2001 From: grdddj Date: Fri, 31 Mar 2023 12:34:31 +0200 Subject: [PATCH] TR-common/protob: add DebugPhysicalButton --- common/protob/messages-debug.proto | 11 +++++++++++ core/src/all_modules.py | 2 ++ core/src/trezor/enums/DebugPhysicalButton.py | 7 +++++++ core/src/trezor/enums/__init__.py | 5 +++++ core/src/trezor/messages.py | 3 +++ python/src/trezorlib/messages.py | 6 ++++++ 6 files changed, 34 insertions(+) create mode 100644 core/src/trezor/enums/DebugPhysicalButton.py diff --git a/common/protob/messages-debug.proto b/common/protob/messages-debug.proto index efe347b276..8968c30108 100644 --- a/common/protob/messages-debug.proto +++ b/common/protob/messages-debug.proto @@ -39,10 +39,21 @@ message DebugLinkDecision { INFO = 2; } + /** + * Structure representing model R button presses + */ + // TODO: probably delete the middle_btn as it is not a physical one + enum DebugPhysicalButton { + LEFT_BTN = 0; + MIDDLE_BTN = 1; + RIGHT_BTN = 2; + } + optional uint32 x = 4; // touch X coordinate optional uint32 y = 5; // touch Y coordinate optional bool wait = 6; // wait for layout change optional uint32 hold_ms = 7; // touch hold duration + optional DebugPhysicalButton physical_button = 8; // physical button press } /** diff --git a/core/src/all_modules.py b/core/src/all_modules.py index 47ab4c333f..33909701d8 100644 --- a/core/src/all_modules.py +++ b/core/src/all_modules.py @@ -99,6 +99,8 @@ trezor.enums.Capability import trezor.enums.Capability trezor.enums.DebugButton import trezor.enums.DebugButton +trezor.enums.DebugPhysicalButton +import trezor.enums.DebugPhysicalButton trezor.enums.DebugSwipeDirection import trezor.enums.DebugSwipeDirection trezor.enums.DecredStakingSpendType diff --git a/core/src/trezor/enums/DebugPhysicalButton.py b/core/src/trezor/enums/DebugPhysicalButton.py new file mode 100644 index 0000000000..e10b03def7 --- /dev/null +++ b/core/src/trezor/enums/DebugPhysicalButton.py @@ -0,0 +1,7 @@ +# Automatically generated by pb2py +# fmt: off +# isort:skip_file + +LEFT_BTN = 0 +MIDDLE_BTN = 1 +RIGHT_BTN = 2 diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index eead516c86..c701dad56c 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -455,6 +455,11 @@ if TYPE_CHECKING: YES = 1 INFO = 2 + class DebugPhysicalButton(IntEnum): + LEFT_BTN = 0 + MIDDLE_BTN = 1 + RIGHT_BTN = 2 + class EthereumDefinitionType(IntEnum): NETWORK = 0 TOKEN = 1 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 814292c922..78809b2f6c 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -35,6 +35,7 @@ if TYPE_CHECKING: from trezor.enums import CardanoTxSigningMode # noqa: F401 from trezor.enums import CardanoTxWitnessType # noqa: F401 from trezor.enums import DebugButton # noqa: F401 + from trezor.enums import DebugPhysicalButton # noqa: F401 from trezor.enums import DebugSwipeDirection # noqa: F401 from trezor.enums import DecredStakingSpendType # noqa: F401 from trezor.enums import EthereumDataType # noqa: F401 @@ -2619,6 +2620,7 @@ if TYPE_CHECKING: y: "int | None" wait: "bool | None" hold_ms: "int | None" + physical_button: "DebugPhysicalButton | None" def __init__( self, @@ -2630,6 +2632,7 @@ if TYPE_CHECKING: y: "int | None" = None, wait: "bool | None" = None, hold_ms: "int | None" = None, + physical_button: "DebugPhysicalButton | None" = None, ) -> None: pass diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 160bee4488..d4121167a0 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -492,6 +492,12 @@ class DebugButton(IntEnum): INFO = 2 +class DebugPhysicalButton(IntEnum): + LEFT_BTN = 0 + MIDDLE_BTN = 1 + RIGHT_BTN = 2 + + class EthereumDefinitionType(IntEnum): NETWORK = 0 TOKEN = 1