1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

feat(core): show red error header when USB data not connected

This commit is contained in:
Ondrej Mikle 2022-08-25 13:13:00 +02:00 committed by matejcik
parent a0287698d5
commit 72228e35cf
5 changed files with 11 additions and 3 deletions

View File

@ -1 +1 @@
Show blue dot when USB data pins are not connected
Show red error header when USB data pins are not connected

View File

@ -66,3 +66,9 @@ const char *profile_sdcard_path(void) {
FILE_PATH(_sdcard_path, "/trezor.sdcard");
return _sdcard_path;
}
const char *profile_usb_disconnect_path(void) {
SVAR(_disconnect_path);
FILE_PATH(_disconnect_path, "/trezor.usb_data_disconnected");
return _disconnect_path;
}

View File

@ -33,5 +33,6 @@ const char *profile_name(void);
const char *profile_dir(void);
const char *profile_flash_path(void);
const char *profile_sdcard_path(void);
const char *profile_usb_disconnect_path(void);
#endif // __TREZOR_PROFILE_H__

View File

@ -27,6 +27,7 @@
#include <time.h>
#include <unistd.h>
#include "profile.h"
#include "touch.h"
#include "usb.h"
@ -252,7 +253,7 @@ void pendsv_kbd_intr(void) {}
void mp_hal_set_vcp_iface(int iface_num) {}
secbool usb_configured(void) {
if (access("/var/tmp/trezor.usb_data_disconnected", F_OK) == 0) {
if (access(profile_usb_disconnect_path(), F_OK) == 0) {
return secfalse;
}

View File

@ -68,7 +68,7 @@ class Homescreen(HomescreenBase):
# Differs for each model
if not utils.usb_data_connected():
ui.display.bar(0, 0, 8, 8, ui.BLUE)
ui.header_error("NO USB CONNECTION")
# TODO: support homescreen avatar change for R and 1
if utils.MODEL in ("T",):