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

fix(python/trezorctl): improve docs and behavior around unexpected messages

closes #2254
This commit is contained in:
matejcik 2022-06-21 15:40:31 +02:00
parent 8c3d3c6548
commit c12e4edd70

View File

@ -53,7 +53,10 @@ def cli() -> None:
@cli.command() @cli.command()
@with_client @with_client
def self_test(client: "TrezorClient") -> str: def self_test(client: "TrezorClient") -> str:
"""Perform a self-test.""" """Perform a factory self-test.
Only available on PRODTEST firmware.
"""
return debuglink.self_test(client) return debuglink.self_test(client)
@ -126,17 +129,25 @@ def load(
if not label: if not label:
label = "SLIP-0014" label = "SLIP-0014"
return debuglink.load_device( try:
client, return debuglink.load_device(
mnemonic=list(mnemonic), client,
pin=pin, mnemonic=list(mnemonic),
passphrase_protection=passphrase_protection, pin=pin,
label=label, passphrase_protection=passphrase_protection,
language="en-US", label=label,
skip_checksum=ignore_checksum, language="en-US",
needs_backup=needs_backup, skip_checksum=ignore_checksum,
no_backup=no_backup, needs_backup=needs_backup,
) no_backup=no_backup,
)
except exceptions.TrezorFailure as e:
if e.code == messages.FailureType.UnexpectedMessage:
raise click.ClickException(
"Unrecognized message. Make sure your Trezor is using debug firmware."
)
else:
raise
@cli.command() @cli.command()