diff --git a/core/embed/projects/prodtest/.changelog.d/4735.changed b/core/embed/projects/prodtest/.changelog.d/4735.changed new file mode 100644 index 0000000000..af03c98049 --- /dev/null +++ b/core/embed/projects/prodtest/.changelog.d/4735.changed @@ -0,0 +1 @@ +Show device ID in protest QR code. diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c index d40a3383d2..7e4abee60a 100644 --- a/core/embed/projects/prodtest/main.c +++ b/core/embed/projects/prodtest/main.c @@ -165,13 +165,11 @@ static void usb_init_all(void) { } static void show_welcome_screen(void) { - char dom[32] = {0}; - // format: {MODEL_IDENTIFIER}YYMMDD - if ((sectrue == - flash_otp_read(FLASH_OTP_BLOCK_BATCH, 0, (uint8_t *)dom, 32) && - dom[31] == 0 && cstr_starts_with(dom, MODEL_IDENTIFIER))) { - screen_prodtest_info(dom, strlen(dom), dom + sizeof(MODEL_IDENTIFIER) - 1, - strlen(dom) - sizeof(MODEL_IDENTIFIER) + 1); + char device_id[32] = {0}; + if ((sectrue == flash_otp_read(FLASH_OTP_BLOCK_DEVICE_ID, 0, + (uint8_t *)device_id, 32) && + device_id[31] == 0)) { + screen_prodtest_info(device_id, strlen(device_id)); } else { screen_prodtest_welcome(); } diff --git a/core/embed/rust/rust_ui_prodtest.h b/core/embed/rust/rust_ui_prodtest.h index 72e960a824..d53ab1fbb6 100644 --- a/core/embed/rust/rust_ui_prodtest.h +++ b/core/embed/rust/rust_ui_prodtest.h @@ -1,7 +1,6 @@ #include -void screen_prodtest_info(char* id, uint8_t id_len, char* date, - uint8_t date_len); +void screen_prodtest_info(char* id, uint8_t id_len); void screen_prodtest_welcome(void); diff --git a/core/embed/rust/src/ui/api/prodtest_c.rs b/core/embed/rust/src/ui/api/prodtest_c.rs index 2faf792389..3a223defda 100644 --- a/core/embed/rust/src/ui/api/prodtest_c.rs +++ b/core/embed/rust/src/ui/api/prodtest_c.rs @@ -15,16 +15,10 @@ extern "C" fn screen_prodtest_welcome() { } #[no_mangle] -extern "C" fn screen_prodtest_info( - id: *const cty::c_char, - id_len: u8, - date: *const cty::c_char, - date_len: u8, -) { +extern "C" fn screen_prodtest_info(id: *const cty::c_char, id_len: u8) { let id = unwrap!(unsafe { from_c_array(id, id_len as usize) }); - let date = unwrap!(unsafe { from_c_array(date, date_len as usize) }); - ModelUI::screen_prodtest_info(id, date); + ModelUI::screen_prodtest_info(id); } #[no_mangle] diff --git a/core/embed/rust/src/ui/layout_bolt/prodtest/mod.rs b/core/embed/rust/src/ui/layout_bolt/prodtest/mod.rs index 4870c7a24e..7e8eb83ec7 100644 --- a/core/embed/rust/src/ui/layout_bolt/prodtest/mod.rs +++ b/core/embed/rust/src/ui/layout_bolt/prodtest/mod.rs @@ -31,7 +31,7 @@ impl ProdtestUI for UIBolt { display::fade_backlight_duration(theme::backlight::get_backlight_normal(), 150); } - fn screen_prodtest_info(id: &str, date: &str) { + fn screen_prodtest_info(id: &str) { display::sync(); let qr = Qr::new(id, true); let mut qr = unwrap!(qr).with_border(4); @@ -50,7 +50,7 @@ impl ProdtestUI for UIBolt { shape::Text::new( screen().bottom_center() - Offset::y(10), - date, + id, fonts::FONT_BOLD_UPPER, ) .with_fg(Color::white()) diff --git a/core/embed/rust/src/ui/layout_caesar/prodtest/mod.rs b/core/embed/rust/src/ui/layout_caesar/prodtest/mod.rs index ef2831f954..d0f1ddbb40 100644 --- a/core/embed/rust/src/ui/layout_caesar/prodtest/mod.rs +++ b/core/embed/rust/src/ui/layout_caesar/prodtest/mod.rs @@ -29,7 +29,7 @@ impl ProdtestUI for UICaesar { display::refresh(); } - fn screen_prodtest_info(id: &str, date: &str) { + fn screen_prodtest_info(id: &str) { display::sync(); let qr = Qr::new(id, true); let mut qr = unwrap!(qr).with_border(1); @@ -43,7 +43,7 @@ impl ProdtestUI for UICaesar { render_on_display(None, Some(Color::black()), |target| { qr.render(target); - shape::Text::new(screen().bottom_center(), date, fonts::FONT_BOLD_UPPER) + shape::Text::new(screen().bottom_center(), id, fonts::FONT_BOLD_UPPER) .with_fg(Color::white()) .with_align(Alignment::Center) .render(target); diff --git a/core/embed/rust/src/ui/ui_prodtest.rs b/core/embed/rust/src/ui/ui_prodtest.rs index 73a5cf8c97..2300a6ed81 100644 --- a/core/embed/rust/src/ui/ui_prodtest.rs +++ b/core/embed/rust/src/ui/ui_prodtest.rs @@ -7,7 +7,7 @@ use heapless::Vec; pub trait ProdtestUI { fn screen_prodtest_welcome(); - fn screen_prodtest_info(id: &str, date: &str); + fn screen_prodtest_info(id: &str); fn screen_prodtest_show_text(text: &str);