Repository navigation
espressif: _bleio: end connect() when the link fails before it is reported - #11859
Merged
tannewt merged 2 commits intoNov 18, 2026
Merged
Conversation
…orted NimBLE reports a central connection with BLE_GAP_EVENT_CONNECT only after it has read the peer's features and version. If the link fails with HCI 0x3E (connection failed to be established) before then, NimBLE retries it (BT_NIMBLE_ENABLE_CONN_REATTEMPT, on by default) and finally sends BLE_GAP_EVENT_DISCONNECT to the connect callback. No BLE_GAP_EVENT_CONNECT follows, and the connect timer was already cancelled when the controller reported the link, so connect() waited forever. Handle BLE_GAP_EVENT_DISCONNECT in _connect_event by ending the wait with the disconnect reason, so connect() raises instead of hanging. With CIRCUITPY_VERBOSE_BLE, also print the reattempts and the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01619FtugLCtyvd5FEfJCyzo
Member
|
Code looks ok. Why draft? |
Author
Thanks, just wanted to add more concrete test details before getting people's attention. |
Member
|
Ok @urfdvw mention me when you are ready for a review. |
urfdvw
marked this pull request as ready for review
November 18, 2026 02:41
Author
|
urfdvw/cpy-JC3636W518C#1 The repo link above is now open for public access |
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.
NimBLE reports a central connection with BLE_GAP_EVENT_CONNECT only after it has read the peer's features and version. If the link fails with HCI 0x3E (connection failed to be established) before then, NimBLE retries it (BT_NIMBLE_ENABLE_CONN_REATTEMPT, on by default) and finally sends BLE_GAP_EVENT_DISCONNECT to the connect callback. No BLE_GAP_EVENT_CONNECT follows, and the connect timer was already cancelled when the controller reported the link, so connect() waited forever.
Handle BLE_GAP_EVENT_DISCONNECT in _connect_event by ending the wait with the disconnect reason, so connect() raises instead of hanging. With CIRCUITPY_VERBOSE_BLE, also print the reattempts and the reason.
Claude-Session: https://claude.ai/code/session_01619FtugLCtyvd5FEfJCyzo
Tested with this board: Guition JC3636W518C V2 (ESP32-S3R8), using an out-of-tree board definition: https://github.com/urfdvw/cpy-JC3636W518C