From c637c2f58e799284f6019481fa0de30457bd6b60 Mon Sep 17 00:00:00 2001 From: grdddj Date: Tue, 29 Oct 2024 10:10:58 +0100 Subject: [PATCH] feat: support T3W1 emulator model --- docs/controller.md | 4 ++-- src/binaries.py | 4 +++- src/binaries/firmware/bin/download.sh | 6 ++++++ src/dashboard/js/index.js | 5 +++++ src/emulator.py | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/controller.md b/docs/controller.md index bd7bbf5..c7c1f68 100644 --- a/docs/controller.md +++ b/docs/controller.md @@ -26,7 +26,7 @@ - **emulator-start** - **action**: start the specified emulator (identified by model + version) (and if one already runs, kills it) - **arguments**: - - **model**: `str` (enum of new model names - `["T1B1", "T2T1", "T2B1", "T3T1"]`) - needs to be supplied + - **model**: `str` (enum of new model names - `["T1B1", "T2T1", "T2B1", "T3T1", "T3W1"]`) - needs to be supplied - **version**: `str` (1.9.4, 2.4.0., etc.) - default is the latest version from master/main branch (`-main`) - `-latest` can be used to get the latest released version of that model (by release tag, e.g. 2.9.0) - **wipe**: `bool` (default=False) whether to delete the emulator profile before starting it @@ -37,7 +37,7 @@ - **action**: downloads emulator from specified URL and runs it - **arguments**: - **url**: `str` from where to download the emulator - - **model**: `str` which emulator it is - `["T1B1", "T2T1", "T2B1", "T3T1"]` + - **model**: `str` which emulator it is - `["T1B1", "T2T1", "T2B1", "T3T1", "T3W1"]` - **wipe**: `bool` (default=False) whether to delete the emulator profile before starting it - **output_to_logfile**: `bool` (default=True) whether the debug output should go to a logfile - otherwise it goes to stdout - **save_screenshots**: `bool` (default=False) whether to save screenshots to enable calling **emulator-get-screenshot** diff --git a/src/binaries.py b/src/binaries.py index 62390f0..68a8639 100644 --- a/src/binaries.py +++ b/src/binaries.py @@ -13,12 +13,13 @@ USER_DOWNLOADED_DIR = FIRMWARE_BIN_DIR / "user_downloaded" USER_DOWNLOADED_DIR.mkdir(exist_ok=True) -Model = Literal["T1B1", "T2T1", "T2B1", "T3T1"] +Model = Literal["T1B1", "T2T1", "T2B1", "T3T1", "T3W1"] FIRMWARES: Dict[Model, Dict[str, str]] = { "T1B1": OrderedDict(), "T2T1": OrderedDict(), "T2B1": OrderedDict(), "T3T1": OrderedDict(), + "T3W1": OrderedDict(), } MODEL_IDENTIFIERS: Dict[Model, str] = { @@ -26,6 +27,7 @@ "T2T1": "trezor-emu-core-T2T1-v", "T2B1": "trezor-emu-core-T2B1-v", "T3T1": "trezor-emu-core-T3T1-v", + "T3W1": "trezor-emu-core-T3W1-v", } BRIDGES: List[str] = [] diff --git a/src/binaries/firmware/bin/download.sh b/src/binaries/firmware/bin/download.sh index f08f1ab..96a02c7 100755 --- a/src/binaries/firmware/bin/download.sh +++ b/src/binaries/firmware/bin/download.sh @@ -84,6 +84,9 @@ if [[ $SYSTEM_ARCH == x86_64* ]]; then wget https://data.trezor.io/dev/firmware/emu-nightly/trezor-emu-core-T3T1-universal mv trezor-emu-core-T3T1-universal ../trezor-emu-core-T3T1-v2-main + wget https://data.trezor.io/dev/firmware/emu-nightly/trezor-emu-core-T3W1-universal + mv trezor-emu-core-T3W1-universal ../trezor-emu-core-T3W1-v2-main + elif [[ $SYSTEM_ARCH == aarch64* ]]; then wget https://data.trezor.io/dev/firmware/emu-nightly/trezor-emu-arm-legacy-T1B1-universal @@ -97,6 +100,9 @@ elif [[ $SYSTEM_ARCH == aarch64* ]]; then wget https://data.trezor.io/dev/firmware/emu-nightly/trezor-emu-arm-core-T3T1-universal mv trezor-emu-arm-core-T3T1-universal ../trezor-emu-core-T3T1-v2-main-arm + + wget https://data.trezor.io/dev/firmware/emu-nightly/trezor-emu-arm-core-T3W1-universal + mv trezor-emu-arm-core-T3W1-universal ../trezor-emu-core-T3W1-v2-main-arm fi cd "$BIN_DIR" diff --git a/src/dashboard/js/index.js b/src/dashboard/js/index.js index 302e104..8383e3b 100644 --- a/src/dashboard/js/index.js +++ b/src/dashboard/js/index.js @@ -36,6 +36,11 @@ const app = createApp({ versions: [], selected: "", }, + T3W1: { + header: "T3W1", + versions: [], + selected: "", + }, }, wipeDevice: false, screenshotMode: false, diff --git a/src/emulator.py b/src/emulator.py index 9949d89..f29dd96 100644 --- a/src/emulator.py +++ b/src/emulator.py @@ -212,7 +212,7 @@ def version_model() -> str: emu_location = Path(binaries.get_firmware_location(model, version)) - if model in ("T2T1", "T2B1", "T3T1"): + if model in ("T2T1", "T2B1", "T3T1", "T3W1"): EMULATOR = CoreEmulator( emu_location, profile_dir=binaries.FIRMWARE_BIN_DIR,