summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2023-07-28 02:05:01 +0200
committerGitHub <noreply@github.com>2023-07-28 01:05:01 +0100
commit32174abcfae373eac2659dd9de255b3c1792d238 (patch)
tree9b95b6516a260642de21e8e880ad0d0502c71a02 /tmk_core/protocol
parent3a413e4bad2cad306eba7ecc1604e4a147c905b5 (diff)
Update keyboard report descriptor for USB compliance (#21626)
Running the "HID Tests" suite of the USB 3 Command Verifier (USB3CV) tool resulted in the following error: (HID: 3.2.61) The report descriptor returned in response to a GetDescriptor(Report) must be compliant with the HID specification. Byte Number: 37h ( 55d) Data Field: 91 02 Mnemonic: Output Value: (Variable) Errors: Error: LOGICAL MAX MUST be bounded by Report Size The error stems from the fact that logical minimum and maximum are global items, which means that the next item in a report descriptor inherits the value from the previously set value. In this case the status leds item inherited the logical minimum (=0) and maximum (=255) from the keycodes item. As the status leds set a report size of 1 bit, wich can only hold a boolean, it becomes clear that this range would never fit. The fix is straightforward, we just define a appropriate logical maximum (=1), the mismatch is solved and our keyboard now passes the compliance tests. Defining the logical minimum is redundant in this case but is kept to form a logical block.
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/usb_descriptor.c2
-rw-r--r--tmk_core/protocol/vusb/vusb.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 5ab9e3ff4f..e215c90900 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -93,6 +93,8 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] = {
HID_RI_USAGE_PAGE(8, 0x08), // LED
HID_RI_USAGE_MINIMUM(8, 0x01), // Num Lock
HID_RI_USAGE_MAXIMUM(8, 0x05), // Kana
+ HID_RI_LOGICAL_MINIMUM(8, 0x00),
+ HID_RI_LOGICAL_MAXIMUM(8, 0x01),
HID_RI_REPORT_COUNT(8, 0x05),
HID_RI_REPORT_SIZE(8, 0x01),
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index b3eeff9e01..d74f375f66 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -435,6 +435,8 @@ const PROGMEM uchar keyboard_hid_report[] = {
0x05, 0x08, // Usage Page (LED)
0x19, 0x01, // Usage Minimum (Num Lock)
0x29, 0x05, // Usage Maximum (Kana)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x01, // Logical Maximum (1)
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x91, 0x02, // Output (Data, Variable, Absolute)