Skip to content

feat(app): read CV1 DIS serial number for per-unit hardware ID - #19722

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/cv1-serial-app
Sep 29, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/cv1-serial-app

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

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 feat(firmware): expose CV1 per-unit hardware ID as DIS serial number #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

Review in cubic

Git-on-my-level and others added 3 commits September 29, 2026 13:22
Read the DIS Serial Number String (0x2A25) in OmiDeviceConnection so
firmware that exposes the per-unit FICR ID populates BtDevice.serialNumber
and the existing hashed hardware_id analytics path. Firmware without the
characteristic returns an empty read and keeps hardware_id_kind
unavailable. Empty, placeholder ("unknown") and single-character-run
values are dropped so no shared fallback becomes a common hardware_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
OmiDeviceConnection also serves other Omi-protocol devices, so only a
16-hex-character unit ID is accepted as a serial; any shared or fallback
value would otherwise merge units into one analytics hardware_id. Bound
the 0x2A25 read with a 3s timeout so a missing native callback cannot
stall connection setup, and pin that NativeBleTransport returns an empty
read without a native call when older firmware lacks the characteristic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 50ee162 into main Sep 29, 2026
49 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/cv1-serial-app branch September 29, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant