legacy/bootloader: refactor show_unplug

pull/748/head
Pavol Rusnak 5 years ago
parent f86ac65ad1
commit 86b7813629
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -57,6 +57,11 @@ void show_halt(const char *line1, const char *line2) {
shutdown(); shutdown();
} }
void show_unplug(const char *line1, const char *line2) {
layoutDialog(&bmp_icon_ok, NULL, NULL, NULL, line1, line2, NULL,
"You may now", "unplug your Trezor.", NULL);
}
static void show_unofficial_warning(const uint8_t *hash) { static void show_unofficial_warning(const uint8_t *hash) {
layoutDialog(&bmp_icon_warning, "Abort", "I'll take the risk", NULL, layoutDialog(&bmp_icon_warning, "Abort", "I'll take the risk", NULL,
"WARNING!", NULL, "Unofficial firmware", "detected.", NULL, "WARNING!", NULL, "Unofficial firmware", "detected.", NULL,

@ -29,6 +29,7 @@
#include <stdint.h> #include <stdint.h>
void show_halt(const char *line1, const char *line2); void show_halt(const char *line1, const char *line2);
void show_unplug(const char *line1, const char *line2);
void layoutFirmwareFingerprint(const uint8_t *hash); void layoutFirmwareFingerprint(const uint8_t *hash);
bool get_button_response(void); bool get_button_response(void);

@ -201,15 +201,11 @@ static void rx_callback(usbd_device *dev, uint8_t ep) {
if (but) { if (but) {
erase_storage_code_progress(); erase_storage_code_progress();
flash_state = STATE_END; flash_state = STATE_END;
layoutDialog(&bmp_icon_ok, NULL, NULL, NULL, "Device", show_unplug("Device", "successfully wiped.");
"successfully wiped.", NULL, "You may now",
"unplug your Trezor.", NULL);
send_msg_success(dev); send_msg_success(dev);
} else { } else {
flash_state = STATE_END; flash_state = STATE_END;
layoutDialog(&bmp_icon_warning, NULL, NULL, NULL, "Device wipe", show_unplug("Device wipe", "aborted.");
"aborted.", NULL, "You may now", "unplug your Trezor.",
NULL);
send_msg_failure(dev); send_msg_failure(dev);
} }
return; return;
@ -245,9 +241,7 @@ static void rx_callback(usbd_device *dev, uint8_t ep) {
} else { } else {
send_msg_failure(dev); send_msg_failure(dev);
flash_state = STATE_END; flash_state = STATE_END;
layoutDialog(&bmp_icon_warning, NULL, NULL, NULL, show_unplug("Firmware installation", "aborted.");
"Firmware installation", "aborted.", NULL, "You may now",
"unplug your Trezor.", NULL);
} }
return; return;
} }
@ -421,9 +415,7 @@ static void rx_callback(usbd_device *dev, uint8_t ep) {
flash_state = STATE_END; flash_state = STATE_END;
if (hash_check_ok) { if (hash_check_ok) {
layoutDialog(&bmp_icon_ok, NULL, NULL, NULL, "New firmware", show_unplug("New firmware", "successfully installed.");
"successfully installed.", NULL, "You may now",
"unplug your Trezor.", NULL);
send_msg_success(dev); send_msg_success(dev);
shutdown(); shutdown();
} else { } else {

Loading…
Cancel
Save