Skip to content

Conversation

jwise
Copy link

@jwise jwise commented Aug 4, 2025

On iOS, on the second connection attempt to a cc256x device from the legacy app, the PPoG session will never wake up; we'll see an attempted write to the GATT Service Changed CCCD, but we'll respond with an "Insufficient Authorization (0x08)". What on earth? Nobody even references BLE_ATT_ERR_INSUFFICIENT_AUTHOR! But, it turns out, 0x08 is shared with BLE_HS_ENOTSUP, and we can end up returning that from the nimble_store code by way of ble_gatts_clt_cfg_access -- and this only happens on the second time, because, according to ble_gatts_clt_cfg_access_locked, "Successful writes get persisted for bonded connections.". When this happens, unrelated things go wrong later (like PPoG, for some reason).

Well, we cheat: we don't actually persist it, since our store is not complex enough to persist it to. But nobody cares, so it's OK.

Fixes #260.

On iOS, on the *second* connection attempt to a cc256x device from the
legacy app, the PPoG session will never wake up; we'll see an attempted
write to the GATT Service Changed CCCD, but we'll respond with an
"Insufficient Authorization (0x08)".  What on earth?  Nobody even references
BLE_ATT_ERR_INSUFFICIENT_AUTHOR!  But, it turns out, 0x08 is shared with
BLE_HS_ENOTSUP, and we *can* end up returning that from the nimble_store
code by way of `ble_gatts_clt_cfg_access` -- and this only happens on the
*second* time, because, according to `ble_gatts_clt_cfg_access_locked`,
"Successful writes get persisted for bonded connections.".  When this
happens, unrelated things go wrong later (like PPoG, for some reason).

Well, we cheat: we don't actually persist it, since our store is not complex
enough to persist it to.  But nobody cares, so it's OK.

Fixes pebble-dev#260.

Signed-off-by: Joshua Wise <[email protected]>
@jwise jwise requested review from Hexxeh and gmarull August 4, 2025 07:57
@gmarull
Copy link
Collaborator

gmarull commented Aug 4, 2025

Interesting finding, that may explain some other issues we observe actually. Let me check if we need to store something (even if in RAM) that may be needed on some scenarios.

@Hexxeh
Copy link
Collaborator

Hexxeh commented Aug 4, 2025

Maybe create a ticket to also track this?

@gmarull
Copy link
Collaborator

gmarull commented Aug 4, 2025

I have implemented support for CCCD persistence here coredevices/PebbleOS#149, i a way that should not break the existing db (except you have >= 128 bondings, which seems unrealistic)

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.

snowy_bb2 successfully makes PPoG connection with iOS legacy app only on first pairing, and never again
3 participants