1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-17 20:08:12 +00:00
trezor-firmware/ci/hardware_tests/bootstrap.py

34 lines
744 B
Python
Raw Normal View History

2021-01-13 23:39:19 +00:00
import os
import sys
from device.t1 import TrezorOne
2020-09-03 09:11:21 +00:00
from device.tt import TrezorT
2020-09-03 09:11:21 +00:00
def main(model: str, file: str = None):
t1 = TrezorOne(
2021-01-13 23:39:19 +00:00
os.environ["T1_UHUB_LOCATION"],
os.environ["T1_ARDUINO_SERIAL"],
os.environ["T1_UHUB_PORT"],
)
2021-01-13 23:39:19 +00:00
tt = TrezorT(os.environ["TT_UHUB_LOCATION"], os.environ["TT_UHUB_PORT"])
2020-09-03 09:11:21 +00:00
if model == "t1":
tt.power_off()
path = t1.update_firmware(file)
2020-09-03 09:11:21 +00:00
elif model == "tt":
t1.power_off()
path = tt.update_firmware(file)
2020-09-03 09:11:21 +00:00
else:
raise ValueError("Unknown Trezor model.")
print(path)
if __name__ == "__main__":
2020-09-03 09:11:21 +00:00
model = sys.argv[1]
if len(sys.argv) == 3:
main(model, file=sys.argv[2])
else:
main(model)