mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 11:39:03 +00:00
trezorctl: add set_display_rotation command
This commit is contained in:
parent
c4f144ae0a
commit
47a40fb290
17
trezorctl
17
trezorctl
@ -85,6 +85,11 @@ CHOICE_PASSPHRASE_SOURCE_TYPE = ChoiceType(
|
||||
)
|
||||
|
||||
|
||||
CHOICE_DISPLAY_ROTATION_TYPE = ChoiceType(
|
||||
{"north": 0, "east": 90, "south": 180, "west": 270}
|
||||
)
|
||||
|
||||
|
||||
CHOICE_RECOVERY_DEVICE_TYPE = ChoiceType(
|
||||
{
|
||||
"scrambled": proto.RecoveryDeviceType.ScrambledWords,
|
||||
@ -287,6 +292,18 @@ def set_passphrase_source(connect, source):
|
||||
return device.apply_settings(connect(), passphrase_source=source)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("rotation", type=CHOICE_DISPLAY_ROTATION_TYPE)
|
||||
@click.pass_obj
|
||||
def set_display_rotation(connect, rotation):
|
||||
"""Set display rotation.
|
||||
|
||||
Configure display rotation for Trezor Model T. The options are
|
||||
north, east, south or west. Defaults to north.
|
||||
"""
|
||||
return device.apply_settings(connect(), display_rotation=rotation)
|
||||
|
||||
|
||||
@cli.command(help="Set auto-lock delay (in seconds).")
|
||||
@click.argument("delay", type=str)
|
||||
@click.pass_obj
|
||||
|
@ -53,6 +53,7 @@ def apply_settings(
|
||||
homescreen=None,
|
||||
passphrase_source=None,
|
||||
auto_lock_delay_ms=None,
|
||||
display_rotation=None,
|
||||
):
|
||||
settings = proto.ApplySettings()
|
||||
if label is not None:
|
||||
@ -67,6 +68,8 @@ def apply_settings(
|
||||
settings.passphrase_source = passphrase_source
|
||||
if auto_lock_delay_ms is not None:
|
||||
settings.auto_lock_delay_ms = auto_lock_delay_ms
|
||||
if display_rotation is not None:
|
||||
settings.display_rotation = display_rotation
|
||||
|
||||
out = client.call(settings)
|
||||
client.init_device() # Reload Features
|
||||
|
Loading…
Reference in New Issue
Block a user