bootloader: add "connect to host" screen

pull/25/head
Pavol Rusnak 6 years ago
parent 8ef2098763
commit ae94bc95fb
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -6,8 +6,9 @@
#include "bootui.h"
#include "version.h"
#include "icon_cancel.h"
#include "icon_confirm.h"
#include "icon_info.h"
#include "icon_done.h"
#include "icon_fail.h"
#include "icon_install.h"
@ -66,7 +67,7 @@ void ui_screen_boot_click(void) {
// info UI
void ui_screen_info(const vendor_header * const vhdr, const image_header * const hdr)
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);
@ -92,6 +93,15 @@ void ui_screen_info(const vendor_header * const vhdr, const image_header * const
display_text(55, 120, (const char *)vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
} else {
display_text(55, 95, "No Firmware", -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
}
if (sectrue == buttons) {
display_text_center(120, 164, "Connect to host?", -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);
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);
}
ui_fadein();

@ -8,7 +8,7 @@ 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_info(const vendor_header * const vhdr, const image_header * const hdr);
void ui_screen_info(secbool buttons, const vendor_header * const vhdr, const image_header * const hdr);
void ui_screen_install(void);
void ui_screen_install_progress_erase(int pos, int len);

@ -0,0 +1,10 @@
static const uint8_t toi_icon_cancel[] = {
// magic
'T', 'O', 'I', 'g',
// width (16-bit), height (16-bit)
0x10, 0x00, 0x10, 0x00,
// compressed data length (32-bit)
0x52, 0x00, 0x00, 0x00,
// compressed data
0x45, 0x4d, 0xc1, 0x09, 0x80, 0x30, 0x10, 0x4b, 0xeb, 0x02, 0x5d, 0x40, 0xb8, 0x01, 0x2c, 0xb8, 0xff, 0x47, 0x70, 0x81, 0xa2, 0x0b, 0x74, 0x10, 0x7b, 0xc4, 0x48, 0x5b, 0x0c, 0x1c, 0x09, 0xe1, 0x92, 0x60, 0x4b, 0x40, 0x38, 0x11, 0xeb, 0x0d, 0x64, 0xb7, 0x4c, 0xb7, 0x58, 0x79, 0x1f, 0xe4, 0xb5, 0x92, 0x8f, 0xce, 0xab, 0x74, 0x2c, 0x14, 0x9a, 0x21, 0x7f, 0xac, 0xdf, 0x20, 0xd7, 0xd3, 0xcf, 0xc3, 0x57, 0x56, 0x70, 0x9b, 0xb9, 0xd2, 0x7b, 0xda, 0xec, 0x5d, 0xfa, 0xce, 0x8e, 0xb1, 0xfb, 0x02,
};

@ -0,0 +1,10 @@
static const uint8_t toi_icon_confirm[] = {
// magic
'T', 'O', 'I', 'g',
// width (16-bit), height (16-bit)
0x14, 0x00, 0x10, 0x00,
// compressed data length (32-bit)
0x69, 0x00, 0x00, 0x00,
// compressed data
0x63, 0x60, 0x80, 0x80, 0xa9, 0x50, 0x9a, 0x81, 0xf3, 0x7f, 0x00, 0x94, 0xd5, 0xff, 0xff, 0x2b, 0x84, 0xc1, 0xf1, 0xff, 0xff, 0x2f, 0x08, 0xab, 0xfe, 0xff, 0xff, 0x0d, 0x60, 0x06, 0xfb, 0xff, 0xff, 0xbf, 0x19, 0x18, 0x58, 0x26, 0x30, 0x30, 0xe4, 0x83, 0x85, 0xfc, 0x7f, 0x32, 0xb0, 0x01, 0x85, 0x04, 0x18, 0x58, 0xfe, 0xff, 0x6f, 0xcc, 0xfb, 0xff, 0x7f, 0x23, 0x03, 0x03, 0x17, 0x90, 0xff, 0x1e, 0x24, 0xc4, 0xc0, 0xb8, 0xff, 0x3f, 0x10, 0x6c, 0x02, 0xe9, 0x93, 0x06, 0x32, 0x7e, 0x2b, 0x80, 0x58, 0x20, 0xc1, 0x43, 0x10, 0x53, 0xb5, 0xff, 0xff, 0x31, 0x80, 0xb0, 0x98, 0xf6, 0x1f, 0x86, 0xb9, 0xc3, 0xca, 0x01, 0x4c, 0x01, 0x00,
};

@ -216,6 +216,7 @@ static void check_bootloader_version(void)
int main(void)
{
main_start:
#if PRODUCTION
check_bootloader_version();
#endif
@ -246,7 +247,23 @@ int main(void)
const image_header * const phdr = (sectrue == firmware_present) ? &hdr : NULL;
if (touched || firmware_present != sectrue) {
ui_screen_info(pvhdr, phdr);
ui_screen_info(sectrue, pvhdr, phdr);
for (;;) {
uint32_t evt = touch_click();
uint16_t x = touch_get_x(evt);
uint16_t y = touch_get_y(evt);
// clicked on cancel button
if (x >= 9 && x < 9 + 108 && y > 184 && y < 184 + 50) {
ui_fadeout();
goto main_start;
}
// clicked on confirm button
if (x >= 123 && x < 123 + 108 && y > 184 && y < 184 + 50) {
ui_fadeout();
break;
}
}
ui_screen_info(secfalse, pvhdr, phdr);
if (bootloader_usb_loop(pvhdr, phdr) != sectrue) {
return 1;
}

Loading…
Cancel
Save