bootloader: small changes to ui, replace vendor string

pull/25/head
Pavol Rusnak 5 years ago
parent 50e0ddb6f8
commit 98ec2f096c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -6,7 +6,6 @@ OBJS += buttons.o
OBJS += layout.o
OBJS += oled.o
OBJS += rng.o
OBJS += serialno.o
ifneq ($(EMULATOR),1)
OBJS += setup.o

@ -31,7 +31,6 @@
#include "util.h"
#include "signatures.h"
#include "layout.h"
#include "serialno.h"
#include "rng.h"
#include "timer.h"
@ -106,18 +105,13 @@ void bootloader_loop(void)
oledClear();
oledDrawBitmap(0, 0, &bmp_logo64);
if (firmware_present()) {
oledDrawString(52, 0, "TREZOR", FONT_STANDARD);
static char serial[25];
fill_serialno_fixed(serial);
oledDrawString(52, 20, "Serial No.", FONT_STANDARD);
oledDrawString(52, 40, serial + 12, FONT_STANDARD); // second part of serial
serial[12] = 0;
oledDrawString(52, 30, serial, FONT_STANDARD); // first part of serial
oledDrawStringRight(OLED_WIDTH - 1, OLED_HEIGHT - 8, "Loader " VERSTR(VERSION_MAJOR) "." VERSTR(VERSION_MINOR) "." VERSTR(VERSION_PATCH), FONT_STANDARD);
oledDrawStringCenter(90, 10, "TREZOR", FONT_STANDARD);
oledDrawStringCenter(90, 30, "Bootloader", FONT_STANDARD);
oledDrawStringCenter(90, 50, VERSTR(VERSION_MAJOR) "." VERSTR(VERSION_MINOR) "." VERSTR(VERSION_PATCH), FONT_STANDARD);
} else {
oledDrawString(52, 10, "Welcome!", FONT_STANDARD);
oledDrawString(52, 30, "Please visit", FONT_STANDARD);
oledDrawString(52, 50, "trezor.io/start", FONT_STANDARD);
oledDrawStringCenter(90, 10, "Welcome!", FONT_STANDARD);
oledDrawStringCenter(90, 30, "Please visit", FONT_STANDARD);
oledDrawStringCenter(90, 50, "trezor.io/start", FONT_STANDARD);
}
oledRefresh();

@ -27,7 +27,6 @@
#include "oled.h"
#include "rng.h"
#include "usb.h"
#include "serialno.h"
#include "layout.h"
#include "util.h"
#include "signatures.h"
@ -174,7 +173,7 @@ static void send_msg_failure(usbd_device *dev)
static void send_msg_features(usbd_device *dev)
{
// response: Features message (id 17), payload len 30
// - vendor = "bitcointrezor.com"
// - vendor = "trezor.io"
// - major_version = VERSION_MAJOR
// - minor_version = VERSION_MINOR
// - patch_version = VERSION_PATCH
@ -188,9 +187,9 @@ static void send_msg_features(usbd_device *dev)
// msg_id
"\x00\x11"
// msg_size
"\x00\x00\x00\x1e"
"\x00\x00\x00\x16"
// data
"\x0a" "\x11" "bitcointrezor.com"
"\x0a" "\x09" "trezor.io"
"\x10" VERSION_MAJOR_CHAR
"\x18" VERSION_MINOR_CHAR
"\x20" VERSION_PATCH_CHAR
@ -198,7 +197,7 @@ static void send_msg_features(usbd_device *dev)
"\x90\x01" "\x00"
"\xaa" "\x01" "1"
// padding
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
, 64) != 64) {}
} else {
while ( usbd_ep_write_packet(dev, ENDPOINT_ADDRESS_IN,
@ -207,9 +206,9 @@ static void send_msg_features(usbd_device *dev)
// msg_id
"\x00\x11"
// msg_size
"\x00\x00\x00\x1e"
"\x00\x00\x00\x16"
// data
"\x0a\x11" "bitcointrezor.com"
"\x0a" "\x09" "trezor.io"
"\x10" VERSION_MAJOR_CHAR
"\x18" VERSION_MINOR_CHAR
"\x20" VERSION_PATCH_CHAR
@ -217,7 +216,7 @@ static void send_msg_features(usbd_device *dev)
"\x90\x01" "\x01"
"\xaa" "\x01" "1"
// padding
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
, 64) != 64) {}
}
}

