1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

feat(all): change debugging messages in protobuf

This commit is contained in:
grdddj 2023-05-04 14:25:43 +02:00 committed by Martin Milata
parent bd6783b1a3
commit 590315bdc1
8 changed files with 38 additions and 15 deletions

View File

@ -46,11 +46,11 @@ message DebugLinkDecision {
}
/**
* Response: Device text layout
* Response: Device text layout as a list of tokens as returned by Rust
* @end
*/
message DebugLinkLayout {
repeated string lines = 1;
repeated string tokens = 1;
}
/**
@ -100,7 +100,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 management.BackupType mnemonic_type = 12; // current mnemonic type (BIP-39/SLIP-39)
repeated string layout_lines = 13; // current layout text
repeated string tokens = 13; // current layout represented as a list of string tokens
}
/**
@ -184,3 +184,12 @@ message DebugLinkWatchLayout {
optional bool watch = 1; // if true, start watching layout.
// if false, stop.
}
/**
* Request: Remove all the previous debug event state
* @start
* @next Success
*/
message DebugLinkResetDebugEvents {
}

View File

@ -181,6 +181,7 @@ enum MessageType {
MessageType_DebugLinkRecordScreen = 9003 [(bitcoin_only) = true, (wire_debug_in) = true];
MessageType_DebugLinkEraseSdCard = 9005 [(bitcoin_only) = true, (wire_debug_in) = true];
MessageType_DebugLinkWatchLayout = 9006 [(bitcoin_only) = true, (wire_debug_in) = true];
MessageType_DebugLinkResetDebugEvents = 9007 [(bitcoin_only) = true, (wire_debug_in) = true];
// Ethereum
MessageType_EthereumGetPublicKey = 450 [(wire_in) = true];

View File

@ -89,6 +89,7 @@ DebugLinkReseedRandom = 9002
DebugLinkRecordScreen = 9003
DebugLinkEraseSdCard = 9005
DebugLinkWatchLayout = 9006
DebugLinkResetDebugEvents = 9007
if not utils.BITCOIN_ONLY:
SetU2FCounter = 63
GetNextU2FCounter = 80

View File

@ -112,6 +112,7 @@ if TYPE_CHECKING:
DebugLinkRecordScreen = 9003
DebugLinkEraseSdCard = 9005
DebugLinkWatchLayout = 9006
DebugLinkResetDebugEvents = 9007
EthereumGetPublicKey = 450
EthereumPublicKey = 451
EthereumGetAddress = 56

View File

@ -2638,12 +2638,12 @@ if TYPE_CHECKING:
return isinstance(msg, cls)
class DebugLinkLayout(protobuf.MessageType):
lines: "list[str]"
tokens: "list[str]"
def __init__(
self,
*,
lines: "list[str] | None" = None,
tokens: "list[str] | None" = None,
) -> None:
pass
@ -2712,12 +2712,12 @@ if TYPE_CHECKING:
recovery_word_pos: "int | None"
reset_word_pos: "int | None"
mnemonic_type: "BackupType | None"
layout_lines: "list[str]"
tokens: "list[str]"
def __init__(
self,
*,
layout_lines: "list[str] | None" = None,
tokens: "list[str] | None" = None,
layout: "bytes | None" = None,
pin: "str | None" = None,
matrix: "str | None" = None,
@ -2851,6 +2851,12 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkWatchLayout"]:
return isinstance(msg, cls)
class DebugLinkResetDebugEvents(protobuf.MessageType):
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkResetDebugEvents"]:
return isinstance(msg, cls)
class EosGetPublicKey(protobuf.MessageType):
address_n: "list[int]"
show_display: "bool | None"

View File

@ -4,7 +4,7 @@ endif
SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \
DebugLinkRecordScreen DebugLinkEraseSdCard DebugLinkWatchLayout \
DebugLinkLayout GetNonce \
DebugLinkLayout DebugLinkResetDebugEvents GetNonce \
TxAckInput TxAckOutput TxAckPrev TxAckPaymentRequest \
EthereumSignTypedData EthereumTypedDataStructRequest EthereumTypedDataStructAck \
EthereumTypedDataValueRequest EthereumTypedDataValueAck

View File

@ -9,7 +9,7 @@ DebugLinkState.mnemonic_secret max_size:240
DebugLinkState.reset_word max_size:12
DebugLinkState.reset_entropy max_size:128
DebugLinkState.recovery_fake_word max_size:12
DebugLinkState.layout_lines type:FT_IGNORE
DebugLinkState.tokens type:FT_IGNORE
DebugLinkLog.bucket max_size:33
DebugLinkLog.text max_size:256

View File

@ -120,6 +120,7 @@ class MessageType(IntEnum):
DebugLinkRecordScreen = 9003
DebugLinkEraseSdCard = 9005
DebugLinkWatchLayout = 9006
DebugLinkResetDebugEvents = 9007
EthereumGetPublicKey = 450
EthereumPublicKey = 451
EthereumGetAddress = 56
@ -3744,15 +3745,15 @@ class DebugLinkDecision(protobuf.MessageType):
class DebugLinkLayout(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9001
FIELDS = {
1: protobuf.Field("lines", "string", repeated=True, required=False, default=None),
1: protobuf.Field("tokens", "string", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
lines: Optional[Sequence["str"]] = None,
tokens: Optional[Sequence["str"]] = None,
) -> None:
self.lines: Sequence["str"] = lines if lines is not None else []
self.tokens: Sequence["str"] = tokens if tokens is not None else []
class DebugLinkReseedRandom(protobuf.MessageType):
@ -3821,13 +3822,13 @@ class DebugLinkState(protobuf.MessageType):
10: protobuf.Field("recovery_word_pos", "uint32", repeated=False, required=False, default=None),
11: protobuf.Field("reset_word_pos", "uint32", repeated=False, required=False, default=None),
12: protobuf.Field("mnemonic_type", "BackupType", repeated=False, required=False, default=None),
13: protobuf.Field("layout_lines", "string", repeated=True, required=False, default=None),
13: protobuf.Field("tokens", "string", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
layout_lines: Optional[Sequence["str"]] = None,
tokens: Optional[Sequence["str"]] = None,
layout: Optional["bytes"] = None,
pin: Optional["str"] = None,
matrix: Optional["str"] = None,
@ -3841,7 +3842,7 @@ class DebugLinkState(protobuf.MessageType):
reset_word_pos: Optional["int"] = None,
mnemonic_type: Optional["BackupType"] = None,
) -> None:
self.layout_lines: Sequence["str"] = layout_lines if layout_lines is not None else []
self.tokens: Sequence["str"] = tokens if tokens is not None else []
self.layout = layout
self.pin = pin
self.matrix = matrix
@ -3973,6 +3974,10 @@ class DebugLinkWatchLayout(protobuf.MessageType):
self.watch = watch
class DebugLinkResetDebugEvents(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9007
class EosGetPublicKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 600
FIELDS = {