From fa8c9dc907ef80a21ddcc6002175f1a0c4c42351 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Mon, 12 Feb 2018 04:51:59 +0100 Subject: [PATCH] Logical maximum is wrongly assumed to be an unsigned integer, thus 0xFF is interpreted as -1 and not 255 (#92) Simply setting the number of bits to 16 solves this --- .../usb_descriptors/usb_descriptor_basic_keyboard_report.c | 2 +- .../usb_descriptors/usb_descriptor_basic_keyboard_report.h | 2 +- right/src/usb_descriptors/usb_descriptor_generic_hid_report.c | 4 ++-- right/src/usb_descriptors/usb_descriptor_generic_hid_report.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.c b/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.c index 1092021..dff8ab9 100644 --- a/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.c +++ b/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.c @@ -36,7 +36,7 @@ uint8_t UsbBasicKeyboardReportDescriptor[USB_BASIC_KEYBOARD_REPORT_DESCRIPTOR_LE // Scancodes HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0xFF), HID_RI_USAGE_PAGE(8, HID_RI_USAGE_PAGE_KEY_CODES), HID_RI_USAGE_MINIMUM(8, 0x00), HID_RI_USAGE_MAXIMUM(8, 0xFF), diff --git a/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.h b/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.h index b9e0a55..61f7b44 100644 --- a/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.h +++ b/right/src/usb_descriptors/usb_descriptor_basic_keyboard_report.h @@ -3,7 +3,7 @@ // Macros: - #define USB_BASIC_KEYBOARD_REPORT_DESCRIPTOR_LENGTH 63 + #define USB_BASIC_KEYBOARD_REPORT_DESCRIPTOR_LENGTH 64 #define USB_BASIC_KEYBOARD_MAX_KEYS 6 // Variables: diff --git a/right/src/usb_descriptors/usb_descriptor_generic_hid_report.c b/right/src/usb_descriptors/usb_descriptor_generic_hid_report.c index 82ab86d..fcac41d 100644 --- a/right/src/usb_descriptors/usb_descriptor_generic_hid_report.c +++ b/right/src/usb_descriptors/usb_descriptor_generic_hid_report.c @@ -10,7 +10,7 @@ uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH] // Input flowing from device to host HID_RI_USAGE(8, USB_GENERIC_HID_REPORT_DESCRIPTOR_VENDOR_USAGE_DATA_IN), HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0xFF), HID_RI_REPORT_SIZE(8, 0x08), HID_RI_REPORT_COUNT(8, USB_GENERIC_HID_INTERRUPT_IN_PACKET_SIZE), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), @@ -18,7 +18,7 @@ uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH] // Output flowing from host to device HID_RI_USAGE(8, USB_GENERIC_HID_REPORT_DESCRIPTOR_VENDOR_USAGE_DATA_OUT), HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0xFF), HID_RI_REPORT_SIZE(8, 0x08), HID_RI_REPORT_COUNT(8, USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE), HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), diff --git a/right/src/usb_descriptors/usb_descriptor_generic_hid_report.h b/right/src/usb_descriptors/usb_descriptor_generic_hid_report.h index 71374a0..b7c34be 100644 --- a/right/src/usb_descriptors/usb_descriptor_generic_hid_report.h +++ b/right/src/usb_descriptors/usb_descriptor_generic_hid_report.h @@ -3,7 +3,7 @@ // Macros: - #define USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH 31 + #define USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH 33 #define USB_GENERIC_HID_REPORT_DESCRIPTOR_VENDOR_USAGE_PAGE_INDEX 0x80 #define USB_GENERIC_HID_REPORT_DESCRIPTOR_VENDOR_USAGE_COLLECTION 0x81