|
|
|
@ -128,10 +128,14 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|
|
|
|
process_msg_Ping(USB_IFACE_NUM, msg_size, buf);
|
|
|
|
|
break;
|
|
|
|
|
case 5: // WipeDevice
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_wipe_confirm();
|
|
|
|
|
ui_fadein();
|
|
|
|
|
response = ui_button_response();
|
|
|
|
|
if (sectrue != response) {
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_info(secfalse, vhdr, hdr);
|
|
|
|
|
ui_fadein();
|
|
|
|
|
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -140,12 +144,16 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|
|
|
|
ui_fadein();
|
|
|
|
|
r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf);
|
|
|
|
|
if (r < 0) { // error
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_fail();
|
|
|
|
|
ui_fadein();
|
|
|
|
|
usb_stop();
|
|
|
|
|
usb_deinit();
|
|
|
|
|
return secfalse; // shutdown
|
|
|
|
|
} else { // success
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_done(0);
|
|
|
|
|
ui_fadein();
|
|
|
|
|
usb_stop();
|
|
|
|
|
usb_deinit();
|
|
|
|
|
return secfalse; // shutdown
|
|
|
|
@ -154,10 +162,14 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|
|
|
|
case 6: // FirmwareErase
|
|
|
|
|
// skip confirmation when no firmware is present
|
|
|
|
|
if (vhdr && hdr) {
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_install_confirm();
|
|
|
|
|
ui_fadein();
|
|
|
|
|
response = ui_button_response();
|
|
|
|
|
if (sectrue != response) {
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_info(secfalse, vhdr, hdr);
|
|
|
|
|
ui_fadein();
|
|
|
|
|
send_user_abort(USB_IFACE_NUM, "Firmware install cancelled");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -170,15 +182,23 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|
|
|
|
case 7: // FirmwareUpload
|
|
|
|
|
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
|
|
|
|
|
if (r < 0) { // error
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_fail();
|
|
|
|
|
ui_fadein();
|
|
|
|
|
usb_stop();
|
|
|
|
|
usb_deinit();
|
|
|
|
|
return secfalse; // shutdown
|
|
|
|
|
} else
|
|
|
|
|
if (r == 0) { // last chunk received
|
|
|
|
|
ui_screen_done(3); hal_delay(1000);
|
|
|
|
|
ui_screen_done(2); hal_delay(1000);
|
|
|
|
|
ui_screen_done(1); hal_delay(1000);
|
|
|
|
|
ui_fadeout();
|
|
|
|
|
ui_screen_done(4);
|
|
|
|
|
ui_fadein();
|
|
|
|
|
ui_screen_done(3);
|
|
|
|
|
hal_delay(1000);
|
|
|
|
|
ui_screen_done(2);
|
|
|
|
|
hal_delay(1000);
|
|
|
|
|
ui_screen_done(1);
|
|
|
|
|
hal_delay(1000);
|
|
|
|
|
usb_stop();
|
|
|
|
|
usb_deinit();
|
|
|
|
|
ui_fadeout();
|
|
|
|
|