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

RustLayout rework, Global Layout object #3686

Merged
merged 60 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c68094a
refactor(core/rust): create a single code path allowed to modify Swip…
matejcik Sep 6, 2024
30e9b1e
refactor(core): expose USE_TOUCH and USE_BUTTON to uPy
TychoVrahe Apr 25, 2023
d9b997e
feat(core): introduce timeout to loop.wait()
matejcik Jun 29, 2023
0afa8f0
refactor(core): remove unused features from loop.race
matejcik Jul 25, 2023
7033d68
refactor(core): remove debuglink support from main handle_session
matejcik Jul 25, 2023
40c3f40
feat(core): add mailbox as a simplified version of chan
matejcik Jul 26, 2023
f3eda17
fix(core): set default value for do_not_restart
matejcik Jul 18, 2024
357933f
build(core): fix random order seed when using zsh
matejcik Oct 31, 2023
2164a4f
refactor(core/ui): improve LayoutObj initialization
matejcik Nov 6, 2023
ca2bc80
refactor(core/rust): introduce layout lifecycle states on Rust side
matejcik Aug 8, 2024
916bbdc
feat(core): unify RustLayout, implement single global layout
matejcik Jul 4, 2024
5ee09a8
fix(core/ui): repaint the title of Progress layout when requested
matejcik Nov 8, 2023
9ff92b0
feat(core): show progress before starting to wipe device
matejcik Nov 15, 2023
afb3f64
docs(core): Layout lifecycle documentation
matejcik Nov 16, 2023
c553889
tests: use read_layout everywhere
matejcik Nov 21, 2023
d2f4030
refactor(core): improve recovery_enter_share
matejcik Nov 20, 2023
80958f4
tests: fix small irregularities
matejcik Nov 21, 2023
3ee498b
fix(core): correctly repaint ShowMore component when requested
matejcik Mar 7, 2024
ee5e8d8
style: fix complaining lints & formatters
matejcik Apr 7, 2024
5c8831a
docs(core): add changelog
matejcik Apr 8, 2024
1eed2a6
feat(tests): sync received responses
matejcik Apr 11, 2024
e71a6bd
fix(tests): restore test functionality on legacy
matejcik Apr 11, 2024
f199632
refactor(core/ui): reusable timers
matejcik Apr 10, 2024
5b64678
feat(core): drop support for after-step-hook
matejcik Mar 21, 2024
6279072
fix(core): allow Ping while locked
matejcik Jul 19, 2024
47c6a4b
fix(python): improve robustness of TrezorClientDebugLink setup
matejcik Jul 19, 2024
b286d17
chore(python): improve recovery type deprecation warning
matejcik Jul 19, 2024
470ff8e
fix(tests): stop waiting for background task after a timeout
matejcik Jul 30, 2024
31d6b6b
style(core/rust): avoid unused warning
matejcik Jul 30, 2024
8c3723d
style: fix style problems
matejcik Sep 4, 2024
747ebeb
fix(python): opportunistically catch a debuglink desync
matejcik Sep 16, 2024
904e63a
chore(core/rust): add uDebug capability to more places
matejcik Sep 16, 2024
39d0592
chore: update fixtures
matejcik Sep 18, 2024
a033e00
fix(tests): do not trip deadlock detection in autolock test
matejcik Sep 19, 2024
e774d95
fix(core): fix cancel behavior in SignMessage
matejcik Sep 20, 2024
fbddf4e
fix(tests): do not place recorded.zip into the destdir
matejcik Sep 20, 2024
b9bda5e
fix(tests): correctly check that backup flow was aborted
matejcik Sep 24, 2024
e05e349
fix(core): restore ellipsis functionality on TR
matejcik Sep 24, 2024
ae95079
style(core/rust): fix linter complaints
matejcik Sep 25, 2024
43ecc72
style: make style_check passing
matejcik Sep 26, 2024
3f59318
fix(tests): fix persistence tests, enable T3B1
matejcik Oct 10, 2024
6a57853
fix(tests): assert multiple in slip39 checklist
obrusvit Oct 14, 2024
5c7cb03
fix(tests): fix click tests race condition
obrusvit Oct 17, 2024
88993e8
fix(tests): fix T3B1 persistance test
obrusvit Oct 17, 2024
172141a
test(core): fix test_reset_bip39_t2
mmilata Oct 17, 2024
bd8d090
test(core): fix T3T1 U2F test
mmilata Oct 17, 2024
4bd7fa6
test(core): fix T2T1 FIDO2 test
mmilata Oct 21, 2024
98bdc9e
tests(core): fix upgrade tests
matejcik Nov 6, 2024
9a6af3b
style(python): upgrade debuglink.py to 3.10 style type annotations
matejcik Nov 6, 2024
a235f4f
fix(tests): patch over confirm_blob buttonrequest problems
matejcik Nov 8, 2024
96e54a0
chore: update fixtures
matejcik Sep 26, 2024
9d13311
feat(core): log ButtonRequests with names for easier debugging
matejcik Nov 8, 2024
1d52081
feat(core): enforce return type annotations
matejcik Nov 8, 2024
f8b1876
fix(core): patch over problems with confirm_blob_pagination
matejcik Nov 11, 2024
74763a8
chore: update fixtures
matejcik Nov 11, 2024
15dc234
fix(tests): show_multisig title assertions
obrusvit Nov 11, 2024
429a9d0
chore: update fixtures for translations
matejcik Nov 12, 2024
3c65bad
chore: update FIDO2 test helpers
matejcik Nov 12, 2024
aec8794
fix(tests): remove lang asserts from click slip39
obrusvit Nov 12, 2024
6b8585b
fix(python): do not take legacy snapshots on PinRequest and Passphras…
matejcik Nov 12, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
|core UI changes|device test|click test|persistence test|
|---------------|-----------|----------|----------------|
|T2T1 Model T |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_device_test/status.png" width="24" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_device_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_device_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_device_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_device_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_click_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_click_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_click_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_click_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_click_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_persistence_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_persistence_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_persistence_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_persistence_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T2T1-en-core_persistence_test/master_diff.html))||
|T3B1 Safe 3 |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/master_diff.html)) |[2724](https://github.com/trezor/trezor-firmware/issues/2724) ||
|T3B1 Safe 3 |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_device_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_click_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_persistence_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_persistence_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_persistence_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_persistence_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3B1-en-core_persistence_test/master_diff.html))||
|T3T1 Safe 5 |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_device_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_device_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_device_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_device_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_device_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_click_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_click_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_click_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_click_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_click_test/master_diff.html)) |<img src="https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_persistence_test/status.png" width="20px" height="20px" /> [test](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_persistence_test/index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_persistence_test/differing_screens.html)) [main](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_persistence_test/master_index.html)([screens](https://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/T3T1-en-core_persistence_test/master_diff.html))||
|All |<img src="https://data.trezor.io/dev/firmware/master_diff/${{ github.run_id }}/status.png" width="20px" height="20px" /> [main](https://data.trezor.io/dev/firmware/master_diff/${{ github.run_id }}/index.html)([screens](https://data.trezor.io/dev/firmware/master_diff/${{ github.run_id }}/master_diff.html)) ||

Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [T2T1, T3T1] # TODO T3B1 https://github.com/trezor/trezor-firmware/issues/2724
model: [T2T1, T3B1, T3T1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
Expand Down
28 changes: 24 additions & 4 deletions common/protob/messages-debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ message DebugLinkDecision {

optional uint32 x = 4; // touch X coordinate
optional uint32 y = 5; // touch Y coordinate
optional bool wait = 6; // wait for layout change
optional bool wait = 6 [deprecated=true]; // wait for layout change
optional uint32 hold_ms = 7; // touch hold duration
optional DebugPhysicalButton physical_button = 8; // physical button press
}
Expand All @@ -61,6 +61,7 @@ message DebugLinkDecision {
* @end
*/
message DebugLinkLayout {
option deprecated = true;
repeated string tokens = 1;
}

Expand Down Expand Up @@ -89,9 +90,26 @@ message DebugLinkRecordScreen {
* @next DebugLinkState
*/
message DebugLinkGetState {
optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown
optional bool wait_word_pos = 2; // Trezor T only - wait until reset word position is requested
optional bool wait_layout = 3; // wait until current layout changes
/// Wait behavior of the call.
enum DebugWaitType {
/// Respond immediately. If no layout is currently displayed, the layout
/// response will be empty.
IMMEDIATE = 0;
/// Wait for next layout. If a layout is displayed, waits for it to change.
/// If no layout is displayed, waits for one to come up.
NEXT_LAYOUT = 1;
/// Return current layout. If no layout is currently displayed, waits for
/// one to come up.
CURRENT_LAYOUT = 2;
}

// Trezor T < 2.6.0 only - wait until mnemonic words are shown
optional bool wait_word_list = 1 [deprecated=true];
// Trezor T < 2.6.0 only - wait until reset word position is requested
optional bool wait_word_pos = 2 [deprecated=true];
// trezor-core only - wait until current layout changes
// changed in 2.6.4: multiple wait types instead of true/false.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: version does not match anymore

optional DebugWaitType wait_layout = 3 [default=IMMEDIATE];
}

/**
Expand Down Expand Up @@ -192,6 +210,7 @@ message DebugLinkEraseSdCard {
* @next Success
*/
message DebugLinkWatchLayout {
option deprecated = true;
optional bool watch = 1; // if true, start watching layout.
// if false, stop.
}
Expand All @@ -203,6 +222,7 @@ message DebugLinkWatchLayout {
* @next Success
*/
message DebugLinkResetDebugEvents {
option deprecated = true;
}


Expand Down
1 change: 1 addition & 0 deletions core/.changelog.d/2299.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve UI synchronization, ordering, and responsiveness (Global Layout project).
1 change: 1 addition & 0 deletions core/.changelog.d/3633.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved device responsiveness by removing unnecessary screen refreshes.
5 changes: 3 additions & 2 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ TREZOR_FIDO2_UDP_PORT = 21326
RUST_TARGET=$(shell rustc -vV | sed -n 's/host: //p')

MULTICORE ?= "auto"
RANDOM=$(shell python -c 'import random; print(random.randint(0, 1000000))')

## help commands:

Expand Down Expand Up @@ -163,7 +164,7 @@ test_emu: ## run selected device tests from python-trezor

test_emu_multicore: ## run device tests using multiple cores
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) --timeout $(PYTEST_TIMEOUT) \
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM) \
--control-emulators --model=core --random-order-seed=$(RANDOM) \
--lang=$(TEST_LANG)

test_emu_monero: ## run selected monero device tests from monero-agent
Expand Down Expand Up @@ -199,7 +200,7 @@ test_emu_ui: ## run ui integration tests
test_emu_ui_multicore: ## run ui integration tests using multiple cores
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) --timeout $(PYTEST_TIMEOUT) \
--ui=test --ui-check-missing --record-text-layout --do-master-diff \
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM) \
--control-emulators --model=core --random-order-seed=$(RANDOM) \
--lang=$(TEST_LANG)

test_emu_ui_record: ## record and hash screens for ui integration tests
Expand Down
2 changes: 2 additions & 0 deletions core/SConscript.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ if FROZEN:
bitcoin_only=BITCOIN_ONLY,
backlight='backlight' in FEATURES_AVAILABLE,
optiga='optiga' in FEATURES_AVAILABLE,
use_button='button' in FEATURES_AVAILABLE,
use_touch='touch' in FEATURES_AVAILABLE,
ui_layout=ui.get_ui_layout(TREZOR_MODEL),
thp=THP,
)
Expand Down
26 changes: 8 additions & 18 deletions core/SConscript.unix
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,6 @@ env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPYOPT=%s -DBITCOI

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_UNIX, PATH_HAL)


if 'sd_card' in FEATURES_AVAILABLE:
SDCARD = True
else:
SDCARD = False

if 'optiga' in FEATURES_AVAILABLE:
OPTIGA = True
else:
OPTIGA = False


env.Tool('micropython')

env.Replace(
Expand Down Expand Up @@ -628,7 +616,7 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/*.py',
exclude=[
SOURCE_PY_DIR + 'trezor/sdcard.py',
] if not SDCARD else []
] if 'sd_card' not in FEATURES_AVAILABLE else []
))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/crypto/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/*.py'))
Expand All @@ -653,7 +641,7 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'storage/*.py',
exclude=[
SOURCE_PY_DIR + 'storage/sd_salt.py',
] if not SDCARD else []
] if 'sd_card' not in FEATURES_AVAILABLE else []
))

SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/messages/__init__.py'))
Expand All @@ -678,16 +666,16 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/*.py',
exclude=[
SOURCE_PY_DIR + 'apps/common/sdcard.py',
] if not SDCARD else []
] if "sd_card" not in FEATURES_AVAILABLE else []
))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/debug/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/homescreen/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/management/*.py',
exclude=[
SOURCE_PY_DIR + 'apps/management/sd_protect.py',
] if not SDCARD else [] + [
] if "sd_card" not in FEATURES_AVAILABLE else [] + [
SOURCE_PY_DIR + 'apps/management/authenticate_device.py',
] if not OPTIGA else [])
] if "optiga" not in FEATURES_AVAILABLE else [])
)
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/management/*/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/misc/*.py'))
Expand Down Expand Up @@ -762,7 +750,9 @@ if FROZEN:
source_dir=SOURCE_PY_DIR,
bitcoin_only=BITCOIN_ONLY,
backlight='backlight' in FEATURES_AVAILABLE,
optiga=OPTIGA,
optiga='optiga' in FEATURES_AVAILABLE,
use_button='button' in FEATURES_AVAILABLE,
use_touch='touch' in FEATURES_AVAILABLE,
ui_layout=ui.get_ui_layout(TREZOR_MODEL),
thp=THP,
)
Expand Down
14 changes: 14 additions & 0 deletions core/embed/extmod/modtrezorutils/modtrezorutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ STATIC mp_obj_tuple_t mod_trezorutils_version_obj = {
/// """Whether the hardware supports haptic feedback."""
/// USE_OPTIGA: bool
/// """Whether the hardware supports Optiga secure element."""
/// USE_TOUCH: bool
/// """Whether the hardware supports touch screen."""
/// USE_BUTTON: bool
/// """Whether the hardware supports two-button input."""
/// MODEL: str
/// """Model name."""
/// MODEL_FULL_NAME: str
Expand Down Expand Up @@ -453,6 +457,16 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR_USE_OPTIGA), mp_const_true},
#else
{MP_ROM_QSTR(MP_QSTR_USE_OPTIGA), mp_const_false},
#endif
#ifdef USE_TOUCH
{MP_ROM_QSTR(MP_QSTR_USE_TOUCH), mp_const_true},
#else
{MP_ROM_QSTR(MP_QSTR_USE_TOUCH), mp_const_false},
#endif
#ifdef USE_BUTTON
{MP_ROM_QSTR(MP_QSTR_USE_BUTTON), mp_const_true},
#else
{MP_ROM_QSTR(MP_QSTR_USE_BUTTON), mp_const_false},
#endif
{MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_PTR(&mod_trezorutils_model_name_obj)},
{MP_ROM_QSTR(MP_QSTR_MODEL_FULL_NAME),
Expand Down
6 changes: 6 additions & 0 deletions core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@

static void _librust_qstrs(void) {
MP_QSTR_;
MP_QSTR_ATTACHED;
MP_QSTR_AttachType;
MP_QSTR_BacklightLevels;
MP_QSTR_CANCELLED;
MP_QSTR_CONFIRMED;
MP_QSTR_DIM;
MP_QSTR_DONE;
MP_QSTR_INFO;
MP_QSTR_INITIAL;
MP_QSTR_LOW;
MP_QSTR_LayoutObj;
MP_QSTR_LayoutState;
MP_QSTR_MAX;
MP_QSTR_MESSAGE_NAME;
MP_QSTR_MESSAGE_WIRE_TYPE;
Expand All @@ -28,6 +31,7 @@ static void _librust_qstrs(void) {
MP_QSTR_SWIPE_RIGHT;
MP_QSTR_SWIPE_UP;
MP_QSTR_TR;
MP_QSTR_TRANSITIONING;
MP_QSTR_TranslationsHeader;
MP_QSTR___del__;
MP_QSTR___dict__;
Expand Down Expand Up @@ -581,6 +585,7 @@ static void _librust_qstrs(void) {
MP_QSTR_reset__wrong_word_selected;
MP_QSTR_reset__you_need_one_share;
MP_QSTR_reset__your_backup_is_done;
MP_QSTR_return_value;
MP_QSTR_reverse;
MP_QSTR_rotation__change_template;
MP_QSTR_rotation__east;
Expand Down Expand Up @@ -652,6 +657,7 @@ static void _librust_qstrs(void) {
MP_QSTR_show_homescreen;
MP_QSTR_show_info;
MP_QSTR_show_info_with_cancel;
MP_QSTR_show_instructions;
MP_QSTR_show_lockscreen;
MP_QSTR_show_mismatch;
MP_QSTR_show_passphrase;
Expand Down
12 changes: 9 additions & 3 deletions core/embed/rust/src/micropython/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ macro_rules! obj_fn_kw {
/// Construct fixed static const `Map` from `key` => `val` pairs.
macro_rules! obj_map {
($($key:expr => $val:expr),*) => ({
Map::from_fixed_static(&[
$crate::micropython::map::Map::from_fixed_static(&[
$(
Map::at($key, $val),
$crate::micropython::map::Map::at($key, $val),
)*
])
});
Expand Down Expand Up @@ -110,6 +110,7 @@ macro_rules! obj_dict {
/// Compose a `Type` object definition.
macro_rules! obj_type {
(name: $name:expr,
$(base: $base:expr,)?
$(locals: $locals:expr,)?
$(make_new_fn: $make_new_fn:path,)?
$(attr_fn: $attr_fn:path,)?
Expand All @@ -121,6 +122,11 @@ macro_rules! obj_type {

let name = $name.to_u16();

#[allow(unused_mut)]
#[allow(unused_assignments)]
let mut base_type: &'static ffi::mp_obj_type_t = &ffi::mp_type_type;
$(base_type = &$base;)?

#[allow(unused_mut)]
#[allow(unused_assignments)]
let mut attr: ffi::mp_attr_fun_t = None;
Expand All @@ -146,7 +152,7 @@ macro_rules! obj_type {

ffi::mp_obj_type_t {
base: ffi::mp_obj_base_t {
type_: &ffi::mp_type_type,
type_: base_type,
},
flags: 0,
name,
Expand Down
4 changes: 2 additions & 2 deletions core/embed/rust/src/ui/button_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use num_traits::FromPrimitive;

// ButtonRequestType from messages-common.proto
// Eventually this should be generated
#[derive(Clone, Copy, FromPrimitive)]
#[derive(Clone, Copy, FromPrimitive, PartialEq, Eq)]
#[repr(u16)]
pub enum ButtonRequestCode {
Other = 1,
Expand Down Expand Up @@ -41,7 +41,7 @@ impl ButtonRequestCode {
}
}

#[derive(Clone)]
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct ButtonRequest {
pub code: ButtonRequestCode,
pub name: TString<'static>,
Expand Down
Loading
Loading