mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
feat(python/trezorctl): trezorctl device reboot-to-bootloader
This commit is contained in:
parent
347d11e6ea
commit
e7c40c9560
1
python/.changelog.d/1738.added
Normal file
1
python/.changelog.d/1738.added
Normal file
@ -0,0 +1 @@
|
||||
trezorctl: new command `device reboot-to-bootloader` reboots T1 to bootloader
|
@ -207,6 +207,7 @@ Device management commands - setup, recover seed, wipe, etc.
|
||||
Commands:
|
||||
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.
|
||||
|
@ -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…
Reference in New Issue
Block a user