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

trezorctl: add set_display_rotation command

This commit is contained in:
Tomas Susanka 2019-04-02 09:44:31 +02:00 committed by matejcik
parent c4f144ae0a
commit 47a40fb290
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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