feat(core): Optionally disable automatic endpoint fallback
By default if only one endpoint is connected but the other is selected, the connected endpoint will be chosen as a fallback, for boards with physical endpoint selection slide switches this can lead to confusing behaviour where one is selected but the other is used.
This adds a kConfig option CONFIG_ZMK_ENDPOINT_DISABLE_FALLBACK that, when enabled, switches the board to a different endpoint selection system that will only return the preferred transport or anew transport ZMK_TRANSPORT_NONE that just swallows any HID data.
Tested with various combinations of USB and BLE and it seems to work as intended
Can we add a link to https://zmk.dev/docs/keymaps/behaviors/outputs pointing to this? Perhaps an additional paragraph at the end of the summary section.
@joelspadin sorry to be a pain, not sure if GitHub is playing up or something but I can't seem to see what changes you requested?
@joelspadin sorry to be a pain, not sure if GitHub is playing up or something but I can't seem to see what changes you requested?
No idea where that comment went. I've added it again.
Rebased and ready for review
I've been testing this and it's been working as expected when it comes to selecting the endpoints :+1:
However it seems like there are cases where it's not possible to notice the change of preferred endpoint using events. For example when switching between a non-connected BLE profile and non-HID USB:
- calling
zmk_endpoints_preferred()will indeed returnBLEorUSB - but no
zmk_endpoint_changedevent is raised
It would be nice to be able to listen to the change of preferred endpoint to reflect it on custom displays. (I don't know if that means a new event or just firing the existing zmk_endpoint_changed more)
Cherry-picked on top of #3060, testing on Electronic Materials Office Ltd. Altar I. Feature works swimmingly, just had to remember for CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE to elapse between power cycles. Thanks for working on this!