Repository navigation
feat(firmware): expose CV1 per-unit hardware ID as DIS serial number - #19719
Merged
Merged
Conversation
CV1 reports only build-wide DIS constants (model, manufacturer, hardware revision 5.0), so field defects cannot be attributed to a physical unit or its production lot. Read the immutable nRF5340 FICR device ID via hwinfo, publish it as the DIS Serial Number String (0x2A25) through the DIS settings handler after settings_load(), and print UNIT_ID on the console next to BLE_ADDR for production-line fixtures. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Sep 29, 2026
## What changed and why `OmiDeviceConnection.getDeviceInfo()` now reads the BLE DIS **Serial Number String (0x2A25)**. This is the app half of per-unit CV1 attribution. Firmware draft #19719 exposes each pendant's immutable nRF5340 FICR ID there. Once a serial is present, it flows through code that already exists. `BtDevice._getDeviceInfoFromOmi` already copies `deviceInfo['serialNumber']`, and `AnalyticsManager._deviceIdentityProperties` already emits a hashed `hardware_id` with `hardware_id_kind=manufacturer_serial`. Today every CV1 event says `hardware_id_kind=unavailable`: 529,660 of 529,660 `Device Connected` events over 180 days. So we cannot tell which physical units, or which production lots, are failing. **Backwards compatible with all existing firmware.** Firmware without 0x2A25 is every released CV1 build up to 3.0.21. On `NativeBleTransport`, a characteristic missing from the discovered GATT table returns an empty read without a GATT round-trip. That means no serial is set, and `hardware_id_kind` stays `unavailable`, exactly as today. A read that throws is caught locally, so the other DIS fields are unaffected. `parseSerialNumber` accepts only the CV1 unit-ID shape: exactly 16 hex characters, normalized to uppercase, and not a single repeated digit. `OmiDeviceConnection` also serves other Omi-protocol devices, so this strict check keeps any shared or fallback serial out of analytics. That includes the firmware's `unknown` fallback and vendor strings; any of them would otherwise merge many units into one `hardware_id`. The read is bounded by a 3 s timeout, so a native read callback that never arrives cannot stall connection setup. ## Product invariants affected none ## How it was verified - `cd app && bash test.sh test/unit/omi_connection_serial_number_test.dart test/utils/analytics/device_identity_analytics_test.dart test/providers/device_provider_test.dart test/unit/device_connection_find_pattern_test.dart` plus `test/services/devices/transports/native_ble_transport_test.dart` → all passed (138 + 36 across the two batches; Flutter 3.44.5, the CI version). - `flutter analyze` on the changed files: no new issues. The 6 existing infos are on untouched lines 541–802. - Independent review by Codex (gpt-6-luna): no merge blocker. It confirmed that on iOS and Android a characteristic missing from old firmware returns immediately with no native read. Its three suggestions are applied in the last commit: 1. Accept only 16-hex CV1 IDs, since other Omi-protocol devices share this connector. 2. Add a timeout to the read. 3. Add a native-transport test for the missing characteristic. - Not exercised on a physical pendant. Released firmware has no 0x2A25, so on real devices this is a no-op until #19719 ships. ## Tests `app/test/unit/omi_connection_serial_number_test.dart` resolves a `BtDevice` through the real `OmiDeviceConnection` → `BtDevice.getDeviceInfo` path with a fake DIS transport. It covers: - old firmware without 0x2A25: all DIS fields kept, serial is null - new firmware: serial populated - the `unknown` fallback: rejected - a serial read that throws: the other fields still populate - a non-CV1 serial: ignored - `parseSerialNumber` edge cases `native_ble_transport_test.dart` pins that reading an undiscovered characteristic returns `[]` without calling the native `readCharacteristic`. Old firmware depends on exactly that. The existing `device_identity_analytics_test.dart` already covers the serial → hashed `hardware_id` payload. ## Failure class (fixes) Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/19722?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Git-on-my-level
added a commit
that referenced
this pull request
Nov 8, 2026
<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_
## Status 2026-11-08: verified, ready for release review
All the pre-release gates listed further down have passed. The one left
is David's go. After that, the rollout coordinator handles a staged OTA.
- **Field path proven:** 3.0.21 to 3.0.23 over BLE OTA, on the jig
running the factory 3.0.8 bootloader (the bootloader shipped units
have). Slot1 went to pending+permanent, and after reset slot0 ran the
new image, active and confirmed, with DIS reporting 3.0.23. An earlier
install from an RC start image also passed.
- **Safe mode:** the bench check and all four fault proofs (hard fault,
driver hang, settings hang, watchdog starvation) passed on 6a09d7c. Same
code hash as this head.
- **Host and CI:** firmware host suites, the OTA slot geometry check and
preflight pass. All required CI checks are green. The two red `Analyze`
jobs are CodeQL failing at the SARIF upload step with no alerts. They
aren't required checks and GitHub won't rerun them.
- **Why there is no separate 3.0.22:** safe mode was going to ship alone
as 3.0.22. Its OTA was never proven, because the jig's stock MCUboot
lacks the Omi SD init and erased slot1. Once the jig had the factory
bootloader, the full candidate was proven instead, so safe mode ships
inside 3.0.23.
- **Known telemetry gap:** the boot record decides the update outcome
from the DIS string plus the MCUboot header version, which is 0.0.0 on
every image. So a field unit's first 3.0.23 boot reports UNKNOWN, and a
same-version reinstall reports NOT_INSTALLED. The app's post-reset hash
check stays the authority. A follow-up will switch to image-hash
identity.
- **Still not measured on hardware:** current draw, charger behavior,
and storage after power loss.
Evidence:
`data/run-2026-11-07-cv1-rc/factory-bootloader-install-proof.md` in the
workspace repo. Bench tooling: #24813.
## Update 2026-11-07: safe-mode SD fix, boot telemetry, pinned flash
layout
Four commits on top of the 11-04 head:
- `7a7a6aaa9dd` Safe mode now brings up the SD card before anything
reads the NOR on the shared SPI3 bus. Without that, an uninitialized SD
card drives MISO and corrupts NOR reads. Also adds the persisted boot
record, the saved update outcome, and storage health counters (NOR
read-check failures, SD init failures). These are telemetry items 4-6.
Recovery characteristic `19B10042` moves to v2 (96 bytes, same 16-byte
prefix, version byte 2). `19B10041` is unchanged.
- `481bab7ead1` Docs: `docs/verification/2026-11-07-boot-telemetry.md`,
GATT map.
- `44180c0060a` Hang guard: if SD init hangs and the watchdog fires,
later SAFE boots skip SD init and count a failure instead of looping.
- `6a09d7cbbe5` Pins the app, littlefs, settings and EMPTY_0 partitions
in `boards/omi/pm_static.yml` to the fielded 3.0.21 map. The partition
manager orders the "before: end" partitions in a Python set, so without
the pin the layout depended on the hash seed.
`tests/check_ota_slot_geometry.py` now asserts the pinned map.
Bench evidence on the jig (6a09d7c): the bench check passed, and so did
all four fault proofs (hard fault, driver hang, settings hang, watchdog
starvation). ALL OK at 2026-11-06T22:18:12Z. The jig was restored to
3.0.21 afterwards.
Since proven (see Status above): the jig now runs the factory 3.0.8
bootloader, and a real 3.0.21 to 3.0.23 BLE install passed.
## 3.0.23: merged with safe mode (update 2026-11-04)
This head merges `origin/main` into the backlog candidate. Main now
carries CV1 safe mode (#24505) and its interrupted-update retry fix
(#24514). The version is bumped to **3.0.23**. The original plan was to
ship safe mode alone first, as 3.0.22. That was dropped, and safe mode
ships inside 3.0.23 (see Status above).
- `safe_mode.c`, the retained record layout, the app overlay and the
development-only fault guard match main exactly.
- The replacement SD host joins deferred initialization. The backlog
shutdown worker starts only in normal mode, so SAFE still skips all
application startup.
- **Diagnostics:** the service is registered once, after storage.
`19B10041` keeps the 25-byte telemetry the shipped app parses. Safe
mode's 16-byte recovery state moves to `19B10042`. SAFE exposes only
`42` and Zephyr's static recovery services. `gatt-map.md` matches the
code.
- The merge had seven conflicts: gatt-map, CMakeLists, Kconfig,
diagnostics.h, transport.c, main.c and settings.c. Both sides' behavior
is kept.
- Verified: the host firmware suite and backlog regressions pass, and
preflight passes all 37 checks. Native simulation was skipped because no
Docker daemon was available on the build host.
- **Before any release** (all done except David's go, 2026-11-08):
- An independent review of the merge.
- A build-only CI image of this exact head.
- A normal-mode jig cycle.
- All four safe-mode fault proofs, rerun on this image.
- An app DFU to the jig in SAFE.
- David's go.
## What changed and why
Release candidate for the next CV1 firmware. It combines separately
written PRs so they can be tested together, and fixes what only showed
up once they were combined.
| PR | Author | What it brings |
|---|---|---|
| #24381 (#24137, #19469) | @rgr4y, David | Compiler warning cleanup,
Opus size check, BLE device diagnostics |
| #20450 | David | Ring custody: audio is kept when connected but not
subscribed, and reclaimed only after the phone confirms it |
| #14293 | @apoorvdarshan | Mute survives disconnect and reboot |
| #22659 | @esixce | SD CMD12 reply fix |
| #19719 | David | Per-unit serial number over DIS |
| #13342 | @gianluca-disanto | Audio chunks bounded to ATT MTU |
| #20483 (battery part only) | David | Battery percent doesn't jump on
the charger, and reads correctly after unplugging |
| #23735 (adapted) | @ducanh3005 | BLE power control: resume, pause
capture, power off |
| #23743 (firmware part) | @ducanh3005 | A user-set device name that
persists and advertises |
Also adds `omi/firmware/docs/gatt-map.md`, which assigns each
characteristic UUID to one owner so open PRs stop colliding.
David chose #20450 as the retention fix, accepting that going back to
older firmware loses unsynced audio on the pendant. Release and OTA
publication still need David's go.
**Fixes made on top of the merges:**
- Queued audio could still reach the phone after a mute. A mute now
stops it before sending.
- An unreadable stored mute setting fell back to unmuted, which could
resume capture after a reboot. It now stays muted until an explicit
unmute rewrites the setting. The tradeoff is that a corrupted setting
pauses capture rather than risking recording a user who paused. The app
reads this state back.
- Failed batch media syncs now count as storage errors in diagnostics.
- `check_cv1_mtu.py` passed on its fallback simulation when its compile
failed. A compile failure now fails the check, and only a missing
compiler falls back.
- New `check_ota_slot_geometry.py` keeps OTA slots at the addresses in
every recorded baseline build. It fails on #13855's map.
**Changes from the original PRs:**
- #20483 keeps only the battery fix. Its new diagnostics characteristic
is out, because the existing 25-byte diagnostics packet already covers
this. Diagnostics now report the uncorrected ADC voltage, while critical
shutdown still uses the corrected one.
- #23735 moves from UUID `19B10014` to the allocated `19B10016`, and
from feature bit 9 to bit 11. Pause now uses the same persistent mute as
`19B10015`, so a disconnect or AAD wake can't clear it. Sampling may
continue while paused, with sending and storage both stopped, so this
pause doesn't promise a power saving. A write acknowledges that shutdown
was queued, not that it finished.
- #23743 keeps only the firmware. Its app changes don't apply on this
base, so no app can set a name yet. A name now loads only from a
complete NVS record, and Bluetooth RX can't change it during an
advertising update. A new name takes effect after disconnect, because
advertising is off while connected. The name also moves from the
advertising packet to the scan response, so a passive scanner won't see
it.
**Left out:** #13855, merged and then reverted here. It shrinks both OTA
slots from `0xf0000` to `0xe8000` and moves external network staging and
settings. MCUboot compiles its slot addresses in and OTA doesn't replace
it, while mcumgr uses the app's map. So from reading the design, an app
on that map would write later images and upgrade trailers where the
installed bootloader doesn't look, and OTAs would stop applying.
Settings would also move from `0xfc000`, losing bonds and mute on
update. This hasn't been reproduced on hardware. Generated baseline
builds already end the app at `0xf6000`, below littlefs and settings, so
#5400 needs a fix that keeps the slots where they are.
Also left out: #12102, because #20450 already keeps audio when the clock
is untrusted and its test doesn't link on this branch. Also #14156, held
because it keeps the mic on while connected and that battery cost hasn't
been measured, and #20838 (the retention alternative), #12943 and
#14240.
## Product invariants affected
- INV-CAP-1
This changes what happens to audio while connected but not subscribed,
which is the invariant's main case. Custody host harnesses pass, and the
RC ran on hardware through BLE install and safe-mode fault proofs.
## How it was verified
At `2810eaf`, this head, from a clean clone on the bench Mac, with no
device access:
- `quick-host` and `compile-only` against pinned NCS 2.9.0 pass.
- Host regressions and the OTA slot geometry check pass. The geometry
check also fails on #13855's map, as intended.
- The mute test passes, including new cases for an unreadable setting.
- Custody `make run` passes: `sd_card` and `storage` harnesses report 0
failures.
- The MTU check passes 15 of 15 on the production C seam.
An independent review covered how the merged PRs interact; its three
findings are fixed above. It was a static read and ran no tests.
At the merge of #20483, #23735 and #23743, on the bare CV1 board on the
jig: one app-only cycle passed. The exact image CI built at `07f3866`,
this head, also passed one (build-only run 41523746903, nothing
published). It flashed and verified this image, ran the 30-second boot
check, then restored and verified baseline 3.0.21. The generated slot
map matches the baseline. The same cycle also passed at `2810eaf`. It
proves the image boots and the board can be restored, and nothing about
BLE or audio. Host tests for all three additions pass, and their merge
compiles, links and signs for the real target.
**Not verified at that point (11-04):** anything on hardware beyond that
boot. BLE, GATT, OTA and safe-mode recovery have since been verified
(see Status above). Still open: the new power-off path, renaming,
charger behavior, storage after power loss, the v1 to v2 media upgrade,
and current draw. Going back to pre-#20450 firmware orphans unsynced
audio on the pendant.
## Tests
`omi/firmware/omi/tests/`: custody, `sd_card`, `storage`, capture mute,
OTA slot geometry and host regressions, plus
`omi/firmware/scripts/check_cv1_mtu.py`.
## Failure class
Carried from #14293, which brings these app changes:
Failure-Class: new
Failure-Class-ID: FC-device-mute-cleared-on-disconnect
Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
4609 -> 4670 | Keep durable pendant mute confirmation in the existing
capture owner; unrelated ownership extraction is outside this privacy
fix.
Line-Count-Exception: app/lib/services/capture/capture_coordinator.dart
| 2964 -> 3017 | Confirm device mute before local policy and restore
winning hardware intent on supersession in the existing serialized
owner.
## UI evidence
UI-Evidence: none -- firmware only; the app changes come from #14293 and
aren't exercised in this PR's verification
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
CV1 pendants have no per-unit identity today. The Device Information Service (DIS) reports build-wide constants: model
Omi CV 1, manufacturerBased Hardware, hardware revision5.0. The app therefore recordshardware_id_kind=unavailablefor every CV1 connection: 529,660 of 529,660 PostHogDevice Connectedevents over 180 days. The only unit-like identifier is the BLE identity address, which firmware generates at first boot withbt_id_create(NULL, NULL)and regenerates after an NVS erase. So we cannot tie a field defect to a physical unit, and we cannot tie a unit to its contract manufacturer or production lot.This PR exposes the immutable nRF5340 FICR device ID as the standard DIS Serial Number String (0x2A25):
src/lib/core/unit_id.c: reads the 8-byte ID throughhwinfo_get_device_id(), formats it as 16 uppercase hex characters, and publishes it through Zephyr's DIS settings handler (settings_runtime_set("bt/dis/serial", …)).transport.c: calls it right aftersettings_load()/ BLE identity setup, so no persisted value can override it. It printsUNIT_ID: <hex>on the console next to the existingBLE_ADDRproduction-line line, so factory fixtures can recordunit ID → assembler, lot, PCB revision, test date.omi.conf:CONFIG_BT_DIS_SERIAL_NUMBER=y(fallback stringunknown),CONFIG_BT_DIS_SETTINGS=y,CONFIG_SETTINGS_RUNTIME=y,CONFIG_HWINFO=y.Draft. It is the firmware half of per-unit defect attribution. Still needed outside this PR:
omi_connection.dartand populatesBtDevice.serialNumber. It accepts only a 16-hex-character unit ID and is a no-op on firmware without the characteristic. The existinghardware_idanalytics path (analytics_manager.dart) then emits a hashed unit key. Before that key is joined to a factory roster, it needs a privacy review: it is currently an unsalted, truncated SHA-256.UNIT_IDat end-of-line test, together with the assembler, lot and board revision.omi/firmware/AGENTS.mdwhen this is promoted.Not changed:
nfc.cstill hard-codesABC123as its device ID. That file is not compiled into CV1 (it is absent fromCMakeLists.txt), so it does not affect this change.Privacy note: any central that connects over GATT can read the serial. CV1 already advertises a stable BLE identity address, so this adds a stable identifier but not a new tracking surface for passive scanners. It is visible only after connecting.
Open questions for review
BT_DIS_SETTINGSmakes every DIS string settable at runtime, includingbt/dis/fw, which the app and backend use for OTA gating. This is safe today becauseCONFIG_BT_SETTINGSis off, so the fullsettings_load()never runs. IfBT_SETTINGSis ever enabled, the compiled DIS constants must be re-published after the load.unknown. Factory fixtures must reject it. The companion app PR already ignores it, so it never becomes a shared analytics ID.Product invariants affected
none. No
product/invariants/entry coversomi/firmware/**.How it was verified
Build:
omi/firmware/scripts/ci/build-cv1.shinside the release workflow's pinned image (ghcr.io/zephyrproject-rtos/ci:v0.26.13@sha256:b0ac6334…, NCS v2.9.0 sysbuild, boardomi/nrf5340/cpuapp) succeeded. It produceddfu_application.zip,merged.hexandmerged_CPUNET.hex.unit_id.ccompiles with no warnings; the build's other warnings are all in pre-existing files. App-core image: FLASH 248,536 B (26.17%), RAM 336,208 B (74.62%). The size change againstmainwas not measured.Resolved app-core
.config:CONFIG_BT_DIS_SETTINGS=y,CONFIG_BT_DIS_SERIAL_NUMBER=y,CONFIG_SETTINGS_RUNTIME=y,CONFIG_HWINFO_NRF=y,CONFIG_BT_DIS_STR_MAX=21, and# CONFIG_BT_SETTINGS is not set.Independent review (Codex, gpt-6-sol): no blocking issue found. It confirmed the tagged
hwinfo_nrfdriver returns the 8-byte factory-programmed FICR ID in big-endian order, and that the ID survives reflash, NVS erase and MCUboot DFU. Its non-blocking findings are listed under Open questions above.Verified against NCS v2.9.0's pinned
sdk-zephyr(v3.7.99-ncs2),subsys/bluetooth/services/dis.c. WithBT_DIS_SETTINGS, the serial is held in aCONFIG_BT_DIS_STR_MAX + 1(21 + 1 byte) buffer, updated by thebt/disstatic settings handler under the keyserial. The 16-character ID fits.Not verified on hardware. Still needed: flash a CV1, read 0x2A25 with nRF Connect, confirm it matches the
UNIT_ID:console line, and confirm it stays the same across a reflash and an NVS erase.Tests
No host test was added. The logic is a hwinfo read and a hex format, and the risky part (the DIS settings wiring) only runs on target. The hardware checklist above is the test plan.
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code