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/bootstrap.py

32 lines
746 B
Python
Raw Normal View History

import configparser
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):
config = configparser.ConfigParser()
config.read_file(open("hardware.cfg"))
t1 = TrezorOne(
2020-09-03 09:11:21 +00:00
config["t1"]["uhub_location"],
2020-09-25 11:59:16 +00:00
config["t1"]["arduino_serial"],
2020-09-03 09:11:21 +00:00
config["t1"]["port"],
)
2020-09-03 09:11:21 +00:00
tt = TrezorT(config["tt"]["uhub_location"], config["tt"]["port"])
if model == "t1":
t1.update_firmware(file)
elif model == "tt":
tt.update_firmware(file)
else:
raise ValueError("Unknown Trezor model.")
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)