forked from Blendman974/faceclaw
Firmware 2.2.9 requires the sid-0x80 DEVICE_SETTINGS/AUTHENTICATION(4) exchange shortly after each GATT connection: it gates query responses on completing it over an encrypted link, and closes unauthenticated links after ~30 s. On a phone with no existing bond (no inherited stock-app pairing) the exchange is also what triggers SMP pairing. This is why the onboarding firmware check failed with "no response to the device-info query" on a fresh device: the probe connected, the prelude was acked, but the settings query was never answered and no pairing ever happened. (See ../notes/ble-connections-2.2.9.md, validated by g2flash on hardware.) - BleProtocol: buildAuthenticationRequest / isAuthenticationSuccess (strict: command 4, matching magic, empty result message), SID_SECURITY_AUTH. - Device-info probe: authenticates before the prelude with a 30 s window (the user may need to accept an OS pairing prompt; the check page says so). Soft on non-response since the probe also runs against the custom firmware — but a query timeout after unconfirmed auth now names the pairing problem. - Flash-prompt communicator: authenticates each arm before the prelude (mandatory — it only ever talks to stock firmware). - Firmware flasher: control-channel notifications are now mandatory, each lens authenticates before OTA BEGIN, and the OTA-time heartbeat is gone — official captures show no control traffic during a transfer, heartbeats demonstrably do not satisfy the 2.2.9 deadline, and a concurrent control writer interleaves with the marker/data transactions. The OTA envelope counter now resets after bring-up, mirroring the stock sequence. - Main communicator: authenticates both arms after connecting, before the prelude, with a short soft wait (logs and continues on timeout so firmware that never answers cannot stall reconnects). Hardware test pending: fresh-device onboarding against stock 2.2.9 (check, prompt, flash), and a regression pass on custom-firmware connect + probe. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV