1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

add USB test to SelfTest

This commit is contained in:
Pavol Rusnak 2017-07-10 19:10:25 +02:00
parent f826b1fa46
commit 7ca4b11c3a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -343,6 +343,10 @@ static void hid_rx_callback(usbd_device *dev, uint8_t ep)
} }
if (msg_id == 0x0020) { // SelfTest message (id 32) if (msg_id == 0x0020) { // SelfTest message (id 32)
// USB TEST
bool status_usb = (buf[9] == 0x0a) && (buf[10] == 53) && (0 == memcmp(buf + 11, "\x00\xFF\x55\xAA\x66\x99\x33\xCC" "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!" "\x00\xFF\x55\xAA\x66\x99\x33\xCC", 53));
// CPU TEST // CPU TEST
layoutProgress("TESTING CPU ...", 0); layoutProgress("TESTING CPU ...", 0);
@ -401,7 +405,7 @@ static void hid_rx_callback(usbd_device *dev, uint8_t ep)
bool status_flash = (0 == memcmp(hash, "\x49\x46\xe9\xa5\xf4\xc2\x57\xe9\xcf\xd1\x88\x78\xe9\x66\x9b\x0d\xcd\x4e\x82\x41\xb3\x9c\xee\xb7\x2c\x1d\x14\x4a\xe1\xe4\xcb\xd7", 32)); bool status_flash = (0 == memcmp(hash, "\x49\x46\xe9\xa5\xf4\xc2\x57\xe9\xcf\xd1\x88\x78\xe9\x66\x9b\x0d\xcd\x4e\x82\x41\xb3\x9c\xee\xb7\x2c\x1d\x14\x4a\xe1\xe4\xcb\xd7", 32));
bool status_all = status_cpu && status_flash; bool status_all = status_usb && status_cpu && status_flash;
if (status_all) { if (status_all) {
send_msg_success(dev); send_msg_success(dev);
@ -410,11 +414,11 @@ static void hid_rx_callback(usbd_device *dev, uint8_t ep)
} }
layoutDialog(status_all ? &bmp_icon_info : &bmp_icon_error, layoutDialog(status_all ? &bmp_icon_info : &bmp_icon_error,
NULL, NULL, NULL, NULL, NULL, NULL,
status_usb ? "Test USB ... OK" : "Test USB ... Failed",
status_cpu ? "Test CPU ... OK" : "Test CPU ... Failed", status_cpu ? "Test CPU ... OK" : "Test CPU ... Failed",
status_flash ? "Test FLASH ... OK" : "Test FLASH ... Failed", status_flash ? "Test FLASH ... OK" : "Test FLASH ... Failed",
NULL, NULL,
NULL, NULL,
NULL,
NULL NULL
); );
return; return;