Skip to content

Commit

Permalink
feat: support T3W1 emulator model
Browse files Browse the repository at this point in the history
  • Loading branch information
grdddj committed Nov 4, 2024
1 parent 8c90b74 commit c637c2f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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**
Expand Down
4 changes: 3 additions & 1 deletion src/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@
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] = {
"T1B1": "trezor-emu-legacy-T1B1-v",
"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] = []
Expand Down
6 changes: 6 additions & 0 deletions src/binaries/firmware/bin/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/dashboard/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const app = createApp({
versions: [],
selected: "",
},
T3W1: {
header: "T3W1",
versions: [],
selected: "",
},
},
wipeDevice: false,
screenshotMode: false,
Expand Down
2 changes: 1 addition & 1 deletion src/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c637c2f

Please sign in to comment.