Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trezor: add Trezor Safe 5 support #742

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion hwilib/devices/trezorlib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ class TrezorModel:
default_mapping=mapping.DEFAULT_MAPPING,
)

T3T1 = TrezorModel(
name="Safe 5",
internal_name="T3T1",
minimum_version=(2, 1, 0),
vendors=VENDORS,
usb_ids=((0x1209, 0x53C1), (0x1209, 0x53C0)),
default_mapping=mapping.DEFAULT_MAPPING,
)

T3B1 = TrezorModel(
name="Safe 3",
internal_name="T3B1",
minimum_version=(2, 1, 0),
vendors=VENDORS,
usb_ids=((0x1209, 0x53C1), (0x1209, 0x53C0)),
default_mapping=mapping.DEFAULT_MAPPING,
)

DISC1 = TrezorModel(
name="DISC1",
internal_name="D001",
Expand All @@ -72,15 +90,26 @@ class TrezorModel:
default_mapping=mapping.DEFAULT_MAPPING,
)

DISC2 = TrezorModel(
name="DISC2",
internal_name="D002",
minimum_version=(2, 1, 0),
vendors=VENDORS,
usb_ids=((0x1209, 0x53C1), (0x1209, 0x53C0)),
default_mapping=mapping.DEFAULT_MAPPING,
)

# ==== model based names ====

TREZOR_ONE = T1B1
TREZOR_T = T2T1
TREZOR_R = T2B1
TREZOR_SAFE3 = T2B1
TREZOR_SAFE5 = T3T1
TREZOR_DISC1 = DISC1
TREZOR_DISC2 = DISC2

TREZORS = {T1B1, T2T1, T2B1, DISC1}
TREZORS = {T1B1, T2T1, T2B1, T3T1, T3B1, DISC1, DISC2}


def by_name(name: Optional[str]) -> Optional[TrezorModel]:
Expand Down
2 changes: 2 additions & 0 deletions test/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ if [[ -n ${build_trezor_1} || -n ${build_trezor_t} ]]; then
poetry install
cd legacy
export EMULATOR=1 TREZOR_TRANSPORT_V1=1 DEBUG_LINK=1 HEADLESS=1
export CC=gcc-12
poetry run pip install protobuf==3.20.0
poetry run script/setup
poetry run script/cibuild
Expand All @@ -108,6 +109,7 @@ if [[ -n ${build_trezor_1} || -n ${build_trezor_t} ]]; then
# But there should be some caching that makes this faster
poetry install
cd core
export CC=gcc-12
poetry run make build_unix
# Delete any emulator.img file
find . -name "trezor.flash" -exec rm {} \;
Expand Down
Loading