From 8010cfb5b61d25e86fdab56bc137f00507d97c06 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Wed, 23 Aug 2023 10:00:41 +0200 Subject: [PATCH] feat(core): Add utils.USE_OPTIGA. --- core/embed/extmod/modtrezorutils/modtrezorutils.c | 6 ++++++ core/mocks/generated/trezorutils.pyi | 1 + core/src/trezor/utils.py | 1 + 3 files changed, 8 insertions(+) diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index 10820f5a2b..95a0b00679 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -263,6 +263,7 @@ STATIC mp_obj_str_t mod_trezorutils_revision_obj = { /// VERSION_PATCH: int /// USE_SD_CARD: bool /// USE_BACKLIGHT: bool +/// USE_OPTIGA: bool /// MODEL: str /// INTERNAL_MODEL: str /// EMULATOR: bool @@ -298,6 +299,11 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_USE_BACKLIGHT), mp_const_true}, #else {MP_ROM_QSTR(MP_QSTR_USE_BACKLIGHT), mp_const_false}, +#endif +#ifdef USE_OPTIGA + {MP_ROM_QSTR(MP_QSTR_USE_OPTIGA), mp_const_true}, +#else + {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_INTERNAL_MODEL), diff --git a/core/mocks/generated/trezorutils.pyi b/core/mocks/generated/trezorutils.pyi index 913d958410..a2685f073e 100644 --- a/core/mocks/generated/trezorutils.pyi +++ b/core/mocks/generated/trezorutils.pyi @@ -85,6 +85,7 @@ VERSION_MINOR: int VERSION_PATCH: int USE_SD_CARD: bool USE_BACKLIGHT: bool +USE_OPTIGA: bool MODEL: str INTERNAL_MODEL: str EMULATOR: bool diff --git a/core/src/trezor/utils.py b/core/src/trezor/utils.py index 74de2e7227..0110e17e5b 100644 --- a/core/src/trezor/utils.py +++ b/core/src/trezor/utils.py @@ -7,6 +7,7 @@ from trezorutils import ( # noqa: F401 MODEL, SCM_REVISION, USE_BACKLIGHT, + USE_OPTIGA, USE_SD_CARD, VERSION_MAJOR, VERSION_MINOR,