1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-12 08:20:56 +00:00

fix(core): rework 'too many PIN attempts' RSOD

Also, allow multi-line title in `model_samson` `ErrorScreen`.

Co-authored-by: Roman Zeyde <roman.zeyde@satoshilabs.com>
This commit is contained in:
Lukas Bielesch 2024-10-30 10:51:04 +01:00 committed by Roman Zeyde
parent 849af38f5e
commit 1ef62aaf0b
3 changed files with 11 additions and 10 deletions

View File

@ -0,0 +1 @@
[T2B1, T3B1] Fix "PIN attempts exceeded" screen

View File

@ -58,9 +58,9 @@ void __attribute__((noreturn)) show_wipe_code_screen(void) {
}
void __attribute__((noreturn)) show_pin_too_many_screen(void) {
error_shutdown_ex("TOO MANY PIN ATTEMPTS",
"All data has been erased from the device",
"PLEASE RECONNECT\nTHE DEVICE");
error_shutdown_ex("PIN ATTEMPTS\nEXCEEDED",
"All data has been\nerased from the device",
"Please reconnect the\ndevice");
}
void __attribute__((noreturn)) show_install_restricted_screen(void) {

View File

@ -48,19 +48,19 @@ impl Component for ErrorScreen<'_> {
fn place(&mut self, _bounds: Rect) -> Rect {
self.bg.place(screen());
let title_area = Rect::new(screen().top_left(), screen().top_right() + Offset::y(11));
self.title.place(title_area);
let text_width = self.title.inner().max_size().x;
if text_width > title_area.width() - 2 * TITLE_AREA_HEIGHT {
if text_width > screen().width() - 2 * TITLE_AREA_HEIGHT {
// if the title is too long, don't show the icons
self.show_icons = false;
}
let title_area = self.title.place(screen());
let top_offset = if self.show_icons {
Offset::y(11)
// show warning icons when the title fits a single line
Offset::y(TITLE_AREA_HEIGHT)
} else {
Offset::y(8)
// longer titles will be split and rendered without icons
Offset::y(title_area.height())
};
let message_area = Rect::new(