feat(core): Rename otp-device-id-write to otp-device-sn-write.
What changed, and why it matters
This commit is a simple renaming from 'device ID' to 'device serial number' across labels, command names, comments, and a constant. There is no functional code change and no security relevance.
No security action needed; this is a non-functional rename.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change renames the OTP block constant FLASH_OTP_BLOCK_DEVICE_ID to FLASH_OTP_BLOCK_DEVICE_SN and updates the prodtest CLI commands from otp-device-id-read/write to otp-device-sn-read/write, along with matching string messages and documentation. The underlying logic (which OTP block is read/written, pairing lock check, homescreen display) remains identical.
Changed components
core/embed/models/otp_layout.hcore/embed/projects/prodtest/cmd/prodtest_nrf.ccore/embed/projects/prodtest/cmd/prodtest_otp_batch.ccore/embed/projects/prodtest/main.ccore/embed/projects/prodtest/README.mdcore/embed/projects/prodtest/.changelog.d/+device_sn.changedInspect captured patch +34 / −30
diff --git a/core/embed/models/otp_layout.h b/core/embed/models/otp_layout.h
index 4faa4d5c6..cd299c6bc 100644
--- a/core/embed/models/otp_layout.h
+++ b/core/embed/models/otp_layout.h
@@ -26,4 +26,4 @@
#define FLASH_OTP_BLOCK_RANDOMNESS 3
#define FLASH_OTP_BLOCK_DEVICE_VARIANT 4
#define FLASH_OTP_BLOCK_FIRMWARE_VERSION 5
-#define FLASH_OTP_BLOCK_DEVICE_ID 6
+#define FLASH_OTP_BLOCK_DEVICE_SN 6
diff --git a/core/embed/projects/prodtest/.changelog.d/+device_sn.changed b/core/embed/projects/prodtest/.changelog.d/+device_sn.changed
new file mode 100644
index 000000000..5380fb79f
--- /dev/null
+++ b/core/embed/projects/prodtest/.changelog.d/+device_sn.changed
@@ -0,0 +1 @@
+Rename otp-device-id-write to otp-device-sn-write.
diff --git a/core/embed/projects/prodtest/README.md b/core/embed/projects/prodtest/README.md
index 26253eef0..ce95959a8 100644
--- a/core/embed/projects/prodtest/README.md
+++ b/core/embed/projects/prodtest/README.md
@@ -339,7 +339,7 @@ Updates the nRF firmware. Use `core/tools/bin_update.py` script to update the nR
### nrf-pair
Writes the pairing secret to the nRF chip to pair it with the MCU.
The command `secrets-init` must be executed before calling this command.
-Pairing needs to be done before writing device ID in the OTP memory and before locking the Optiga chip.
+Pairing needs to be done before writing device serial number in the OTP memory and before locking the Optiga chip.
Example:
```
@@ -544,40 +544,42 @@ otp-batch-write T2B1-231231 --dry-run
# !!! It's a dry run, OTP will be left unchanged.
# !!! Use '--execute' switch to write to OTP memory.
#
-# Writing device batch info into OTP memory...
+# Writing info into OTP memory...
# Bytes written: 543242312D323331323331000000000000000000000000000000000000000000
# Locking OTP block...
```
-### otp-device-id-read
-Retrieves the device ID string from the device's OTP memory. The device ID string is unique for each device.
+### otp-device-sn-read
+Retrieves the device's serial number from the device's OTP memory. The device serial number is unique for each device.
+A QR code with the serial number is displayed on the prodtest screen and printed on the packaging.
If the OTP memory has not been written yet, it returns error code `no-data`.
Example:
```
-otp-device-id-read
+otp-device-sn-read
# Reading device OTP memory...
# Bytes read: <hexadecimal string>
ERROR no-data "OTP block is empty."
```
-### otp-device-id-write
-Writes the device ID string to the device's OTP memory. The device ID string is unique for each device.
+### otp-device-sn-write
+Writes the device serial number to the device's OTP memory. The device serial number is unique for each device.
+A QR code with the serial number is displayed on the prodtest screen and printed on the packaging.
-The batch string can be up to 31 characters in length.
+The serial number can be up to 31 characters in length.
In non-production firmware, you must include `--execute` as the last parameter to write the data to the OTP memory. Conversely, in production firmware, you can use `--dry-run` as the last parameter to simulate the command without actually writing to the OTP memory.
Example:
```
-otp-device-id-write 123456ABCD --dry-run
+otp-device-sn-write 123456ABCD --dry-run
#
# !!! It's a dry run, OTP will be left unchanged.
# !!! Use '--execute' switch to write to OTP memory.
#
-# Writing device batch info into OTP memory...
+# Writing info into OTP memory...
# Bytes written: 3132333435364142434400000000000000000000000000000000000000000000
# Locking OTP block...
```
diff --git a/core/embed/projects/prodtest/cmd/prodtest_nrf.c b/core/embed/projects/prodtest/cmd/prodtest_nrf.c
index f2999f625..82b563f99 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_nrf.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_nrf.c
@@ -94,9 +94,10 @@ static void prodtest_nrf_pair(cli_t* cli) {
return;
}
- if (secfalse != flash_otp_is_locked(FLASH_OTP_BLOCK_DEVICE_ID)) {
- cli_error(cli, CLI_ERROR,
- "OTP Device ID block is locked. Pairing is not allowed.");
+ if (secfalse != flash_otp_is_locked(FLASH_OTP_BLOCK_DEVICE_SN)) {
+ cli_error(
+ cli, CLI_ERROR,
+ "OTP Device serial number block is locked. Pairing is not allowed.");
}
if (nrf_test_pair()) {
diff --git a/core/embed/projects/prodtest/cmd/prodtest_otp_batch.c b/core/embed/projects/prodtest/cmd/prodtest_otp_batch.c
index a762baa46..190cd498e 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_otp_batch.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_otp_batch.c
@@ -147,12 +147,12 @@ static void prodtest_otp_batch_write(cli_t* cli) {
prodtest_otp_write(cli, FLASH_OTP_BLOCK_BATCH);
}
-static void prodtest_otp_device_id_read(cli_t* cli) {
- prodtest_otp_read(cli, FLASH_OTP_BLOCK_DEVICE_ID);
+static void prodtest_otp_device_sn_read(cli_t* cli) {
+ prodtest_otp_read(cli, FLASH_OTP_BLOCK_DEVICE_SN);
}
-static void prodtest_otp_device_id_write(cli_t* cli) {
- prodtest_otp_write(cli, FLASH_OTP_BLOCK_DEVICE_ID);
+static void prodtest_otp_device_sn_write(cli_t* cli) {
+ prodtest_otp_write(cli, FLASH_OTP_BLOCK_DEVICE_SN);
}
// clang-format off
@@ -172,15 +172,15 @@ PRODTEST_CLI_CMD(
);
PRODTEST_CLI_CMD(
- .name = "otp-device-id-read",
- .func = prodtest_otp_device_id_read,
- .info = "Read the device ID from OTP memory",
+ .name = "otp-device-sn-read",
+ .func = prodtest_otp_device_sn_read,
+ .info = "Read the device serial number from OTP memory",
.args = ""
);
PRODTEST_CLI_CMD(
- .name = "otp-device-id-write",
- .func = prodtest_otp_device_id_write,
- .info = "Write the device ID into OTP memory",
+ .name = "otp-device-sn-write",
+ .func = prodtest_otp_device_sn_write,
+ .info = "Write the device serial number into OTP memory",
.args = "<text> [--execute | --dry-run]"
);
diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c
index e6184f387..90e9abd0f 100644
--- a/core/embed/projects/prodtest/main.c
+++ b/core/embed/projects/prodtest/main.c
@@ -258,13 +258,13 @@ void prodtest_show_homescreen(void) {
memset(&g_layout, 0, sizeof(g_layout));
g_layout.set = true;
- static char device_id[FLASH_OTP_BLOCK_SIZE] = {0};
+ static char device_sn[FLASH_OTP_BLOCK_SIZE] = {0};
- if (sectrue == flash_otp_read(FLASH_OTP_BLOCK_DEVICE_ID, 0,
- (uint8_t *)device_id, sizeof(device_id)) &&
- (device_id[0] != 0xFF)) {
- screen_prodtest_welcome(&g_layout.layout, device_id,
- strnlen(device_id, sizeof(device_id) - 1));
+ if (sectrue == flash_otp_read(FLASH_OTP_BLOCK_DEVICE_SN, 0,
+ (uint8_t *)device_sn, sizeof(device_sn)) &&
+ (device_sn[0] != 0xFF)) {
+ screen_prodtest_welcome(&g_layout.layout, device_sn,
+ strnlen(device_sn, sizeof(device_sn) - 1));
} else {
screen_prodtest_welcome(&g_layout.layout, NULL, 0);
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.