Repository navigation
feat(firmware+app): rename Omi device with onboard persistent storage (#2824) - #23743
ducanh3005 wants to merge 2 commits into
Conversation
Bounty Claim & Payout Details (
|
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verdict: well-built, cohesive feature — but the app does not compile on this head; one blocking fix below.
Blocking
- app/lib/pages/settings/device_settings.dart:527 —
const OutlineInputBorder(borderRadius: OmiRadius.smAll, ...)(and the enabledBorder/focusedBorder variants right below): OmiRadius.smAll is not a const expression, so dart analyze fails with INVALID_CONSTANT. This is what fails Dart Analyze & Tests, and Mobile Release Eligibility fails downstream of the same error ("Required Dart Analyze & Tests did not pass"). Dropping theconston those border constructors should turn CI green.
What looks good (verified in the diff)
- omi_connection.dart: truncateUtf8ToBytes() clamps on codepoint boundaries (24 bytes for 8 CJK chars — your tests pin this), and the write-then-read-back check cleanly surfaces "firmware doesn't support this" instead of silently succeeding against old firmware.
- bt_device.dart: getDeviceInfo() falls back to the advertisement name when the onboard read fails or is empty — correct for firmware without characteristic 19B10014.
- device_provider.dart: _fetchDeviceInfo keeps the session-generation guard; force only bypasses the firmwareRevision cache, and the connectedDevice name sync is scoped to matching device ids.
- transport.c: the write handler validates offset and length, null-terminates before persisting, and deferring bt_set_name()/bt_le_adv_update_data() to the system workqueue is the right call. Scan-response budget works out exactly (2+2 UUID16 + 2+25 name = 31 bytes).
- settings.c: staged copy before settings_save_one() with strict length checks on both the save path and the settings_set load path.
- device_onboard_rename_test.dart: good coverage — byte clamping, multi-byte boundary, empty/whitespace reads, and the throw path.
- No UUID collision: 19B10014-... is unused elsewhere in the repo and follows the existing settings-service sequence (...10–13).
Notes
- Security: the new characteristic uses plain READ|WRITE permissions, matching the existing dim-ratio/mic-gain settings characteristics — consistent with the current settings-service model where a connected central can change settings. Worth a maintainer confirm that an unauthenticated rename (which also changes what the device advertises) is intended there.
- Minor: settings.c reformats a few unrelated existing log lines — harmless churn, slightly inflates the diff.
USER IMPACT: Users can rename their Omi device in Settings, and the custom name stays with the device itself — it shows up when pairing a different phone or after reconnecting.
Action items
- Fix the invalid
constat device_settings.dart:527 (and the sibling borders) so Dart Analyze & Tests passes. - Confirm the permission level on the new characteristic (see security note).
- If you validated on real hardware (rename survives power-cycle; re-pair shows the new name), a short note in the PR description would help reviewers — CI can't exercise the firmware path.
Leaving for human maintainer review after the compile fix: the firmware-side protocol addition (new GATT characteristic 19B10014 and dynamic advertising name) is a device-protocol decision that should get maintainer sign-off.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Thanks for the thorough review @Git-on-my-level! Addressed all items in da2ddb6:
|
Git-on-my-level
left a comment
There was a problem hiding this comment.
Since my last review: addressed (the invalid const OutlineInputBorder in app/lib/pages/settings/device_settings.dart — head da2ddb6 drops the bad const; Dart Analyze & Tests is green again) · still open (nothing from the prior review) · newly introduced (nothing blocking).
Verdict: the blocking compile issue is fixed and the feature holds up on re-review; what remains is maintainer sign-off on the new firmware↔app contract, not code fixes.
Verified on the new head:
- app/lib/pages/settings/device_settings.dart —
focusedBorderno longer wraps the non-constOmiColors.textTertiaryin aconstconstructor; the dialog's >25-UTF-8-byte guard and empty-name check line up with the transport-side clamp. - omi/firmware/omi/src/lib/core/transport.c — the write handler rejects offset≠0 and len>25 (
BT_ATT_ERR_INVALID_ATTRIBUTE_LEN), null-terminates into a 26-byte buffer, and defersbt_set_name/bt_le_adv_update_datato the system workqueue (correct: no HCI calls from BLE RX context). MovingBT_DATA_NAME_COMPLETEfrombt_adinto scan responsebt_sdkeeps the 31-byte budget, anddata_lenis recomputed before each advertising update. - omi/firmware/omi/src/settings.c —
device_nameload caps at 25 bytes and null-terminates off the read-cb return;app_settings_save_device_namestages, persists viasettings_save_one("omi/device_name", …), and only then commits the static, so a failed save leaves no partial state. A zero-length write resets toCONFIG_BT_DEVICE_NAME. - app/lib/services/devices/connectors/omi_connection.dart —
truncateUtf8ToBytestruncates on codepoint boundaries;performGetDeviceNamereturns null on empty/error so devices on older firmware keep the advertised name; the read-back check surfaces 'firmware does not support' instead of silently succeeding. - app/test/unit/device_onboard_rename_test.dart — solid: multi-byte clamp on codepoint boundary, read-back equality, throw/absent fallbacks.
- app/lib/providers/device_provider.dart, app/lib/backend/schema/bt_device/bt_device.dart, app/lib/pages/settings/device/device_info_groups.dart, app/lib/services/devices/connectors/device_connection.dart — force-refresh plus
connectedDevicename sync gated on id equality; rename row shown only forDeviceType.omi; other connectors inherit safe defaults (nullread /UnsupportedErrorwrite).
Security: the new characteristic uses the same READ|WRITE permissions as the sibling settings characteristics (mic gain, dim ratio), so no new permission surface — the name is writable by any connected client, same as existing settings.
USER IMPACT: users can rename their Omi device in Device Settings, and the name travels with the device — it survives re-pairing and shows on another phone (needs the new firmware; older firmware keeps today's behavior).
Still wanted before merge:
- No firmware build appears in this PR's checks — transport.c/settings.c were reviewed statically only; please confirm a Zephyr build and on-device validation that the advertising name actually updates while connected.
- Maintainer sign-off on the new GATT characteristic (19B10014-…) and the device-name persistence contract — that's a firmware↔app protocol decision.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Dismissed: the blocking concern from this review (invalid const OutlineInputBorder in app/lib/pages/settings/device_settings.dart failing dart analyze) is resolved on head da2ddb6 — the invalid const was dropped and Dart Analyze & Tests passes on the current head.
|
Thanks for the re-review @Git-on-my-level! Confirming the two remaining items for maintainer sign-off:
All CI checks ( @Git-on-my-level |
…ation Adapt #23743 to the CV1 candidate; retain UUID 19B10014 and advertise feature bit 9. Add production host regressions for partial NVS reads and BLE RX interleavings. Omit the app patch that conflicts with this base. Failure-Class: none Co-Authored-By: ducanh3005 <[email protected]>
<!-- 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)
UI-Evidence: none
Failure-Class: none
Line-Count-Exception: app/lib/providers/device_provider.dart | 1624 -> 1635 | Add refreshDeviceInfo and connectedDevice name sync after onboard BLE device rename.
Line-Count-Exception: app/lib/services/devices/connectors/omi_connection.dart | 1454 -> 1513 | Add GATT device name read/write and UTF-8 byte clamping on OmiDeviceConnection.
Product invariants affected
Summary
Closes #2824
Implements end-to-end custom device renaming for Omi devices with onboard persistent storage in Zephyr NVS (
omi/device_name), dynamic BLE scan-response advertising (CONFIG_BT_DEVICE_NAME_DYNAMIC=y), and Flutter GATT Settings Service characteristic (19b10014-e8f2-537e-4f6c-d104768a1214) read/write synchronization and Device Settings UI dialog.Changes
omi/firmware/omi/):omi/device_name(up toMAX_DEVICE_NAME_PAYLOAD_LEN = 25UTF-8 bytes) insrc/settings.candsrc/lib/core/settings.h.19B10014-E8F2-537E-4F6C-D104768A1214on Settings Service (19B10010-E8F2-537E-4F6C-D104768A1214) insrc/lib/core/transport.c.BT_DATA_NAME_COMPLETEin scan responsebt_sdand deferbt_set_name()+bt_le_adv_update_data()to system workqueue (adv_name_update_work).app/):setDeviceName/getDeviceNametoDeviceConnectionandOmiDeviceConnectionwith codepoint-safe 25-byte UTF-8 truncation (truncateUtf8ToBytes) and read-back verification.BtDevice._getDeviceInfoFromOmiand addDeviceProvider.refreshDeviceInfo()to refreshpairedDeviceandconnectedDeviceafter renaming.DeviceInfoGroupsinteractive for Omi devices and present anOmiAlertDialoginDeviceSettingsusing sharedOmiColors/OmiType/OmiFeedbackprimitives without touching generated.arb/l10nfiles.app/test/unit/device_onboard_rename_test.dart):BtDevice.getDeviceInfoname sync.