1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

feat(core): add internal model field to features

[no changelog]
This commit is contained in:
tychovrahe 2023-06-01 14:21:51 +02:00 committed by TychoVrahe
parent fee0d70211
commit a2f8cb9d1c
29 changed files with 130 additions and 67 deletions

View File

@ -123,6 +123,7 @@ message Features {
optional bool busy = 41; // is the device busy, showing "Do not disconnect"?
optional HomescreenFormat homescreen_format = 42; // format of the homescreen, 1 = TOIf 144x144, 2 = jpg 240x240
optional bool hide_passphrase_from_host = 43; // should we hide the passphrase when it comes from host?
optional string internal_model = 44; // internal model name
}
/**

View File

@ -142,6 +142,7 @@ env.Replace(
CPPPATH=[
'embed/boardloader',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython/stmhal',

View File

@ -204,6 +204,7 @@ env.Replace(
'embed/bootloader/nanopb',
'embed/bootloader/protob',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',

View File

@ -182,6 +182,7 @@ env.Replace(
'embed/bootloader_ci/nanopb',
'embed/bootloader_ci/protob',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',

View File

@ -156,6 +156,7 @@ env.Replace(
'embed/bootloader/nanopb',
'embed/bootloader/protob',
'embed/lib',
'embed/models',
'embed/unix',
'embed/extmod/modtrezorui',
'vendor/nanopb',

View File

@ -474,6 +474,7 @@ env.Replace(
'embed/rust',
'embed/firmware',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython',

View File

@ -151,6 +151,7 @@ env.Replace(
CPPPATH=[
'embed/prodtest',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',

View File

@ -142,6 +142,7 @@ env.Replace(
CPPPATH=[
'embed/reflash',
'embed/lib',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',

View File

@ -443,6 +443,7 @@ env.Replace(
'.',
'embed/rust',
'embed/lib',
'embed/models',
'embed/unix',
'embed/extmod/modtrezorui',
'vendor/micropython',

View File

@ -31,6 +31,7 @@
#endif
#include "lowlevel.h"
#include "model.h"
#include "version.h"
#include "memzero.h"
@ -42,32 +43,24 @@ static const uint8_t * const BOARDLOADER_KEYS[] = {
(const uint8_t *)"\xdb\x99\x5f\xe2\x51\x69\xd1\x41\xca\xb9\xbb\xba\x92\xba\xa0\x1f\x9f\x2e\x1e\xce\x7d\xf4\xcb\x2a\xc0\x51\x90\xf3\x7f\xcc\x1f\x9d",
(const uint8_t *)"\x21\x52\xf8\xd1\x9b\x79\x1d\x24\x45\x32\x42\xe1\x5f\x2e\xab\x6c\xb7\xcf\xfa\x7b\x6a\x5e\xd3\x00\x97\x96\x0e\x06\x98\x81\xdb\x12",
(const uint8_t *)"\x22\xfc\x29\x77\x92\xf0\xb6\xff\xc0\xbf\xcf\xdb\x7e\xdb\x0c\x0a\xa1\x4e\x02\x5a\x36\x5e\xc0\xe3\x42\xe8\x6e\x38\x29\xcb\x74\xb6",
#elif defined TREZOR_MODEL_T
(const uint8_t *)"\x0e\xb9\x85\x6b\xe9\xba\x7e\x97\x2c\x7f\x34\xea\xc1\xed\x9b\x6f\xd0\xef\xd1\x72\xec\x00\xfa\xf0\xc5\x89\x75\x9d\xa4\xdd\xfb\xa0",
(const uint8_t *)"\xac\x8a\xb4\x0b\x32\xc9\x86\x55\x79\x8f\xd5\xda\x5e\x19\x2b\xe2\x7a\x22\x30\x6e\xa0\x5c\x6d\x27\x7c\xdf\xf4\xa3\xf4\x12\x5c\xd8",
(const uint8_t *)"\xce\x0f\xcd\x12\x54\x3e\xf5\x93\x6c\xf2\x80\x49\x82\x13\x67\x07\x86\x3d\x17\x29\x5f\xac\xed\x72\xaf\x17\x1d\x6e\x65\x13\xff\x06",
#elif defined TREZOR_MODEL_R
(const uint8_t *)"\x54\x9a\x45\x55\x70\x08\xd5\x51\x8a\x9a\x15\x1d\xc6\xa3\x56\x8c\xf7\x38\x30\xa7\xfe\x41\x9f\x26\x26\xd9\xf3\x0d\x02\x4b\x2b\xec",
(const uint8_t *)"\xc1\x6c\x70\x27\xf8\xa3\x96\x26\x07\xbf\x24\xcd\xec\x2e\x3c\xd2\x34\x4e\x1f\x60\x71\xe8\x26\x0b\x3d\xda\x52\xb1\xa5\x10\x7c\xb7",
(const uint8_t *)"\x87\x18\x0f\x93\x31\x78\xb2\x83\x2b\xee\x2d\x70\x46\xc7\xf4\xb9\x83\x00\xca\x7d\x7f\xb2\xe4\x56\x71\x69\xc8\x73\x0a\x1c\x40\x20",
#else
#error "Unknown model for boardloader keys"
MODEL_BOARDLOADER_KEYS
#endif
};
struct BoardCapabilities capablities
__attribute__((section(".capabilities_section"))) = {
.header = CAPABILITIES_HEADER,
.model_tag = MODEL_NAME,
.model_tag = TAG_MODEL_NAME,
.model_length = sizeof(uint32_t),
.model_name = HW_MODEL,
.version_tag = BOARDLOADER_VERSION,
.version_tag = TAG_BOARDLOADER_VERSION,
.version_length = sizeof(struct BoardloaderVersion),
.version = {.version_major = VERSION_MAJOR,
.version_minor = VERSION_MINOR,
.version_patch = VERSION_PATCH,
.version_build = VERSION_BUILD},
.terminator_tag = TERMINATOR,
.terminator_tag = TAG_TERMINATOR,
.terminator_length = 0};
// we use SRAM as SD card read buffer (because DMA can't access the CCMRAM)

View File

@ -49,6 +49,7 @@
#ifdef USE_RGB_LED
#include "rgb_led.h"
#endif
#include "model.h"
#include "usb.h"
#include "version.h"
@ -64,19 +65,8 @@ static const uint8_t * const BOOTLOADER_KEYS[] = {
(const uint8_t *)"\xd7\x59\x79\x3b\xbc\x13\xa2\x81\x9a\x82\x7c\x76\xad\xb6\xfb\xa8\xa4\x9a\xee\x00\x7f\x49\xf2\xd0\x99\x2d\x99\xb8\x25\xad\x2c\x48",
(const uint8_t *)"\x63\x55\x69\x1c\x17\x8a\x8f\xf9\x10\x07\xa7\x47\x8a\xfb\x95\x5e\xf7\x35\x2c\x63\xe7\xb2\x57\x03\x98\x4c\xf7\x8b\x26\xe2\x1a\x56",
(const uint8_t *)"\xee\x93\xa4\xf6\x6f\x8d\x16\xb8\x19\xbb\x9b\xeb\x9f\xfc\xcd\xfc\xdc\x14\x12\xe8\x7f\xee\x6a\x32\x4c\x2a\x99\xa1\xe0\xe6\x71\x48",
#elif defined TREZOR_MODEL_T
/*** T2T1 (Model T) PRODUCTION KEYS ***/
(const uint8_t *)"\xc2\xc8\x7a\x49\xc5\xa3\x46\x09\x77\xfb\xb2\xec\x9d\xfe\x60\xf0\x6b\xd6\x94\xdb\x82\x44\xbd\x49\x81\xfe\x3b\x7a\x26\x30\x7f\x3f",
(const uint8_t *)"\x80\xd0\x36\xb0\x87\x39\xb8\x46\xf4\xcb\x77\x59\x30\x78\xde\xb2\x5d\xc9\x48\x7a\xed\xcf\x52\xe3\x0b\x4f\xb7\xcd\x70\x24\x17\x8a",
(const uint8_t *)"\xb8\x30\x7a\x71\xf5\x52\xc6\x0a\x4c\xbb\x31\x7f\xf4\x8b\x82\xcd\xbf\x6b\x6b\xb5\xf0\x4c\x92\x0f\xec\x7b\xad\xf0\x17\x88\x37\x51",
#elif defined TREZOR_MODEL_R
/*** T2B1 (Model R) PRODUCTION KEYS ***/
(const uint8_t *)"\xbf\x4e\x6f\x00\x4f\xcb\x32\xce\xc6\x83\xf2\x2c\x88\xc1\xa8\x6c\x15\x18\xc6\xde\x8a\xc9\x70\x02\xd8\x4a\x63\xbe\xa3\xe3\x75\xdd",
(const uint8_t *)"\xd2\xde\xf6\x91\xc1\xe9\xd8\x09\xd8\x19\x0c\xf7\xaf\x93\x5c\x10\x68\x8f\x68\x98\x34\x79\xb4\xee\x9a\xba\xc1\x91\x04\x87\x8e\xc1",
(const uint8_t *)"\x07\xc8\x51\x34\x94\x6b\xf8\x9f\xa1\x9b\xdc\x2c\x5e\x5f\xf9\xce\x01\x29\x65\x08\xee\x08\x63\xd0\xff\x6d\x63\x33\x1d\x1a\x25\x16",
#else
#error "No known keys for this model"
#error "TODO add some keys for things like discovery board"
MODEL_BOOTLOADER_KEYS
#endif
};

