mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 13:38:12 +00:00
30 lines
824 B
Python
30 lines
824 B
Python
from .device import Device
|
|
|
|
|
|
class TrezorT(Device):
|
|
def update_firmware(self, file=None):
|
|
# reset to enter bootloader again
|
|
self.power_off()
|
|
self.power_on()
|
|
|
|
self.run_trezorctl("list")
|
|
|
|
if not file:
|
|
raise ValueError(
|
|
"Uploading production firmware will replace the bootloader, it is not allowed!"
|
|
)
|
|
|
|
self.wait(5)
|
|
self.run_trezorctl("device wipe --bootloader || true")
|
|
self.wait(5)
|
|
self.power_off()
|
|
self.power_on()
|
|
|
|
self.wait(5)
|
|
self.log("[software] Updating the firmware to {}".format(file))
|
|
self.run_trezorctl("firmware-update -s -f {}".format(file))
|
|
|
|
# after firmware-update finishes wait for reboot
|
|
self.wait(15)
|
|
return self.check_model("Trezor T")
|