mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-06 12:51:21 +00:00
fix(core): fix display fatal error screen
[no changelog]
This commit is contained in:
parent
165238b78e
commit
72146c2ae2
@ -100,7 +100,6 @@ __attribute__((noreturn)) void display_error_and_die(const char *message,
|
|||||||
display_init();
|
display_init();
|
||||||
display_backlight(180);
|
display_backlight(180);
|
||||||
screen_fatal_error_rust(title, message, footer);
|
screen_fatal_error_rust(title, message, footer);
|
||||||
display_refresh();
|
|
||||||
#if USE_TOUCH
|
#if USE_TOUCH
|
||||||
printf("Click screen to exit.\n");
|
printf("Click screen to exit.\n");
|
||||||
#elif USE_BUTTON
|
#elif USE_BUTTON
|
||||||
@ -210,7 +209,6 @@ __attribute__((noreturn)) void jump_to(void *addr) {
|
|||||||
"STORAGE WAS RETAINED");
|
"STORAGE WAS RETAINED");
|
||||||
}
|
}
|
||||||
display_backlight(180);
|
display_backlight(180);
|
||||||
display_refresh();
|
|
||||||
hal_delay(3000);
|
hal_delay(3000);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,14 @@ fn shutdown() -> ! {
|
|||||||
#[cfg(feature = "bootloader")]
|
#[cfg(feature = "bootloader")]
|
||||||
pub fn __fatal_error(_expr: &str, _msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
|
pub fn __fatal_error(_expr: &str, _msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
|
||||||
ModelUI::screen_fatal_error("BL.rs", "BL.rs", "PLEASE VISIT\nTREZOR.IO/RSOD");
|
ModelUI::screen_fatal_error("BL.rs", "BL.rs", "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
|
ModelUI::backlight_on();
|
||||||
shutdown()
|
shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "bootloader"))]
|
#[cfg(not(feature = "bootloader"))]
|
||||||
pub fn __fatal_error(_expr: &str, msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
|
pub fn __fatal_error(_expr: &str, msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
|
||||||
ModelUI::screen_fatal_error("INTERNAL_ERROR", msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
ModelUI::screen_fatal_error("INTERNAL_ERROR", msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
|
ModelUI::backlight_on();
|
||||||
shutdown()
|
shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
|
|||||||
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
|
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
|
||||||
frame.place(constant::screen());
|
frame.place(constant::screen());
|
||||||
frame.paint();
|
frame.paint();
|
||||||
|
display::refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn screen_boot_full() {
|
pub fn screen_boot_full() {
|
||||||
|
@ -23,6 +23,11 @@ impl UIFeaturesCommon for ModelTTFeatures {
|
|||||||
crate::ui::display::fade_backlight_duration(theme::BACKLIGHT_DIM, 150);
|
crate::ui::display::fade_backlight_duration(theme::BACKLIGHT_DIM, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn backlight_on() {
|
||||||
|
#[cfg(feature = "backlight")]
|
||||||
|
crate::ui::display::set_backlight(theme::BACKLIGHT_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
const SCREEN: Rect = constant::SCREEN;
|
const SCREEN: Rect = constant::SCREEN;
|
||||||
|
|
||||||
fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
|
fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
|
||||||
|
@ -12,6 +12,7 @@ pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
|
|||||||
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
|
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
|
||||||
frame.place(constant::screen());
|
frame.place(constant::screen());
|
||||||
frame.paint();
|
frame.paint();
|
||||||
|
display::refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn screen_boot_full() {
|
pub fn screen_boot_full() {
|
||||||
|
@ -5,6 +5,7 @@ use crate::{trezorhal::secbool::secbool, ui::display::Color};
|
|||||||
pub trait UIFeaturesCommon {
|
pub trait UIFeaturesCommon {
|
||||||
fn fadein() {}
|
fn fadein() {}
|
||||||
fn fadeout() {}
|
fn fadeout() {}
|
||||||
|
fn backlight_on() {}
|
||||||
|
|
||||||
const SCREEN: Rect;
|
const SCREEN: Rect;
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ uint32_t systick_val_copy = 0;
|
|||||||
extern void shutdown_privileged(void);
|
extern void shutdown_privileged(void);
|
||||||
|
|
||||||
void __attribute__((noreturn)) trezor_shutdown(void) {
|
void __attribute__((noreturn)) trezor_shutdown(void) {
|
||||||
|
display_finish_actions();
|
||||||
#ifdef USE_SVC_SHUTDOWN
|
#ifdef USE_SVC_SHUTDOWN
|
||||||
svc_shutdown();
|
svc_shutdown();
|
||||||
#else
|
#else
|
||||||
@ -69,9 +70,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
display_orientation(0);
|
display_orientation(0);
|
||||||
|
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
if (label) {
|
if (label) {
|
||||||
@ -85,7 +84,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
display_backlight(255);
|
display_backlight(255);
|
||||||
display_refresh();
|
|
||||||
trezor_shutdown();
|
trezor_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +98,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
|
|||||||
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
|
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
|
||||||
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
|
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
|
||||||
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
term_printf("\nINTERNAL ERROR:\n");
|
term_printf("\nINTERNAL ERROR:\n");
|
||||||
@ -133,7 +130,6 @@ error_shutdown(const char *label, const char *msg) {
|
|||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
if (label) {
|
if (label) {
|
||||||
|
@ -105,8 +105,6 @@ void secret_show_install_restricted_screen(void) {
|
|||||||
"INSTALL RESTRICTED",
|
"INSTALL RESTRICTED",
|
||||||
"Installation of custom firmware is currently restricted.",
|
"Installation of custom firmware is currently restricted.",
|
||||||
"Please visit\ntrezor.io/bootloader");
|
"Please visit\ntrezor.io/bootloader");
|
||||||
|
|
||||||
display_refresh();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
display_orientation(0);
|
display_orientation(0);
|
||||||
|
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
if (label) {
|
if (label) {
|
||||||
@ -87,7 +85,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
display_backlight(255);
|
display_backlight(255);
|
||||||
display_refresh();
|
|
||||||
trezor_shutdown();
|
trezor_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +99,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
|
|||||||
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
|
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
|
||||||
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
|
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
|
||||||
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
term_printf("\nINTERNAL ERROR:\n");
|
term_printf("\nINTERNAL ERROR:\n");
|
||||||
@ -133,9 +129,7 @@ error_shutdown(const char *label, const char *msg) {
|
|||||||
display_orientation(0);
|
display_orientation(0);
|
||||||
|
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
if (label) {
|
if (label) {
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
extern void main_clean_exit(int);
|
extern void main_clean_exit(int);
|
||||||
|
|
||||||
void __attribute__((noreturn)) trezor_shutdown(void) {
|
void __attribute__((noreturn)) trezor_shutdown(void) {
|
||||||
|
display_finish_actions();
|
||||||
printf("SHUTDOWN\n");
|
printf("SHUTDOWN\n");
|
||||||
main_clean_exit(3);
|
main_clean_exit(3);
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -52,9 +53,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
display_orientation(0);
|
display_orientation(0);
|
||||||
|
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
if (label) {
|
if (label) {
|
||||||
@ -68,7 +67,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
display_backlight(255);
|
display_backlight(255);
|
||||||
display_refresh();
|
|
||||||
hal_delay(3000);
|
hal_delay(3000);
|
||||||
trezor_shutdown();
|
trezor_shutdown();
|
||||||
}
|
}
|
||||||
@ -90,8 +88,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
|
|||||||
screen_fatal_error_rust("INTERNAL ERROR", msg,
|
screen_fatal_error_rust("INTERNAL ERROR", msg,
|
||||||
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
"PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
}
|
}
|
||||||
|
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
|
||||||
term_printf("\nINTERNAL ERROR:\n");
|
term_printf("\nINTERNAL ERROR:\n");
|
||||||
@ -130,7 +126,6 @@ void __attribute__((noreturn))
|
|||||||
error_shutdown(const char *label, const char *msg) {
|
error_shutdown(const char *label, const char *msg) {
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef FANCY_FATAL_ERROR
|
||||||
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
|
||||||
display_refresh();
|
|
||||||
#else
|
#else
|
||||||
display_clear();
|
display_clear();
|
||||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_FATAL_ERROR);
|
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_FATAL_ERROR);
|
||||||
|
Loading…
Reference in New Issue
Block a user