1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

feat(common): add auto_lock_delay and display_rotation to Features

This commit is contained in:
Martin Milata 2020-10-01 23:21:45 +02:00 committed by Tomas Susanka
parent 225966ea7c
commit b2c4bbdaa2
3 changed files with 14 additions and 0 deletions

View File

@ -100,6 +100,8 @@ message Features {
optional bytes session_id = 35;
optional bool passphrase_always_on_device = 36; // device enforces passphrase entry on Trezor
optional SafetyCheckLevel safety_checks = 37; // safety check level, set to Prompt to limit path namespace enforcement
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
}
/**

View File

@ -54,6 +54,8 @@ class Features(p.MessageType):
session_id: bytes = None,
passphrase_always_on_device: bool = None,
safety_checks: EnumTypeSafetyCheckLevel = None,
auto_lock_delay_ms: int = None,
display_rotation: int = None,
) -> None:
self.capabilities = capabilities if capabilities is not None else []
self.vendor = vendor
@ -90,6 +92,8 @@ class Features(p.MessageType):
self.session_id = session_id
self.passphrase_always_on_device = passphrase_always_on_device
self.safety_checks = safety_checks
self.auto_lock_delay_ms = auto_lock_delay_ms
self.display_rotation = display_rotation
@classmethod
def get_fields(cls) -> Dict:
@ -129,4 +133,6 @@ class Features(p.MessageType):
35: ('session_id', p.BytesType, None),
36: ('passphrase_always_on_device', p.BoolType, None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
38: ('auto_lock_delay_ms', p.UVarintType, None),
39: ('display_rotation', p.UVarintType, None),
}

View File

@ -54,6 +54,8 @@ class Features(p.MessageType):
session_id: bytes = None,
passphrase_always_on_device: bool = None,
safety_checks: EnumTypeSafetyCheckLevel = None,
auto_lock_delay_ms: int = None,
display_rotation: int = None,
) -> None:
self.capabilities = capabilities if capabilities is not None else []
self.vendor = vendor
@ -90,6 +92,8 @@ class Features(p.MessageType):
self.session_id = session_id
self.passphrase_always_on_device = passphrase_always_on_device
self.safety_checks = safety_checks
self.auto_lock_delay_ms = auto_lock_delay_ms
self.display_rotation = display_rotation
@classmethod
def get_fields(cls) -> Dict:
@ -129,4 +133,6 @@ class Features(p.MessageType):
35: ('session_id', p.BytesType, None),
36: ('passphrase_always_on_device', p.BoolType, None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
38: ('auto_lock_delay_ms', p.UVarintType, None),
39: ('display_rotation', p.UVarintType, None),
}