1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 21:48:13 +00:00
trezor-firmware/ci/hardware_tests/device/tt.py
Martin Milata 41bf9201b5 ci: do not rely on TREZOR_PATH, use switch ports instead
As the connected Trezors can be left in various weird states, trezorctl
list may not always return what is expected or even fail. If it failed
TREZOR_PATH was set to empty string which means random device got
selected.

For now let's avoid using incorrect device by powering down the other
usb port.

Fix log lines ordering.
2021-02-05 12:58:21 +01:00

24 lines
669 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.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")