View File

@ -36,6 +36,7 @@
#include "rust_ui.h"
#include "memzero.h"
#include "model.h"
#ifdef TREZOR_EMULATOR
#include "emulator.h"
@ -293,7 +294,8 @@ static void send_msg_features(uint8_t iface_num,
MSG_SEND_ASSIGN_REQUIRED_VALUE(minor_version, VERSION_MINOR);
MSG_SEND_ASSIGN_REQUIRED_VALUE(patch_version, VERSION_PATCH);
MSG_SEND_ASSIGN_VALUE(bootloader_mode, true);
MSG_SEND_ASSIGN_STRING(model, "T");
MSG_SEND_ASSIGN_STRING(model, MODEL_NAME);
MSG_SEND_ASSIGN_STRING(internal_model, MODEL_INTERNAL_NAME);
if (vhdr && hdr) {
MSG_SEND_ASSIGN_VALUE(firmware_present, true);
MSG_SEND_ASSIGN_VALUE(fw_major, (hdr->version & 0xFF));

View File

@ -4,6 +4,7 @@ Features.language max_size:17
Features.label max_size:33
Features.revision max_size:20
Features.model max_size:17
Features.internal_model max_size:17
Features.fw_vendor max_size:256
Ping.message max_size:256

View File

@ -91,6 +91,8 @@ typedef struct _Features {
uint32_t fw_patch;
bool has_fw_vendor;
char fw_vendor[256];
bool has_internal_model;
char internal_model[17];
} Features;
typedef struct _FirmwareErase {
@ -142,7 +144,7 @@ extern "C" {
/* Initializer values for message structs */
#define Initialize_init_default {0}
#define GetFeatures_init_default {0}
#define Features_init_default {false, "", 0, 0, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, ""}
#define Features_init_default {false, "", 0, 0, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, ""}
#define Ping_init_default {false, ""}
#define Success_init_default {false, ""}
#define Failure_init_default {false, _FailureType_MIN, false, ""}
@ -153,7 +155,7 @@ extern "C" {
#define FirmwareUpload_init_default {{{NULL}, NULL}, false, {0, {0}}}
#define Initialize_init_zero {0}
#define GetFeatures_init_zero {0}
#define Features_init_zero {false, "", 0, 0, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, ""}
#define Features_init_zero {false, "", 0, 0, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, ""}
#define Ping_init_zero {false, ""}
#define Success_init_zero {false, ""}
#define Failure_init_zero {false, _FailureType_MIN, false, ""}
@ -183,6 +185,7 @@ extern "C" {
#define Features_fw_minor_tag 23
#define Features_fw_patch_tag 24
#define Features_fw_vendor_tag 25
#define Features_internal_model_tag 44
#define FirmwareErase_length_tag 1
#define FirmwareRequest_offset_tag 1
#define FirmwareRequest_length_tag 2
@ -218,7 +221,8 @@ X(a, STATIC, OPTIONAL, STRING, model, 21) \
X(a, STATIC, OPTIONAL, UINT32, fw_major, 22) \
X(a, STATIC, OPTIONAL, UINT32, fw_minor, 23) \
X(a, STATIC, OPTIONAL, UINT32, fw_patch, 24) \
X(a, STATIC, OPTIONAL, STRING, fw_vendor, 25)
X(a, STATIC, OPTIONAL, STRING, fw_vendor, 25) \
X(a, STATIC, OPTIONAL, STRING, internal_model, 44)
#define Features_CALLBACK NULL
#define Features_DEFAULT NULL
@ -295,7 +299,7 @@ extern const pb_msgdesc_t FirmwareUpload_msg;
#define ButtonAck_size 0
#define ButtonRequest_size 2
#define Failure_size 260
#define Features_size 458
#define Features_size 477
#define FirmwareErase_size 6
#define FirmwareRequest_size 12
#define GetFeatures_size 0

View File

@ -56,6 +56,7 @@ message Features {
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
// optional bytes fw_vendor_keys = 26; // obsoleted, use fw_vendor
optional string internal_model = 44; // internal model name
}
/**

View File

@ -36,6 +36,7 @@
#include "flash.h"
#include "usb.h"
#include TREZOR_BOARD
#include "model.h"
#ifndef TREZOR_EMULATOR
#include "image.h"
@ -232,6 +233,7 @@ STATIC mp_obj_str_t mod_trezorutils_revision_obj = {
/// VERSION_PATCH: int
/// USE_SD_CARD: bool
/// MODEL: str
/// INTERNAL_MODEL: str
/// EMULATOR: bool
/// BITCOIN_ONLY: bool
@ -257,15 +259,9 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
#else
{MP_ROM_QSTR(MP_QSTR_USE_SD_CARD), mp_const_false},
#endif
#if defined TREZOR_MODEL_1
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR_1)},
#elif defined TREZOR_MODEL_T
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR_T)},
#elif defined TREZOR_MODEL_R
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR_R)},
#else
#error Unknown Trezor model
#endif
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MODEL_NAME_QSTR)},
{MP_ROM_QSTR(MP_QSTR_INTERNAL_MODEL),
MP_ROM_QSTR(MODEL_INTERNAL_NAME_QSTR)},
#ifdef TREZOR_EMULATOR
{MP_ROM_QSTR(MP_QSTR_EMULATOR), mp_const_true},
MEMINFO_DICT_ENTRIES

View File

@ -24,6 +24,7 @@
#include "common.h"
#include "flash.h"
#include "image.h"
#include "model.h"
// symbols from bootloader.bin => bootloader.o
extern const void _binary_embed_firmware_bootloader_bin_start;
@ -78,28 +79,19 @@ static secbool known_bootloader(const uint8_t *hash, int len) {
#define BOOTLOADER_T2T1_FF {0xe0, 0xd5, 0x96, 0x9f, 0x30, 0xab, 0xfd, 0x8a, 0x7e, 0xb7, 0x63, 0xce, 0x03, 0x67, 0x4a, 0xb4, 0x3e, 0x39, 0x18, 0xab, 0x22, 0x9a, 0x3b, 0xac, 0x2a, 0x9e, 0xa7, 0xe4, 0xd3, 0x81, 0x76, 0x00}
// --- END GENERATED BOOTLOADER SECTION ---
#if defined TREZOR_MODEL_T
#if BOOTLOADER_QA
// QA bootloaders for T2T1
#define BOOTLOADER_00 BOOTLOADER_T2T1_QA_00
#define BOOTLOADER_FF BOOTLOADER_T2T1_QA_FF
#else
// normal bootloaders for T2T1
#define BOOTLOADER_00 BOOTLOADER_T2T1_00
#define BOOTLOADER_FF BOOTLOADER_T2T1_FF
#endif
#elif defined TREZOR_MODEL_R
#if BOOTLOADER_QA
// QA bootloaders for T2B1
#define BOOTLOADER_00 BOOTLOADER_T2B1_QA_00
#define BOOTLOADER_FF BOOTLOADER_T2B1_QA_FF
#else
// normal bootloaders for T2B1
#define BOOTLOADER_00 BOOTLOADER_T2B1_00
#define BOOTLOADER_FF BOOTLOADER_T2B1_FF
#endif
#define CONCAT_NAME_HELPER(prefix, name, suffix) prefix##name##suffix
#define CONCAT_NAME(name, var) CONCAT_NAME_HELPER(BOOTLOADER_, name, var)
#if BOOTLOADER_QA
// QA bootloaders
#define BOOTLOADER_00 CONCAT_NAME(MODEL_INTERNAL_NAME_TOKEN, _QA_00)
#define BOOTLOADER_FF CONCAT_NAME(MODEL_INTERNAL_NAME_TOKEN, _QA_FF)
#else
#error "Cannot select bootloader hashes for unknown model."
// normal bootloaders
#define BOOTLOADER_00 CONCAT_NAME(MODEL_INTERNAL_NAME_TOKEN, _00)
#define BOOTLOADER_FF CONCAT_NAME(MODEL_INTERNAL_NAME_TOKEN, _FF)
#endif
// clang-format on

14
core/embed/models/model.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef MODELS_MODEL_H_
#define MODELS_MODEL_H_
#if defined TREZOR_MODEL_1
#include "model_T1B1.h"
#elif defined TREZOR_MODEL_T
#include "model_T2T1.h"
#elif defined TREZOR_MODEL_R
#include "model_T2B1.h"
#else
#error Unknown Trezor model
#endif
#endif

View File

@ -0,0 +1,10 @@
#ifndef MODELS_MODEL_T1B1_H_
#define MODELS_MODEL_T1B1_H_
#define MODEL_NAME "1"
#define MODEL_INTERNAL_NAME "T1B1"
#define MODEL_INTERNAL_NAME_TOKEN T1B1
#define MODEL_NAME_QSTR MP_QSTR_1
#define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T1B1
#endif

View File

@ -0,0 +1,21 @@
#ifndef MODELS_MODEL_T2B1_H_
#define MODELS_MODEL_T2B1_H_
#define MODEL_NAME "R"
#define MODEL_INTERNAL_NAME "T2B1"
#define MODEL_INTERNAL_NAME_TOKEN T2B1
#define MODEL_NAME_QSTR MP_QSTR_R
#define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T2B1
/*** PRODUCTION KEYS ***/
#define MODEL_BOARDLOADER_KEYS \
(const uint8_t *)"\x54\x9a\x45\x55\x70\x08\xd5\x51\x8a\x9a\x15\x1d\xc6\xa3\x56\x8c\xf7\x38\x30\xa7\xfe\x41\x9f\x26\x26\xd9\xf3\x0d\x02\x4b\x2b\xec", \
(const uint8_t *)"\xc1\x6c\x70\x27\xf8\xa3\x96\x26\x07\xbf\x24\xcd\xec\x2e\x3c\xd2\x34\x4e\x1f\x60\x71\xe8\x26\x0b\x3d\xda\x52\xb1\xa5\x10\x7c\xb7", \
(const uint8_t *)"\x87\x18\x0f\x93\x31\x78\xb2\x83\x2b\xee\x2d\x70\x46\xc7\xf4\xb9\x83\x00\xca\x7d\x7f\xb2\xe4\x56\x71\x69\xc8\x73\x0a\x1c\x40\x20",
#define MODEL_BOOTLOADER_KEYS \
(const uint8_t *)"\xbf\x4e\x6f\x00\x4f\xcb\x32\xce\xc6\x83\xf2\x2c\x88\xc1\xa8\x6c\x15\x18\xc6\xde\x8a\xc9\x70\x02\xd8\x4a\x63\xbe\xa3\xe3\x75\xdd", \
(const uint8_t *)"\xd2\xde\xf6\x91\xc1\xe9\xd8\x09\xd8\x19\x0c\xf7\xaf\x93\x5c\x10\x68\x8f\x68\x98\x34\x79\xb4\xee\x9a\xba\xc1\x91\x04\x87\x8e\xc1", \
(const uint8_t *)"\x07\xc8\x51\x34\x94\x6b\xf8\x9f\xa1\x9b\xdc\x2c\x5e\x5f\xf9\xce\x01\x29\x65\x08\xee\x08\x63\xd0\xff\x6d\x63\x33\x1d\x1a\x25\x16",
#endif

View File

@ -0,0 +1,21 @@
#ifndef MODELS_MODEL_T2T1_H_
#define MODELS_MODEL_T2T1_H_
#define MODEL_NAME "T"
#define MODEL_INTERNAL_NAME "T2T1"
#define MODEL_INTERNAL_NAME_TOKEN T2T1
#define MODEL_NAME_QSTR MP_QSTR_T
#define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T2T1
/*** PRODUCTION KEYS ***/
#define MODEL_BOARDLOADER_KEYS \
(const uint8_t *)"\x0e\xb9\x85\x6b\xe9\xba\x7e\x97\x2c\x7f\x34\xea\xc1\xed\x9b\x6f\xd0\xef\xd1\x72\xec\x00\xfa\xf0\xc5\x89\x75\x9d\xa4\xdd\xfb\xa0", \
(const uint8_t *)"\xac\x8a\xb4\x0b\x32\xc9\x86\x55\x79\x8f\xd5\xda\x5e\x19\x2b\xe2\x7a\x22\x30\x6e\xa0\x5c\x6d\x27\x7c\xdf\xf4\xa3\xf4\x12\x5c\xd8", \
(const uint8_t *)"\xce\x0f\xcd\x12\x54\x3e\xf5\x93\x6c\xf2\x80\x49\x82\x13\x67\x07\x86\x3d\x17\x29\x5f\xac\xed\x72\xaf\x17\x1d\x6e\x65\x13\xff\x06",
#define MODEL_BOOTLOADER_KEYS \
(const uint8_t *)"\xc2\xc8\x7a\x49\xc5\xa3\x46\x09\x77\xfb\xb2\xec\x9d\xfe\x60\xf0\x6b\xd6\x94\xdb\x82\x44\xbd\x49\x81\xfe\x3b\x7a\x26\x30\x7f\x3f", \
(const uint8_t *)"\x80\xd0\x36\xb0\x87\x39\xb8\x46\xf4\xcb\x77\x59\x30\x78\xde\xb2\x5d\xc9\x48\x7a\xed\xcf\x52\xe3\x0b\x4f\xb7\xcd\x70\x24\x17\x8a", \
(const uint8_t *)"\xb8\x30\x7a\x71\xf5\x52\xc6\x0a\x4c\xbb\x31\x7f\xf4\x8b\x82\xcd\xbf\x6b\x6b\xb5\xf0\x4c\x92\x0f\xec\x7b\xad\xf0\x17\x88\x37\x51",
#endif

View File

@ -56,22 +56,22 @@ void parse_boardloader_capabilities() {
}
switch (tag) {
case CAPABILITY:
case TAG_CAPABILITY:
// not used yet, just advance pointer
break;
case MODEL_NAME:
case TAG_MODEL_NAME:
if (length != sizeof(uint32_t)) {
break;
}
memcpy((uint8_t *)&board_name, pos, sizeof(uint32_t));
break;
case BOARDLOADER_VERSION:
case TAG_BOARDLOADER_VERSION:
if (length != sizeof(boardloader_version)) {
break;
}
memcpy(&boardloader_version, pos, length);
break;
case TERMINATOR:
case TAG_TERMINATOR:
return;
default:
break;

View File

@ -40,10 +40,10 @@ Last tag must be terminator or all space used.
#define CAPABILITIES_HEADER "TRZC"
enum CapabilityTag {
TERMINATOR = 0x00,
CAPABILITY = 0x01,
MODEL_NAME = 0x02,
BOARDLOADER_VERSION = 0x03
TAG_TERMINATOR = 0x00,
TAG_CAPABILITY = 0x01,
TAG_MODEL_NAME = 0x02,
TAG_BOARDLOADER_VERSION = 0x03
};
struct __attribute__((packed)) BoardloaderVersion {

View File

@ -71,5 +71,6 @@ VERSION_MINOR: int
VERSION_PATCH: int
USE_SD_CARD: bool
MODEL: str
INTERNAL_MODEL: str
EMULATOR: bool
BITCOIN_ONLY: bool

View File

@ -56,6 +56,7 @@ def get_features() -> Features:
patch_version=utils.VERSION_PATCH,
revision=utils.SCM_REVISION,
model=utils.MODEL,
internal_model=utils.INTERNAL_MODEL,
device_id=storage_device.get_device_id(),
label=storage_device.get_label(),
pin_protection=config.has_pin(),

View File

@ -2109,6 +2109,7 @@ if TYPE_CHECKING:
busy: "bool | None"
homescreen_format: "HomescreenFormat | None"
hide_passphrase_from_host: "bool | None"
internal_model: "str | None"
def __init__(
self,
@ -2153,6 +2154,7 @@ if TYPE_CHECKING:
busy: "bool | None" = None,
homescreen_format: "HomescreenFormat | None" = None,
hide_passphrase_from_host: "bool | None" = None,
internal_model: "str | None" = None,
) -> None:
pass

View File

@ -3,6 +3,7 @@ import sys
from trezorutils import ( # noqa: F401
BITCOIN_ONLY,
EMULATOR,
INTERNAL_MODEL,
MODEL,
SCM_REVISION,
USE_SD_CARD,

View File

@ -7,6 +7,7 @@ Features.label max_size:33
Features.revision max_size:20
Features.bootloader_hash max_size:32
Features.model max_size:17
Features.internal_model max_size:17
Features.fw_vendor max_size:256
Features.capabilities max_count:32
Features.session_id max_size:32

View File

@ -3160,6 +3160,7 @@ class Features(protobuf.MessageType):
41: protobuf.Field("busy", "bool", repeated=False, required=False, default=None),
42: protobuf.Field("homescreen_format", "HomescreenFormat", repeated=False, required=False, default=None),
43: protobuf.Field("hide_passphrase_from_host", "bool", repeated=False, required=False, default=None),
44: protobuf.Field("internal_model", "string", repeated=False, required=False, default=None),
}
def __init__(
@ -3206,6 +3207,7 @@ class Features(protobuf.MessageType):
busy: Optional["bool"] = None,
homescreen_format: Optional["HomescreenFormat"] = None,
hide_passphrase_from_host: Optional["bool"] = None,
internal_model: Optional["str"] = None,
) -> None:
self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else []
self.major_version = major_version
@ -3248,6 +3250,7 @@ class Features(protobuf.MessageType):
self.busy = busy
self.homescreen_format = homescreen_format
self.hide_passphrase_from_host = hide_passphrase_from_host
self.internal_model = internal_model
class LockDevice(protobuf.MessageType):