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

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

This commit is contained in:
matejcik 2021-07-28 16:01:02 +02:00 committed by matejcik
parent 347d11e6ea
commit e7c40c9560
4 changed files with 32 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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