Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add device ID to prodtest #4735

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

TychoVrahe
Copy link
Contributor

@TychoVrahe TychoVrahe commented Mar 5, 2025

This PR adds device ID storing capability - OTP block is allocated and commands for writing and reading device ID are added to prodtest.

The QR code in prodtest is altered to show device ID instead of batch.

@TychoVrahe TychoVrahe self-assigned this Mar 5, 2025
Copy link

github-actions bot commented Mar 5, 2025

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@TychoVrahe TychoVrahe force-pushed the tychovrahe/prodtest/device_id branch from 287d44d to 2330174 Compare March 5, 2025 09:38
@TychoVrahe TychoVrahe marked this pull request as ready for review March 5, 2025 10:28
@TychoVrahe TychoVrahe requested a review from prusnak as a code owner March 5, 2025 10:28
@TychoVrahe TychoVrahe requested review from cepetr and removed request for prusnak March 5, 2025 10:28
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this version that uses fewer hardcoded constants and modified condition for detection whether the block is programmed or not:

char device_id[FLASH_OTP_BLOCK_SIZE];

if ((sectrue == flash_otp_read(FLASH_OTP_BLOCK_DEVICE_ID, 0,
                                 (uint8_t *)device_id, sizeof(device_id)) &&
                                 (device_id[0] != 0xFF)) {
    screen_prodtest_info(device_id, strnlen(device_id, sizeof(device_id) - 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) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we show batch id as before if the device id is not present?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

2 participants