mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 06:18:07 +00:00
refactor(core): inject full model name from build script
so that we don't have to do awkward string operations when we need it [no changelog]
This commit is contained in:
parent
b07f4d938a
commit
c892d4b0ba
@ -281,6 +281,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorutils_bootloader_locked_obj,
|
||||
STATIC mp_obj_str_t mod_trezorutils_revision_obj = {
|
||||
{&mp_type_bytes}, 0, sizeof(SCM_REVISION) - 1, (const byte *)SCM_REVISION};
|
||||
|
||||
STATIC mp_obj_str_t mod_trezorutils_full_name_obj = {
|
||||
{&mp_type_str},
|
||||
0,
|
||||
sizeof(MODEL_FULL_NAME) - 1,
|
||||
(const byte *)MODEL_FULL_NAME};
|
||||
|
||||
/// SCM_REVISION: bytes
|
||||
/// VERSION_MAJOR: int
|
||||
/// VERSION_MINOR: int
|
||||
@ -289,6 +295,7 @@ STATIC mp_obj_str_t mod_trezorutils_revision_obj = {
|
||||
/// USE_BACKLIGHT: bool
|
||||
/// USE_OPTIGA: bool
|
||||
/// MODEL: str
|
||||
/// MODEL_FULL_NAME: str
|
||||
/// INTERNAL_MODEL: str
|
||||
/// EMULATOR: bool
|
||||
/// BITCOIN_ONLY: bool
|
||||
@ -333,6 +340,8 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
|
||||
{MP_ROM_QSTR(MP_QSTR_USE_OPTIGA), mp_const_false},
|
||||
#endif
|
||||
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MODEL_NAME_QSTR)},
|
||||
{MP_ROM_QSTR(MP_QSTR_MODEL_FULL_NAME),
|
||||
MP_ROM_PTR(&mod_trezorutils_full_name_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_INTERNAL_MODEL),
|
||||
MP_ROM_QSTR(MODEL_INTERNAL_NAME_QSTR)},
|
||||
#ifdef TREZOR_EMULATOR
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MODELS_MODEL_D001_H_
|
||||
|
||||
#define MODEL_NAME "T"
|
||||
#define MODEL_FULL_NAME "Trezor Model T"
|
||||
#define MODEL_INTERNAL_NAME "D001"
|
||||
#define MODEL_INTERNAL_NAME_TOKEN T
|
||||
#define MODEL_NAME_QSTR MP_QSTR_T
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MODELS_MODEL_T1B1_H_
|
||||
|
||||
#define MODEL_NAME "1"
|
||||
#define MODEL_FULL_NAME "Trezor Model One"
|
||||
#define MODEL_INTERNAL_NAME "T1B1"
|
||||
#define MODEL_INTERNAL_NAME_TOKEN T1B1
|
||||
#define MODEL_NAME_QSTR MP_QSTR_1
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MODELS_MODEL_T2B1_H_
|
||||
|
||||
#define MODEL_NAME "R"
|
||||
#define MODEL_FULL_NAME "Trezor Model R"
|
||||
#define MODEL_INTERNAL_NAME "T2B1"
|
||||
#define MODEL_INTERNAL_NAME_TOKEN T2B1
|
||||
#define MODEL_NAME_QSTR MP_QSTR_R
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MODELS_MODEL_T2T1_H_
|
||||
|
||||
#define MODEL_NAME "T"
|
||||
#define MODEL_FULL_NAME "Trezor Model T"
|
||||
#define MODEL_INTERNAL_NAME "T2T1"
|
||||
#define MODEL_INTERNAL_NAME_TOKEN T2T1
|
||||
#define MODEL_NAME_QSTR MP_QSTR_T
|
||||
|
@ -19,7 +19,7 @@ async def homescreen() -> None:
|
||||
if storage.device.is_initialized():
|
||||
label = storage.device.get_label()
|
||||
else:
|
||||
label = f"Trezor Model {utils.MODEL}"
|
||||
label = utils.MODEL_FULL_NAME
|
||||
|
||||
notification = None
|
||||
notification_is_error = False
|
||||
|
@ -5,6 +5,7 @@ from trezorutils import ( # noqa: F401
|
||||
EMULATOR,
|
||||
INTERNAL_MODEL,
|
||||
MODEL,
|
||||
MODEL_FULL_NAME,
|
||||
SCM_REVISION,
|
||||
UI_LAYOUT,
|
||||
USE_BACKLIGHT,
|
||||
|
Loading…
Reference in New Issue
Block a user