From 2c4d11bfa0340b6d7e86caf8de88f0f5807b348a Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:11:40 +0000 Subject: [PATCH] feat(hid): Add KConfig option for higher NKRO usages By default the maximum NKRO usage is set to maximise compatibility, but some keys dont work, this adds the ability to use those extended keys, at the cost of compatibiltity --- app/Kconfig | 11 ++++++++++- app/include/zmk/hid.h | 5 +++++ docs/docs/config/system.md | 12 ++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/Kconfig b/app/Kconfig index f92f0ae3..e3126fba 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -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 + +endif + if ZMK_HID_REPORT_TYPE_HKRO config ZMK_HID_KEYBOARD_REPORT_SIZE diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index aeaa69d8..c6e5ebff 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -17,7 +17,12 @@ #include #include +#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 diff --git a/docs/docs/config/system.md b/docs/docs/config/system.md index b9dd580d..eba6000b 100644 --- a/docs/docs/config/system.md +++ b/docs/docs/config/system.md @@ -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 maximise compatibility, however certain less frequently used keys (F13-F24 and INTL1-8) will not work. The solution is to set 'CONFIG_ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT=y'. This is known to break compatibility with Android. + +::: + 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 |