mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
bootloader: rework onboarding
This commit is contained in:
parent
2e00c090b6
commit
5538614a79
@ -15,6 +15,10 @@
|
||||
#include "icon_install.h"
|
||||
#include "icon_wipe.h"
|
||||
|
||||
#include "icon_logo.h"
|
||||
#include "icon_safeplace.h"
|
||||
#include "icon_welcome.h"
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
#define COLOR_BL_FAIL RGB16(0xFF, 0x00, 0x00) // red
|
||||
@ -50,7 +54,6 @@ void ui_screen_boot(const vendor_header *vhdr, const image_header *hdr)
|
||||
(int)((fw_version >> 24) & 0xFF)
|
||||
);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 25, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, background, 0);
|
||||
ui_fadein();
|
||||
}
|
||||
|
||||
void ui_screen_boot_wait(int delay)
|
||||
@ -68,9 +71,26 @@ void ui_screen_boot_click(void) {
|
||||
|
||||
// info UI
|
||||
|
||||
void ui_screen_first(void)
|
||||
{
|
||||
display_icon(0, 0, 240, 240, toi_icon_logo + 12, sizeof(toi_icon_logo) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_second(void)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_icon((DISPLAY_RESX - 200) / 2, (DISPLAY_RESY - 60) / 2, 200, 60, toi_icon_safeplace + 12, sizeof(toi_icon_safeplace) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_third(void)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2, 180, 30, toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 213, "Open trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
}
|
||||
|
||||
void ui_screen_info(secbool buttons, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
display_backlight(0);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Bootloader mode", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
@ -103,9 +123,8 @@ void ui_screen_info(secbool buttons, const vendor_header * const vhdr, const ima
|
||||
display_bar_radius(123, 184, 108, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
display_icon(123 + (108 - 19) / 2, 184 + (50 - 16) / 2, 20, 16, toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12, COLOR_WHITE, COLOR_BL_DONE);
|
||||
} else {
|
||||
display_text_center(120, 213, "Go to trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(120, 213, "Open trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
}
|
||||
ui_fadein();
|
||||
}
|
||||
|
||||
// install UI
|
||||
@ -117,7 +136,7 @@ void ui_screen_install_confirm(void)
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 95, "update the firmware?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 95, "update firmware?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
|
||||
display_bar_radius(9, 184, 108, 50, COLOR_BL_FAIL, COLOR_WHITE, 4);
|
||||
display_icon(9 + (108 - 16) / 2, 184 + (50 - 16) / 2, 16, 16, toi_icon_cancel + 12, sizeof(toi_icon_cancel) - 12, COLOR_WHITE, COLOR_BL_FAIL);
|
||||
|
@ -8,6 +8,9 @@ void ui_screen_boot(const vendor_header * const vhdr, const image_header * const
|
||||
void ui_screen_boot_wait(int delay);
|
||||
void ui_screen_boot_click(void);
|
||||
|
||||
void ui_screen_first(void);
|
||||
void ui_screen_second(void);
|
||||
void ui_screen_third(void);
|
||||
void ui_screen_info(secbool buttons, const vendor_header * const vhdr, const image_header * const hdr);
|
||||
|
||||
void ui_screen_install_confirm(void);
|
||||
|
10
embed/bootloader/icon_logo.h
Normal file
10
embed/bootloader/icon_logo.h
Normal file
File diff suppressed because one or more lines are too long
10
embed/bootloader/icon_safeplace.h
Normal file
10
embed/bootloader/icon_safeplace.h
Normal file
File diff suppressed because one or more lines are too long
10
embed/bootloader/icon_welcome.h
Normal file
10
embed/bootloader/icon_welcome.h
Normal file
@ -0,0 +1,10 @@
|
||||
static const uint8_t toi_icon_welcome[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0xb4, 0x00, 0x1e, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x31, 0x03, 0x00, 0x00,
|
||||
// compressed data
|
||||
0xc5, 0x52, 0x3d, 0x53, 0x13, 0x51, 0x14, 0xbd, 0x01, 0x24, 0x42, 0x20, 0xa1, 0x56, 0x07, 0xe8, 0x9c, 0xf1, 0x63, 0x42, 0xa9, 0x33, 0xce, 0x40, 0x8b, 0x85, 0xf0, 0x0f, 0x42, 0x45, 0x9b, 0xd8, 0x21, 0xe3, 0x0c, 0x58, 0x51, 0x39, 0xa1, 0xb3, 0x33, 0xf9, 0x07, 0xf1, 0x17, 0x88, 0x76, 0xb1, 0x11, 0x28, 0x2c, 0x6c, 0x08, 0xd2, 0xa1, 0x33, 0x2e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xa5, 0xc5, 0x2c, 0xd3, 0x5b, 0x7e, 0x75, 0xdc, 0x0e, 0x9e, 0x6e, 0xf9, 0xdf, 0xa7, 0xe4, 0x2a, 0xe6, 0x10, 0x13, 0x4c, 0xf0, 0x0f,
|
||||
};
|
@ -150,12 +150,15 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
||||
}
|
||||
break;
|
||||
case 6: // FirmwareErase
|
||||
ui_screen_install_confirm();
|
||||
response = ui_button_response();
|
||||
if (sectrue != response) {
|
||||
ui_screen_info(secfalse, vhdr, hdr);
|
||||
send_user_abort(USB_IFACE_NUM, "Firmware install cancelled");
|
||||
break;
|
||||
// skip confirmation when no firmware is present
|
||||
if (vhdr && hdr) {
|
||||
ui_screen_install_confirm();
|
||||
response = ui_button_response();
|
||||
if (sectrue != response) {
|
||||
ui_screen_info(secfalse, vhdr, hdr);
|
||||
send_user_abort(USB_IFACE_NUM, "Firmware install cancelled");
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui_screen_install();
|
||||
process_msg_FirmwareErase(USB_IFACE_NUM, msg_size, buf);
|
||||
@ -258,18 +261,35 @@ main_start:
|
||||
firmware_present = load_image_header((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen), FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE, vhdr.vsig_m, vhdr.vsig_n, vhdr.vpub, &hdr);
|
||||
}
|
||||
|
||||
const vendor_header * const pvhdr = (sectrue == firmware_present) ? &vhdr : NULL;
|
||||
const image_header * const phdr = (sectrue == firmware_present) ? &hdr : NULL;
|
||||
if (firmware_present != sectrue) {
|
||||
ui_screen_first();
|
||||
ui_fadein();
|
||||
hal_delay(1000);
|
||||
ui_fadeout();
|
||||
|
||||
if (touched || firmware_present != sectrue) {
|
||||
ui_screen_info(sectrue, pvhdr, phdr);
|
||||
ui_screen_second();
|
||||
ui_fadein();
|
||||
hal_delay(1000);
|
||||
ui_fadeout();
|
||||
|
||||
ui_screen_third();
|
||||
ui_fadein();
|
||||
|
||||
if (bootloader_usb_loop(NULL, NULL) != sectrue) {
|
||||
return 1;
|
||||
}
|
||||
} else
|
||||
if (touched) {
|
||||
ui_screen_info(sectrue, &vhdr, &hdr);
|
||||
ui_fadein();
|
||||
secbool response = ui_button_response();
|
||||
ui_fadeout();
|
||||
if (sectrue != response) {
|
||||
goto main_start;
|
||||
}
|
||||
ui_screen_info(secfalse, pvhdr, phdr);
|
||||
if (bootloader_usb_loop(pvhdr, phdr) != sectrue) {
|
||||
ui_screen_info(secfalse, &vhdr, &hdr);
|
||||
ui_fadein();
|
||||
if (bootloader_usb_loop(&vhdr, &hdr) != sectrue) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -295,6 +315,7 @@ main_start:
|
||||
if ((vhdr.vtrust & VTRUST_ALL) != VTRUST_ALL) {
|
||||
|
||||
ui_screen_boot(&vhdr, &hdr);
|
||||
ui_fadein();
|
||||
|
||||
int delay = (vhdr.vtrust & VTRUST_WAIT) ^ VTRUST_WAIT;
|
||||
while (delay > 0) {
|
||||
|
@ -21,7 +21,7 @@ async def display_homescreen():
|
||||
from apps.common import storage
|
||||
|
||||
if not storage.is_initialized():
|
||||
label = 'Go to trezor.io/start'
|
||||
label = 'Open trezor.io/start'
|
||||
image = None
|
||||
else:
|
||||
label = storage.get_label() or 'My TREZOR'
|
||||
|
Loading…
Reference in New Issue
Block a user