1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-19 12:58:13 +00:00
trezor-firmware/ci/hardware_tests/device/tt.py

30 lines
837 B
Python
Raw Normal View History

2020-09-03 09:11:21 +00:00
from .device import Device
class TrezorT(Device):
def update_firmware(self, file=None):
if not file:
raise ValueError(
"Uploading production firmware will replace the bootloader, it is not allowed!"
)
2021-02-15 12:23:23 +00:00
# reset to enter bootloader again
self.power_off()
self.power_on()
2021-01-23 22:03:56 +00:00
self.wait(5)
2021-02-15 12:23:23 +00:00
self.check_model("Trezor T bootloader")
2021-01-23 22:03:56 +00:00
self.run_trezorctl("device wipe --bootloader || true")
self.wait(5)
self.power_off()
self.power_on()
2020-09-03 09:11:21 +00:00
self.wait(5)
self.log("[software] Updating the firmware to {}".format(file))
2020-12-04 16:16:57 +00:00
self.run_trezorctl("firmware-update -s -f {}".format(file))
2020-09-03 09:11:21 +00:00
2020-12-04 16:16:57 +00:00
# after firmware-update finishes wait for reboot
self.wait(15)
return self.check_model("Trezor T")