Add bonding and pairing support with standard HID UUID advertising#1
Draft
Add bonding and pairing support with standard HID UUID advertising#1
Conversation
Co-authored-by: mr-u0b0dy <63730630+mr-u0b0dy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Transition to Standard HID UUID with Bonding and Pairing Support
Add bonding and pairing support with standard HID UUID advertising
Sep 17, 2025
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.
This PR addresses the authentication failure issues (disconnect reason 5) by implementing proper BLE bonding and pairing support while ensuring the device advertises the standard HID Service UUID for better OS compatibility.
Problem
The device was experiencing
BT_HCI_ERR_AUTH_FAIL(reason 5) disconnections when BLE centrals attempted to pair. This occurred because:BT_UUID_HIDS) but lacked SMP/security supportSolution
Implemented comprehensive bonding and pairing support:
Configuration Changes (
app/prj.conf)CONFIG_BT_SMP=yfor Security Manager ProtocolCONFIG_BT_BONDABLE=yto allow bonding with peersCONFIG_BT_KEYS_OVERWRITE_OLDEST=yfor efficient bond managementCONFIG_SETTINGS=yandCONFIG_BT_SETTINGS=yfor persistent bond storageCode Implementation (
app/src/main.c)auth_cancel()- handles pairing cancellationauth_pairing_complete()- logs successful bondingauth_pairing_failed()- logs pairing failuressettings_load()afterbt_enable()to restore stored bondsbt_conn_auth_cb_register()0x1812) for better discoverabilityVersion Update
Bumped version to 0.2.0 to reflect externally observable behavior changes.
Expected Behavior
Testing
To test the changes:
The device now provides a proper BLE HID experience with persistent bonding while maintaining the existing custom characteristic functionality for raw keyboard report injection.
Created from VS Code via the GitHub Pull Request extension.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.