Skip to content

feat(bluetooth): Proper basic bond management, new bt behavior for resetting bond to host. #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 14, 2020

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Aug 28, 2020

  • Add bt behavior that can be used to with BT_CLEAR_BONDS, BT_PROF_NEXT, BT_PROF_PREV, and BT_PROF_SEL 2.
  • Clearing bonds ignores the peripheral bond, for full brute force reset, you can:
    • Use the unpair combo, or
    • Build your firmware with the new ZMK_BLE_CLEAR_BONDS_ON_START value (e.g. CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START=y in your conf), and then flash with that firmware. Make sure to revert this once done.

@petejohanson petejohanson added enhancement New feature or request core Core functionality/behavior of ZMK split bluetooth Bluetooth related items labels Aug 28, 2020
@petejohanson petejohanson requested a review from Nicell August 28, 2020 19:59
@petejohanson petejohanson force-pushed the bluetooth/ident-management branch from d194010 to f26c527 Compare August 28, 2020 20:08
@petejohanson petejohanson force-pushed the bluetooth/ident-management branch 4 times, most recently from 4e4f844 to d46df10 Compare September 2, 2020 03:43
@petejohanson petejohanson changed the title feat(bluetooth): Proper bond management, identity support for non-splits feat(bluetooth): Proper basic bond management, new bt behavior for resetting bond to host. Sep 2, 2020
@petejohanson petejohanson force-pushed the bluetooth/ident-management branch 4 times, most recently from 7515897 to 95925ba Compare September 2, 2020 04:02

int zmk_ble_clear_bonds()
{
LOG_DBG("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙄

@petejohanson petejohanson force-pushed the bluetooth/ident-management branch 3 times, most recently from f5b27b8 to 894cfd8 Compare September 9, 2020 03:32
@petejohanson
Copy link
Contributor Author

Testing notes:

  1. Add #include <dt-bindings/zmk/bt.h> to the top of your keymap.
  2. Add a few new bindings to your keymap, in particular &bt BT_CLEAR_BONDS for clearing the bonds for the currently selected profile, and &bt BT_PROF_NEXT to select the next open profile.
  3. Create a build for your left + right with CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START=y in it, and flash to each half, making sure the other is completely off/unplugged before and after until you're ready.
  4. Flash again with that Kconfig setting removed, so bonds persist properly.
  5. Test turning on each half in various combinations, and ensuring they pair properly.
  6. Test pairing to your host, then cycling to the next profile, and pairing with another host, then cycle back to first profile and confirm you can output to the first host, etc.

Note:

  • We do fire events for profile changes, will be used to build out display support, LED flashes, etc.

* Add `bt` behavior that can be used to perform certain actions,
  such as next/prev identity, reset identity, etc.
  NOTE: Multiple identities is only supported for non-split shields,
  due to missing Zephyr identity functionality for dual
  central/peripheral devices.
* Proper bond reset tied to action, that honors peripheral bonds,
  so folks can reset and pair to other hosts, without breaking
  bonds between splt halves.
* Simplify the `bt` behavior to one current command
  `BT_CLEAR_BONDS_CMD`.
* Simplify BLE code for split and non-split keyboards.
* Remove keymap processing from split peripheral side.
* Add back in profiles, not using Zephyr
  BT identity infrastructure.
* Restore additional `&bt` commands for profile
  operations.
* Fix for split pairing and subscriptions, since
  Zephyr persists subscriptions across connects.
* Remove keymap from peripheral builds, reduces
  firmware size, and avoids unneeded attempts
  to send HID data.
* Easy to build board/image that will clear
  saved profile/bond information for a fresh
  start for keyboards.
@petejohanson petejohanson force-pushed the bluetooth/ident-management branch from 64d6e95 to 4658999 Compare September 14, 2020 02:33
@petejohanson petejohanson merged commit 160f296 into zmkfirmware:main Sep 14, 2020
MangoIV pushed a commit to MangoIV/zmk that referenced this pull request Dec 18, 2020
…management

feat(bluetooth): Proper basic bond management, new `bt` behavior for resetting bond to host.
tyalie pushed a commit to tyalie/zmk that referenced this pull request Nov 15, 2022
…management

feat(bluetooth): Proper basic bond management, new `bt` behavior for resetting bond to host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bluetooth Bluetooth related items core Core functionality/behavior of ZMK enhancement New feature or request split
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants