mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 15:28:10 +00:00
1ff789101b
[skip_ci]
40 lines
1.0 KiB
Python
Executable File
40 lines
1.0 KiB
Python
Executable File
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"
|
|
|
|
|
|
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"))
|
|
|
|
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")
|
|
else:
|
|
raise ValueError("Unknown Trezor model.")
|
|
|
|
print(path)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
model = sys.argv[1]
|
|
if len(sys.argv) == 3:
|
|
main(model, file=sys.argv[2])
|
|
else:
|
|
main(model)
|