feat(python/trezorctl): trezorctl device reboot-to-bootloader

pull/1740/head
matejcik 3 years ago committed by matejcik
parent 347d11e6ea
commit e7c40c9560

@ -0,0 +1 @@
trezorctl: new command `device reboot-to-bootloader` reboots T1 to bootloader

@ -205,13 +205,14 @@ Device management commands - setup, recover seed, wipe, etc.
--help Show this message and exit.
Commands:
backup Perform device seed backup.
load Upload seed and custom configuration to the device.
recover Start safe recovery workflow.
sd-protect Secure the device with SD card protection.
self-test Perform a self-test.
setup Perform device setup and generate new seed.
wipe Reset device to factory defaults and remove all private data.
backup Perform device seed backup.
load Upload seed and custom configuration to the device.
reboot-to-bootloader Reboot device into bootloader mode.
recover Start safe recovery workflow.
sd-protect Secure the device with SD card protection.
self-test Perform a self-test.
setup Perform device setup and generate new seed.
wipe Reset device to factory defaults and remove all private data.
EOS commands.
~~~~~~~~~~~~~

@ -258,3 +258,20 @@ def sd_protect(client, operation):
if client.features.model == "1":
raise click.BadUsage("Trezor One does not support SD card protection.")
return device.sd_protect(client, operation)
@cli.command()
@click.pass_obj
def reboot_to_bootloader(obj):
"""Reboot device into bootloader mode.
Currently only supported on Trezor Model One.
"""
# avoid using @with_client because it closes the session afterwards,
# which triggers double prompt on device
with obj.client_context() as client:
if client.features.model != "1":
click.echo(
f"Warning: Rebooting into bootloader not supported on Trezor {client.features.model}"
)
return device.reboot_to_bootloader(client)

@ -209,3 +209,9 @@ def backup(client):
@expect(messages.Success, field="message")
def cancel_authorization(client):
return client.call(messages.CancelAuthorization())
@session
@expect(messages.Success, field="message")
def reboot_to_bootloader(client):
return client.call(messages.RebootToBootloader())

Loading…
Cancel
Save