1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00
trezor-firmware/ci/hardware_tests/bootstrap.py

40 lines
1.0 KiB
Python
Raw Normal View History

2021-01-13 23:39:19 +00:00
import os
import sys
from device.core import TrezorCore
from device.legacy import TrezorOne
# https://www.uugear.com/product/mega4-4-port-usb-3-ppps-hub-for-raspberry-pi-4b/
# as long as every runner has this hub we don't have to configure a per-runner hub location
HUB_VENDOR = "2109:2817"
2020-09-03 09:11:21 +00:00
def main(model: str, file: str = None):
t1 = TrezorOne(
os.getenv("T1_UHUB_LOCATION"),
os.getenv("T1_ARDUINO_SERIAL"),
os.getenv("T1_UHUB_PORT"),
)
tt = TrezorCore(hub_vendor=HUB_VENDOR, device_port=os.getenv("TT_UHUB_PORT"))
2020-09-03 09:11:21 +00:00
if model == "T1B1":
# tt.power_off()
path = t1.update_firmware(file)
elif model == "T2T1":
# t1.power_off()
path = tt.update_firmware(file, "Trezor T")
elif model == "T2B1":
path = tt.update_firmware(file, "Safe 3")
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)