1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

feat(common): Add SetBusy message.

[no changelog]
This commit is contained in:
Andrew Kozlik 2022-08-09 10:11:30 +02:00 committed by Andrew Kozlik
parent c962d3520b
commit 792dadfc4d
7 changed files with 48 additions and 1 deletions

View File

@ -111,6 +111,7 @@ message Features {
optional uint32 auto_lock_delay_ms = 38; // number of milliseconds after which the device locks itself optional uint32 auto_lock_delay_ms = 38; // number of milliseconds after which the device locks itself
optional uint32 display_rotation = 39; // in degrees from North optional uint32 display_rotation = 39; // in degrees from North
optional bool experimental_features = 40; // are experimental message types enabled? optional bool experimental_features = 40; // are experimental message types enabled?
optional bool busy = 41; // is the device busy, showing "Do not disconnect"?
} }
/** /**
@ -121,6 +122,15 @@ message Features {
message LockDevice { message LockDevice {
} }
/**
* Request: Show a "Do not disconnect" dialog instead of the standard homescreen.
* @start
* @next Success
*/
message SetBusy {
optional uint32 expiry_ms = 1; // The time in milliseconds after which the dialog will automatically disappear. Overrides any previously set expiry. If not set, then the dialog is hidden.
}
/** /**
* Request: end the current sesson. Following actions must call Initialize again. * Request: end the current sesson. Following actions must call Initialize again.
* Cache for the current session is discarded, other sessions remain intact. * Cache for the current session is discarded, other sessions remain intact.

View File

@ -87,6 +87,7 @@ enum MessageType {
MessageType_Entropy = 10 [(bitcoin_only) = true, (wire_out) = true]; MessageType_Entropy = 10 [(bitcoin_only) = true, (wire_out) = true];
MessageType_LoadDevice = 13 [(bitcoin_only) = true, (wire_in) = true]; MessageType_LoadDevice = 13 [(bitcoin_only) = true, (wire_in) = true];
MessageType_ResetDevice = 14 [(bitcoin_only) = true, (wire_in) = true]; MessageType_ResetDevice = 14 [(bitcoin_only) = true, (wire_in) = true];
MessageType_SetBusy = 16 [(bitcoin_only) = true, (wire_in) = true];
MessageType_Features = 17 [(bitcoin_only) = true, (wire_out) = true]; MessageType_Features = 17 [(bitcoin_only) = true, (wire_out) = true];
MessageType_PinMatrixRequest = 18 [(bitcoin_only) = true, (wire_out) = true]; MessageType_PinMatrixRequest = 18 [(bitcoin_only) = true, (wire_out) = true];
MessageType_PinMatrixAck = 19 [(bitcoin_only) = true, (wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true]; MessageType_PinMatrixAck = 19 [(bitcoin_only) = true, (wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];

View File

@ -14,6 +14,7 @@ GetEntropy = 9
Entropy = 10 Entropy = 10
LoadDevice = 13 LoadDevice = 13
ResetDevice = 14 ResetDevice = 14
SetBusy = 16
Features = 17 Features = 17
PinMatrixRequest = 18 PinMatrixRequest = 18
PinMatrixAck = 19 PinMatrixAck = 19

View File

@ -31,6 +31,7 @@ if TYPE_CHECKING:
Entropy = 10 Entropy = 10
LoadDevice = 13 LoadDevice = 13
ResetDevice = 14 ResetDevice = 14
SetBusy = 16
Features = 17 Features = 17
PinMatrixRequest = 18 PinMatrixRequest = 18
PinMatrixAck = 19 PinMatrixAck = 19

View File

@ -2050,6 +2050,7 @@ if TYPE_CHECKING:
auto_lock_delay_ms: "int | None" auto_lock_delay_ms: "int | None"
display_rotation: "int | None" display_rotation: "int | None"
experimental_features: "bool | None" experimental_features: "bool | None"
busy: "bool | None"
def __init__( def __init__(
self, self,
@ -2091,6 +2092,7 @@ if TYPE_CHECKING:
auto_lock_delay_ms: "int | None" = None, auto_lock_delay_ms: "int | None" = None,
display_rotation: "int | None" = None, display_rotation: "int | None" = None,
experimental_features: "bool | None" = None, experimental_features: "bool | None" = None,
busy: "bool | None" = None,
) -> None: ) -> None:
pass pass
@ -2104,6 +2106,20 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["LockDevice"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["LockDevice"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class SetBusy(protobuf.MessageType):
expiry_ms: "int | None"
def __init__(
self,
*,
expiry_ms: "int | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["SetBusy"]:
return isinstance(msg, cls)
class EndSession(protobuf.MessageType): class EndSession(protobuf.MessageType):
@classmethod @classmethod

View File

@ -5,7 +5,7 @@ endif
SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \ SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \
DebugLinkRecordScreen DebugLinkEraseSdCard DebugLinkWatchLayout \ DebugLinkRecordScreen DebugLinkEraseSdCard DebugLinkWatchLayout \
GetOwnershipProof OwnershipProof GetOwnershipId OwnershipId AuthorizeCoinJoin DoPreauthorized \ GetOwnershipProof OwnershipProof GetOwnershipId OwnershipId AuthorizeCoinJoin DoPreauthorized \
CancelAuthorization DebugLinkLayout GetNonce \ CancelAuthorization DebugLinkLayout GetNonce SetBusy \
TxAckInput TxAckOutput TxAckPrev TxAckPaymentRequest \ TxAckInput TxAckOutput TxAckPrev TxAckPaymentRequest \
EthereumSignTypedData EthereumTypedDataStructRequest EthereumTypedDataStructAck \ EthereumSignTypedData EthereumTypedDataStructRequest EthereumTypedDataStructAck \
EthereumTypedDataValueRequest EthereumTypedDataValueAck EthereumTypedDataValueRequest EthereumTypedDataValueAck

View File

@ -39,6 +39,7 @@ class MessageType(IntEnum):
Entropy = 10 Entropy = 10
LoadDevice = 13 LoadDevice = 13
ResetDevice = 14 ResetDevice = 14
SetBusy = 16
Features = 17 Features = 17
PinMatrixRequest = 18 PinMatrixRequest = 18
PinMatrixAck = 19 PinMatrixAck = 19
@ -3064,6 +3065,7 @@ class Features(protobuf.MessageType):
38: protobuf.Field("auto_lock_delay_ms", "uint32", repeated=False, required=False), 38: protobuf.Field("auto_lock_delay_ms", "uint32", repeated=False, required=False),
39: protobuf.Field("display_rotation", "uint32", repeated=False, required=False), 39: protobuf.Field("display_rotation", "uint32", repeated=False, required=False),
40: protobuf.Field("experimental_features", "bool", repeated=False, required=False), 40: protobuf.Field("experimental_features", "bool", repeated=False, required=False),
41: protobuf.Field("busy", "bool", repeated=False, required=False),
} }
def __init__( def __init__(
@ -3107,6 +3109,7 @@ class Features(protobuf.MessageType):
auto_lock_delay_ms: Optional["int"] = None, auto_lock_delay_ms: Optional["int"] = None,
display_rotation: Optional["int"] = None, display_rotation: Optional["int"] = None,
experimental_features: Optional["bool"] = None, experimental_features: Optional["bool"] = None,
busy: Optional["bool"] = None,
) -> None: ) -> None:
self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else [] self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else []
self.major_version = major_version self.major_version = major_version
@ -3146,12 +3149,27 @@ class Features(protobuf.MessageType):
self.auto_lock_delay_ms = auto_lock_delay_ms self.auto_lock_delay_ms = auto_lock_delay_ms
self.display_rotation = display_rotation self.display_rotation = display_rotation
self.experimental_features = experimental_features self.experimental_features = experimental_features
self.busy = busy
class LockDevice(protobuf.MessageType): class LockDevice(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 24 MESSAGE_WIRE_TYPE = 24
class SetBusy(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 16
FIELDS = {
1: protobuf.Field("expiry_ms", "uint32", repeated=False, required=False),
}
def __init__(
self,
*,
expiry_ms: Optional["int"] = None,
) -> None:
self.expiry_ms = expiry_ms
class EndSession(protobuf.MessageType): class EndSession(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 83 MESSAGE_WIRE_TYPE = 83