mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 11:28:14 +00:00
bootloader: small UI nitpicks
This commit is contained in:
parent
117a3efbe2
commit
8fc65d7f32
@ -56,10 +56,10 @@ void ui_screen_boot(const vendor_header *vhdr, const image_header *hdr)
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 25, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, background, 0);
|
||||
}
|
||||
|
||||
void ui_screen_boot_wait(int delay)
|
||||
void ui_screen_boot_wait(int wait_seconds)
|
||||
{
|
||||
char wait_str[16];
|
||||
mini_snprintf(wait_str, sizeof(wait_str), "waiting for %ds", delay);
|
||||
mini_snprintf(wait_str, sizeof(wait_str), "waiting for %ds", wait_seconds);
|
||||
display_bar(0, DISPLAY_RESY - 2 - 18, DISPLAY_RESX, 2 + 18, COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 2, wait_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_BLACK, 0);
|
||||
}
|
||||
@ -194,12 +194,12 @@ void ui_screen_wipe_progress(int pos, int len)
|
||||
|
||||
// done UI
|
||||
|
||||
void ui_screen_done(int restart)
|
||||
void ui_screen_done(int restart_seconds)
|
||||
{
|
||||
const char *str;
|
||||
if (restart <= 3 && restart >= 1) {
|
||||
if (restart_seconds >= 1) {
|
||||
char count_str[24];
|
||||
mini_snprintf(count_str, sizeof(count_str), "Done! Restarting in %ds", restart);
|
||||
mini_snprintf(count_str, sizeof(count_str), "Done! Restarting in %ds", restart_seconds);
|
||||
str = count_str;
|
||||
} else {
|
||||
str = "Done! Unplug the device.";
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "image.h"
|
||||
|
||||
void ui_screen_boot(const vendor_header * const vhdr, const image_header * const hdr);
|
||||
void ui_screen_boot_wait(int delay);
|
||||
void ui_screen_boot_wait(int wait_seconds);
|
||||
void ui_screen_boot_click(void);
|
||||
|
||||
void ui_screen_first(void);
|
||||
@ -22,7 +22,7 @@ void ui_screen_wipe_confirm(void);
|
||||
void ui_screen_wipe(void);
|
||||
void ui_screen_wipe_progress(int pos, int len);
|
||||
|
||||
void ui_screen_done(int restart);
|
||||
void ui_screen_done(int restart_seconds);
|
||||
|
||||
void ui_screen_fail(void);
|
||||
|
||||
|
@ -128,10 +128,14 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
||||
process_msg_Ping(USB_IFACE_NUM, msg_size, buf);
|
||||
break;
|
||||
case 5: // WipeDevice
|
||||
ui_fadeout();
|
||||
ui_screen_wipe_confirm();
|
||||
ui_fadein();
|
||||
response = ui_button_response();
|
||||
if (sectrue != response) {
|
||||
ui_fadeout();
|
||||
ui_screen_info(secfalse, vhdr, hdr);
|
||||
ui_fadein();
|
||||
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
|
||||
break;
|
||||
}
|
||||
@ -140,12 +144,16 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
||||
ui_fadein();
|
||||
r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf);
|
||||
if (r < 0) { // error
|
||||
ui_fadeout();
|
||||
ui_screen_fail();
|
||||
ui_fadein();
|
||||
usb_stop();
|
||||
usb_deinit();
|
||||
return secfalse; // shutdown
|
||||
} else { // success
|
||||
ui_fadeout();
|
||||
ui_screen_done(0);
|
||||
ui_fadein();
|
||||
usb_stop();
|
||||
usb_deinit();
|
||||
return secfalse; // shutdown
|
||||
@ -154,10 +162,14 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
||||
case 6: // FirmwareErase
|
||||
// skip confirmation when no firmware is present
|
||||
if (vhdr && hdr) {
|
||||
ui_fadeout();
|
||||
ui_screen_install_confirm();
|
||||
ui_fadein();
|
||||
response = ui_button_response();
|
||||
if (sectrue != response) {
|
||||
ui_fadeout();
|
||||
ui_screen_info(secfalse, vhdr, hdr);
|
||||
ui_fadein();
|
||||
send_user_abort(USB_IFACE_NUM, "Firmware install cancelled");
|
||||
break;
|
||||
}
|
||||
@ -170,15 +182,23 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
||||
case 7: // FirmwareUpload
|
||||
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
|
||||
if (r < 0) { // error
|
||||
ui_fadeout();
|
||||
ui_screen_fail();
|
||||
ui_fadein();
|
||||
usb_stop();
|
||||
usb_deinit();
|
||||
return secfalse; // shutdown
|
||||
} else
|
||||
if (r == 0) { // last chunk received
|
||||
ui_screen_done(3); hal_delay(1000);
|
||||
ui_screen_done(2); hal_delay(1000);
|
||||
ui_screen_done(1); hal_delay(1000);
|
||||
ui_fadeout();
|
||||
ui_screen_done(4);
|
||||
ui_fadein();
|
||||
ui_screen_done(3);
|
||||
hal_delay(1000);
|
||||
ui_screen_done(2);
|
||||
hal_delay(1000);
|
||||
ui_screen_done(1);
|
||||
hal_delay(1000);
|
||||
usb_stop();
|
||||
usb_deinit();
|
||||
ui_fadeout();
|
||||
|
Loading…
Reference in New Issue
Block a user