mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
protobuf: send x/y coordinates, allow waiting for layout change
This commit is contained in:
parent
b25537f6b0
commit
06e10f948d
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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];
|
||||
|
@ -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),
|
||||
}
|
||||
|
26
core/src/trezor/messages/DebugLinkLayout.py
Normal file
26
core/src/trezor/messages/DebugLinkLayout.py
Normal file
@ -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),
|
||||
}
|
@ -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),
|
||||
}
|
||||
|
@ -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]
|
||||
|
@ -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),
|
||||
}
|
||||
|
26
python/src/trezorlib/messages/DebugLinkLayout.py
Normal file
26
python/src/trezorlib/messages/DebugLinkLayout.py
Normal file
@ -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),
|
||||
}
|
@ -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),
|
||||
}
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user