zmk icon indicating copy to clipboard operation
zmk copied to clipboard

feat(core): Optionally disable automatic endpoint fallback

Open ReFil opened this issue 1 year ago • 6 comments

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

ReFil avatar Oct 19 '24 16:10 ReFil

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.

caksoylar avatar Oct 19 '24 20:10 caksoylar

@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?

ReFil avatar Oct 26 '24 10:10 ReFil

@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.

joelspadin avatar Oct 27 '24 02:10 joelspadin

Rebased and ready for review

ReFil avatar Aug 02 '25 19:08 ReFil

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 return BLE or USB
  • but no zmk_endpoint_changed event 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)

snoyer avatar Aug 03 '25 19:08 snoyer

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!

kurtis-lew avatar Oct 30 '25 13:10 kurtis-lew