@ -41,7 +41,7 @@ void fsm_msgGetFeatures(const GetFeatures *msg)
{
(void)msg;
RESP_INIT(Features);
resp->has_vendor = true; strlcpy(resp->vendor, "bitcointrezor.com", sizeof(resp->vendor));
resp->has_vendor = true; strlcpy(resp->vendor, "trezor.io", sizeof(resp->vendor));
resp->has_major_version = true; resp->major_version = VERSION_MAJOR;
resp->has_minor_version = true; resp->minor_version = VERSION_MINOR;
resp->has_patch_version = true; resp->patch_version = VERSION_PATCH;

@ -246,22 +246,22 @@ void layoutHome(void)
} else {
if (label && strlen(label) > 0) {
oledDrawBitmap(44, 4, &bmp_logo48);
oledDrawStringCenter(OLED_HEIGHT - 8, label, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 8, label, FONT_STANDARD);
} else {
oledDrawBitmap(40, 0, &bmp_logo64);
}
}
if (storage_noBackup()) {
oledBox(0, 0, 127, 8, false);
oledDrawStringCenter(0, "SEEDLESS", FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 0, "SEEDLESS", FONT_STANDARD);
} else
if (storage_unfinishedBackup()) {
oledBox(0, 0, 127, 8, false);
oledDrawStringCenter(0, "BACKUP FAILED!", FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 0, "BACKUP FAILED!", FONT_STANDARD);
} else
if (storage_needsBackup()) {
oledBox(0, 0, 127, 8, false);
oledDrawStringCenter(0, "NEEDS BACKUP!", FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 0, "NEEDS BACKUP!", FONT_STANDARD);
}
oledRefresh();

@ -39,7 +39,7 @@ void pinmatrix_draw(const char *text)
// use (2 - j) instead of j to achieve 789456123 layout
int k = pinmatrix_perm[i + (2 - j) * 3] - '0';
if (text) {
oledDrawStringCenter(0, text, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 0, text, FONT_STANDARD);
}
oledDrawBitmap((OLED_WIDTH - 3 * w - 2 * pad) / 2 + i * (w + pad), OLED_HEIGHT - 3 * h - 2 * pad + j * (h + pad), bmp_digits[k]);
}

@ -1870,7 +1870,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2, const cha
// Warnings (drawn centered between the buttons
if (warning) {
oledDrawStringCenter(OLED_HEIGHT - 8, warning, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 8, warning, FONT_STANDARD);
}
// Next / sign button

@ -49,7 +49,7 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, con
if (line3) oledDrawString(left, 2 * 9, line3, FONT_STANDARD);
if (line4) oledDrawString(left, 3 * 9, line4, FONT_STANDARD);
if (desc) {
oledDrawStringCenter(OLED_HEIGHT - 2 * 9 - 1, desc, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1, desc, FONT_STANDARD);
if (btnYes || btnNo) {
oledHLine(OLED_HEIGHT - 21);
}
@ -110,7 +110,7 @@ void layoutProgress(const char *desc, int permil)
// text
oledBox(0, OLED_HEIGHT - 16, OLED_WIDTH - 1, OLED_HEIGHT - 16 + 7, 0);
if (desc) {
oledDrawStringCenter(OLED_HEIGHT - 16, desc, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 16, desc, FONT_STANDARD);
}
oledRefresh();
}

@ -301,9 +301,9 @@ void oledDrawString(int x, int y, const char* text, int font)
}
}
void oledDrawStringCenter(int y, const char* text, int font)
void oledDrawStringCenter(int x, int y, const char* text, int font)
{
int x = ( OLED_WIDTH - oledStringWidth(text, font) ) / 2;
x = x - oledStringWidth(text, font) / 2;
oledDrawString(x, y, text, font);
}

@ -46,7 +46,7 @@ void oledDrawChar(int x, int y, char c, int zoom);
int oledStringWidth(const char *text, int font);
void oledDrawString(int x, int y, const char* text, int font);
void oledDrawStringCenter(int y, const char* text, int font);
void oledDrawStringCenter(int x, int y, const char* text, int font);
void oledDrawStringRight(int x, int y, const char* text, int font);
void oledDrawBitmap(int x, int y, const BITMAP *bmp);
void oledInvert(int x1, int y1, int x2, int y2);

@ -1,36 +0,0 @@
/*
* This file is part of the TREZOR project, https://trezor.io/
*
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <string.h>
#include <libopencm3/stm32/desig.h>
#include "serialno.h"
#include "util.h"
#include "sha2.h"
void fill_serialno_fixed(char *s)
{
uint32_t uuid[8];
desig_get_unique_id(uuid);
sha256_Raw((const uint8_t *)uuid, 12, (uint8_t *)uuid);
sha256_Raw((const uint8_t *)uuid, 32, (uint8_t *)uuid);
data2hex(uuid, 12, s);
}

@ -1,26 +0,0 @@
/*
* This file is part of the TREZOR project, https://trezor.io/
*
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SERIALNO_H__
#define __SERIALNO_H__
// buffer has to be (at least) 25 chars long
void fill_serialno_fixed(char *s);
#endif
Loading…
Cancel
Save