mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-01 18:30:56 +00:00
fixup! feat(python): allow trezorctl firmware
commands to work with unknown models
This commit is contained in:
parent
aa49d1abf8
commit
48638e1ac7
@ -92,19 +92,13 @@ def _print_firmware_model(hw_model: Union[bytes, fw_models.Model]) -> None:
|
|||||||
click.echo(f"{model_name} firmware image.")
|
click.echo(f"{model_name} firmware image.")
|
||||||
return
|
return
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
assert isinstance(hw_model, bytes)
|
assert isinstance(hw_model, bytes)
|
||||||
if hw_model.isascii():
|
if hw_model.isascii():
|
||||||
model_name = hw_model.decode("ascii")
|
model_name = hw_model.decode("ascii")
|
||||||
click.echo(f"Unrecognized hardware model: {model_name}")
|
click.echo(f"Unrecognized hardware model: {model_name}")
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
click.echo(f"Invalid model field: {hw_model.hex()}")
|
|
||||||
|
|
||||||
assert isinstance(hw_model, bytes)
|
|
||||||
if all(0x20 <= b < 0x80 for b in hw_model): # isascii
|
|
||||||
model_name = hw_model.decode("ascii")
|
|
||||||
click.echo(f"Unknown hardware model: {model_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
click.echo(f"Suspicious hardware model code: {hw_model.hex()} ({hw_model!r})")
|
click.echo(f"Suspicious hardware model code: {hw_model.hex()} ({hw_model!r})")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user