diff --git a/trezorctl b/trezorctl index 873497e8b..a00972f36 100755 --- a/trezorctl +++ b/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 diff --git a/trezorlib/device.py b/trezorlib/device.py index a06db8455..f8bf5dafd 100644 --- a/trezorlib/device.py +++ b/trezorlib/device.py @@ -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