bootloader: show DOM QR code on welcome screen

This commit is contained in:
Pavol Rusnak 2017-10-20 15:59:16 +02:00
parent b544fd3f81
commit 5f256ce0b0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 18 additions and 3 deletions

View File

@ -30,12 +30,14 @@ SOURCE_MOD += [
CPPDEFINES_MOD += [
'TREZOR_FONT_MONO_DISABLE',
'TREZOR_FONT_NORMAL_DISABLE',
('QR_MAX_VERSION', '0'),
]
SOURCE_MOD += [
'embed/extmod/modtrezorui/display.c',
'embed/extmod/modtrezorui/inflate.c',
'embed/extmod/modtrezorui/font_bitmap.c',
'embed/extmod/modtrezorui/font_roboto_bold_20.c',
'embed/extmod/modtrezorui/trezor-qrenc/qr_encode.c',
]
SOURCE_STMHAL = [

View File

@ -66,6 +66,21 @@ void display_error(void)
display_footer("Error! Unplug the device", COLOR_BL_RED);
}
void display_welcome(void)
{
display_clear();
display_header("TREZOR Bootloader");
uint8_t dom[32];
// format: TREZOR2-YYMMDD
if (flash_otp_read(0, 0, dom, 32) && 0 == memcmp(dom, "TREZOR2-", 8) && dom[14] == 0) {
display_qrcode(120, 120, (const char *)dom, 14, 4);
display_text_center(120, 210, (const char *)dom, 14, FONT_BOLD, COLOR_WHITE, COLOR_BLACK);
}
display_fade(0, BACKLIGHT_NORMAL, 1000);
}
void display_vendor(const uint8_t *vimg, const char *vstr, uint32_t vstr_len, uint32_t fw_version)
{
display_clear();
@ -155,9 +170,7 @@ bool bootloader_loop(void)
{
usb_init_all();
display_clear();
display_header("TREZOR Bootloader");
display_fade(0, BACKLIGHT_NORMAL, 1000);
display_welcome();
uint8_t buf[USB_PACKET_SIZE];