trezorctl: add set_display_rotation command

pull/25/head
Tomas Susanka 5 years ago committed by matejcik
parent c4f144ae0a
commit 47a40fb290

@ -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…
Cancel
Save