Skip to content
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

feat(hid): Add KConfig option for higher NKRO usages #2024

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@ config ZMK_HID_REPORT_TYPE_NKRO
help
Enable full N-Key Roll Over for HID output. This selection will prevent the keyboard
from working with some BIOS/UEFI versions that only support "boot keyboard" support.
This option also prevents using some infrequently used higher range HID usages.
This option also prevents using some infrequently used higher range HID usages (notably F13-F24 and INTL1-9)
These usages can be re enabled with ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT.

endchoice

if ZMK_HID_REPORT_TYPE_NKRO

config ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT
bool "Enable extended NKRO reporting"
default n
ReFil marked this conversation as resolved.
Show resolved Hide resolved

endif
ReFil marked this conversation as resolved.
Show resolved Hide resolved

if ZMK_HID_REPORT_TYPE_HKRO

config ZMK_HID_KEYBOARD_REPORT_SIZE
Expand Down
5 changes: 5 additions & 0 deletions app/include/zmk/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
#include <dt-bindings/zmk/hid_usage.h>
#include <dt-bindings/zmk/hid_usage_pages.h>

#if IS_ENABLED(CONFIG_ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT)
#define ZMK_HID_KEYBOARD_NKRO_MAX_USAGE HID_USAGE_KEY_KEYBOARD_LANG8
#else
#define ZMK_HID_KEYBOARD_NKRO_MAX_USAGE HID_USAGE_KEY_KEYPAD_EQUAL
#endif

#define ZMK_HID_MOUSE_NUM_BUTTONS 0x05

// See https://www.usb.org/sites/default/files/hid1_11.pdf section 6.2.2.4 Main Items
Expand Down
12 changes: 12 additions & 0 deletions docs/docs/config/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ Exactly zero or one of the following options may be set to `y`. The first is use
| `CONFIG_ZMK_HID_REPORT_TYPE_HKRO` | Enable `CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE` key roll over. |
| `CONFIG_ZMK_HID_REPORT_TYPE_NKRO` | Enable full N-key roll over. This may prevent the keyboard from working with some BIOS/UEFI versions. |

:::note NKRO usages

By default the NKRO max usage is set so as to maximize compatibility, however certain less frequently used keys (F13-F24 and INTL1-8) will not work with it. One solution is to set `CONFIG_ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT=y`, however this is known to break compatibility with Android and thus not enabled by default.

:::

If `CONFIG_ZMK_HID_REPORT_TYPE_HKRO` is enabled, it may be configured with the following options:

| Config | Type | Description | Default |
| ------------------------------------- | ---- | ------------------------------------------------- | ------- |
| `CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE` | int | Number of keyboard keys simultaneously reportable | 6 |

If `CONFIG_ZMK_HID_REPORT_TYPE_NKRO` is enabled, it may be configured with the following options:

| Config | Type | Description | Default |
| ---------------------------------------------- | ---- | -------------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT` | bool | Enable less frequently used key usages, at the cost of compatibility | n |

Exactly zero or one of the following options may be set to `y`. The first is used if none are set.

| Config | Description |
Expand Down