From 69d98844e459e15d4ada297de62200646f2c78ee Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Tue, 22 Apr 2025 23:20:42 +0200 Subject: [PATCH 1/4] Revert "revert to shared scroll multiplier on UHK60" This reverts commit a427453410e523c129819f153ff820ea82db5e21. --- .../usb_descriptor_mouse_report.h | 50 +++++++++---------- .../src/usb_interfaces/usb_interface_mouse.c | 17 ++----- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/right/src/usb_descriptors/usb_descriptor_mouse_report.h b/right/src/usb_descriptors/usb_descriptor_mouse_report.h index 464e6d697..eae03bdac 100644 --- a/right/src/usb_descriptors/usb_descriptor_mouse_report.h +++ b/right/src/usb_descriptors/usb_descriptor_mouse_report.h @@ -61,25 +61,6 @@ HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), HID_RI_COLLECTION(8, HID_RI_COLLECTION_LOGICAL), - - // Scroll wheels - - // Resolution multiplier for high-res scroll support - // To have a multiplier apply to a wheel, it must be in the - // same logical collection as the wheel, or else there must - // be no logical collections (according to the USB HID spec); - // so to have a single multiplier apply to the two wheels, - // they must be in the same logical collection (or there - // must be no logical collection at all) - HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), - HID_RI_LOGICAL_MINIMUM(8, 0), - HID_RI_LOGICAL_MAXIMUM(8, 1), - HID_RI_PHYSICAL_MINIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), - HID_RI_PHYSICAL_MAXIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), - HID_RI_REPORT_COUNT(8, 1), - HID_RI_REPORT_SIZE(8, 8), - HID_RI_FEATURE(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - // Vertical wheel HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_WHEEL), HID_RI_LOGICAL_MINIMUM(16, -32767), @@ -90,18 +71,37 @@ HID_RI_REPORT_SIZE(8, 16), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), + HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), + HID_RI_PUSH(0), + HID_RI_LOGICAL_MINIMUM(8, 0), + HID_RI_LOGICAL_MAXIMUM(8, 1), + HID_RI_PHYSICAL_MINIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), + HID_RI_PHYSICAL_MAXIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), + HID_RI_REPORT_COUNT(8, 1), + HID_RI_REPORT_SIZE(8, 2), + HID_RI_FEATURE(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), + HID_RI_POP(0), + HID_RI_END_COLLECTION(0), + + HID_RI_COLLECTION(8, HID_RI_COLLECTION_LOGICAL), // Horizontal wheel HID_RI_USAGE_PAGE(8, HID_RI_USAGE_PAGE_CONSUMER), HID_RI_USAGE(16, HID_RI_USAGE_CONSUMER_AC_PAN), - HID_RI_LOGICAL_MINIMUM(16, -32767), - HID_RI_LOGICAL_MAXIMUM(16, 32767), - HID_RI_PHYSICAL_MINIMUM(16, -32767), - HID_RI_PHYSICAL_MAXIMUM(16, 32767), - HID_RI_REPORT_COUNT(8, 1), - HID_RI_REPORT_SIZE(8, 16), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), + HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), + HID_RI_PUSH(0), + HID_RI_LOGICAL_MINIMUM(8, 0), + HID_RI_LOGICAL_MAXIMUM(8, 1), + HID_RI_PHYSICAL_MINIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), + HID_RI_PHYSICAL_MAXIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), + HID_RI_REPORT_COUNT(8, 1), + HID_RI_REPORT_SIZE(8, 2), + HID_RI_FEATURE(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), + HID_RI_POP(0), HID_RI_END_COLLECTION(0), + HID_RI_REPORT_SIZE(8, 4), + HID_RI_FEATURE(8, HID_IOF_CONSTANT), HID_RI_END_COLLECTION(0), HID_RI_END_COLLECTION(0) diff --git a/right/src/usb_interfaces/usb_interface_mouse.c b/right/src/usb_interfaces/usb_interface_mouse.c index 2adaf9d9c..adaa25b82 100644 --- a/right/src/usb_interfaces/usb_interface_mouse.c +++ b/right/src/usb_interfaces/usb_interface_mouse.c @@ -70,7 +70,7 @@ float VerticalScrollMultiplier(void) float HorizontalScrollMultiplier(void) { - return usbMouseFeatBuffer[0] & 0x01 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; + return usbMouseFeatBuffer[0] & 0x04 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; } usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param) @@ -118,11 +118,6 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param case kUSB_DeviceHidEventSetReport: { usb_device_hid_report_struct_t *report = (usb_device_hid_report_struct_t*)param; if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE && report->reportId == 0 && report->reportLength <= sizeof(usbMouseFeatBuffer)) { - // With a single resolution multiplier, this case will never be - // hit on Linux (for multiple resolution multipliers, one value - // will be missing, so would have to be inferred from the - // other(s)). But Windows does use this request properly, so it - // needs to be handled appropriately. error = kStatus_USB_Success; } else { error = kStatus_USB_InvalidRequest; @@ -133,15 +128,9 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param case kUSB_DeviceHidEventRequestReportBuffer: { usb_device_hid_report_struct_t *report = (usb_device_hid_report_struct_t*)param; if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE && report->reportId == 0 && report->reportLength <= sizeof(usbMouseFeatBuffer)) { - // The Linux implementation of SetReport when initializing a - // device with a single resolution multiplier value is broken, - // sending an empty report, and as a result the - // kUSB_DeviceHidEventSetReport case above isn't triggered at - // all; but it only sends this report when it detects the - // resolution multiplier, and the intention is to activate the - // feature, so turn high-res mode on here. report->reportBuffer = usbMouseFeatBuffer; - usbMouseFeatBuffer[0] = 0x1; + // the only expected written value is this, set it early to workaround the bug + usbMouseFeatBuffer[0] = 0x5; error = kStatus_USB_Success; } else { error = kStatus_USB_AllocFail; From f60aa76f19b9204793190bfa9bd0cf204f9f1fa0 Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Tue, 22 Apr 2025 23:49:07 +0200 Subject: [PATCH 2/4] uhk60: add report ID to mouse reports to dodge the Linux bug The Linux kernel sends 0 length SetReport request for the high-res multiplier feature, when the report descriptor doesn't use report IDs. Define an ID, which also must be used for the input report. --- .../usb_descriptor_mouse_report.h | 8 ++++ .../src/usb_interfaces/usb_interface_mouse.c | 41 +++++++++++++------ .../src/usb_interfaces/usb_interface_mouse.h | 5 ++- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/right/src/usb_descriptors/usb_descriptor_mouse_report.h b/right/src/usb_descriptors/usb_descriptor_mouse_report.h index eae03bdac..f112773b1 100644 --- a/right/src/usb_descriptors/usb_descriptor_mouse_report.h +++ b/right/src/usb_descriptors/usb_descriptor_mouse_report.h @@ -14,6 +14,11 @@ #define USB_MOUSE_REPORT_DESCRIPTOR_MIN_AXIS_PHYSICAL_VALUE -4096 #define USB_MOUSE_REPORT_DESCRIPTOR_MAX_AXIS_PHYSICAL_VALUE 4096 #define USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS 20 +#ifndef __ZEPHYR__ + #define USB_MOUSE_REPORT_ID 1 +#else + #define USB_MOUSE_REPORT_ID 0 // it is defined elsewhere +#endif #define USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE 1 #define USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE 120 @@ -31,6 +36,9 @@ HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_MOUSE), HID_RI_COLLECTION(8, HID_RI_COLLECTION_APPLICATION), HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_POINTER), +#if USB_MOUSE_REPORT_ID + HID_RI_REPORT_ID(8, USB_MOUSE_REPORT_ID), +#endif HID_RI_COLLECTION(8, HID_RI_COLLECTION_PHYSICAL), // Mouse buttons diff --git a/right/src/usb_interfaces/usb_interface_mouse.c b/right/src/usb_interfaces/usb_interface_mouse.c index adaa25b82..06b7f54f7 100644 --- a/right/src/usb_interfaces/usb_interface_mouse.c +++ b/right/src/usb_interfaces/usb_interface_mouse.c @@ -36,7 +36,18 @@ static void SwitchActiveUsbMouseReport(void) #ifndef __ZEPHYR__ -static uint8_t usbMouseFeatBuffer[USB_MOUSE_FEAT_REPORT_LENGTH]; +typedef struct { +#if USB_MOUSE_REPORT_ID + uint8_t id; +#endif + uint8_t scrollMultipliers; +} ATTR_PACKED usb_mouse_feature_report_t; + +static usb_mouse_feature_report_t usbMouseFeatureReport = { +#if USB_MOUSE_REPORT_ID + .id = USB_MOUSE_REPORT_ID +#endif +}; usb_hid_protocol_t UsbMouseGetProtocol(void) { @@ -49,6 +60,9 @@ usb_status_t UsbMouseAction(void) return kStatus_USB_Error; // The device is not attached } +#if USB_MOUSE_REPORT_ID + ActiveUsbMouseReport->id = USB_MOUSE_REPORT_ID; +#endif usb_status_t usb_status = USB_DeviceHidSend( UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX, (uint8_t *)ActiveUsbMouseReport, USB_MOUSE_REPORT_LENGTH); @@ -65,12 +79,12 @@ usb_status_t UsbMouseAction(void) float VerticalScrollMultiplier(void) { - return usbMouseFeatBuffer[0] & 0x01 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; + return usbMouseFeatureReport.scrollMultipliers & 0x01 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; } float HorizontalScrollMultiplier(void) { - return usbMouseFeatBuffer[0] & 0x04 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; + return usbMouseFeatureReport.scrollMultipliers & 0x04 ? USB_MOUSE_REPORT_DESCRIPTOR_MAX_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE : USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE; } usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param) @@ -80,7 +94,7 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param switch (event) { case ((uint32_t)-kUSB_DeviceEventSetConfiguration): - usbMouseFeatBuffer[0] = 0; + usbMouseFeatureReport.scrollMultipliers = 0; error = kStatus_USB_Success; break; case ((uint32_t)-kUSB_DeviceEventSetInterface): @@ -98,16 +112,17 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param case kUSB_DeviceHidEventGetReport: { usb_device_hid_report_struct_t *report = (usb_device_hid_report_struct_t*)param; - if (report->reportId != 0) { + if (report->reportId != USB_MOUSE_REPORT_ID) { error = kStatus_USB_InvalidRequest; - } else if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_INPUT && report->reportLength <= USB_MOUSE_REPORT_LENGTH) { + } else if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_INPUT) { report->reportBuffer = (void*)ActiveUsbMouseReport; + report->reportLength == USB_MOUSE_REPORT_LENGTH; UsbMouseActionCounter++; SwitchActiveUsbMouseReport(); error = kStatus_USB_Success; } else if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE) { - report->reportBuffer = usbMouseFeatBuffer; - report->reportLength = sizeof(usbMouseFeatBuffer); + report->reportBuffer = (void*)&usbMouseFeatureReport; + report->reportLength = sizeof(usbMouseFeatureReport); error = kStatus_USB_Success; } else { error = kStatus_USB_InvalidRequest; @@ -117,7 +132,8 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param case kUSB_DeviceHidEventSetReport: { usb_device_hid_report_struct_t *report = (usb_device_hid_report_struct_t*)param; - if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE && report->reportId == 0 && report->reportLength <= sizeof(usbMouseFeatBuffer)) { + if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE && + report->reportLength == sizeof(usbMouseFeatureReport)) { error = kStatus_USB_Success; } else { error = kStatus_USB_InvalidRequest; @@ -127,10 +143,9 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param case kUSB_DeviceHidEventRequestReportBuffer: { usb_device_hid_report_struct_t *report = (usb_device_hid_report_struct_t*)param; - if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE && report->reportId == 0 && report->reportLength <= sizeof(usbMouseFeatBuffer)) { - report->reportBuffer = usbMouseFeatBuffer; - // the only expected written value is this, set it early to workaround the bug - usbMouseFeatBuffer[0] = 0x5; + if (report->reportType == USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE) { + report->reportBuffer = (void*)&usbMouseFeatureReport; + report->reportLength = sizeof(usbMouseFeatureReport); error = kStatus_USB_Success; } else { error = kStatus_USB_AllocFail; diff --git a/right/src/usb_interfaces/usb_interface_mouse.h b/right/src/usb_interfaces/usb_interface_mouse.h index e1afe8a8f..2c7d98199 100644 --- a/right/src/usb_interfaces/usb_interface_mouse.h +++ b/right/src/usb_interfaces/usb_interface_mouse.h @@ -5,6 +5,7 @@ #include "usb_api.h" // #include "usb_descriptors/usb_descriptor_device.h" + #include "usb_descriptors/usb_descriptor_mouse_report.h" // Macros: @@ -18,7 +19,6 @@ #define USB_MOUSE_INTERRUPT_IN_INTERVAL 1 #define USB_MOUSE_REPORT_LENGTH (sizeof(usb_mouse_report_t)) - #define USB_MOUSE_FEAT_REPORT_LENGTH 1 // Typedefs: @@ -29,6 +29,9 @@ // reports to the boot protocol format when the host has set boot protocol // mode. typedef struct { +#ifdef USB_MOUSE_REPORT_ID + uint8_t id; +#endif uint32_t buttons : 24; int16_t x; int16_t y; From 2f31b1d9935c4d465343410fb78d6f7f80fd3284 Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Tue, 22 Apr 2025 23:53:15 +0200 Subject: [PATCH 3/4] uhk60: remove disfunctional mouse boot protocol support It wasn't implemented properly, but since nobody noticed, better to indicate to the host that it's not available. --- .../usb_descriptor_configuration.c | 4 ++-- .../src/usb_interfaces/usb_interface_mouse.c | 21 ------------------- .../src/usb_interfaces/usb_interface_mouse.h | 7 ------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/right/src/usb_descriptors/usb_descriptor_configuration.c b/right/src/usb_descriptors/usb_descriptor_configuration.c index 68cb94457..c0bffd41b 100644 --- a/right/src/usb_descriptors/usb_descriptor_configuration.c +++ b/right/src/usb_descriptors/usb_descriptor_configuration.c @@ -84,8 +84,8 @@ USB_INTERFACE_ALTERNATE_SETTING_NONE,\ USB_MOUSE_ENDPOINT_COUNT,\ USB_CLASS_HID,\ - USB_HID_SUBCLASS_BOOT,\ - USB_HID_PROTOCOL_MOUSE,\ + USB_HID_SUBCLASS_NONE,\ + USB_HID_PROTOCOL_NONE,\ USB_STRING_DESCRIPTOR_NONE,\ \ /* Mouse HID descriptor */\ diff --git a/right/src/usb_interfaces/usb_interface_mouse.c b/right/src/usb_interfaces/usb_interface_mouse.c index 06b7f54f7..72d30b7b6 100644 --- a/right/src/usb_interfaces/usb_interface_mouse.c +++ b/right/src/usb_interfaces/usb_interface_mouse.c @@ -15,7 +15,6 @@ static bool needsResending = false; static usb_mouse_report_t usbMouseReports[2]; -usb_hid_protocol_t usbMouseProtocol; uint32_t UsbMouseActionCounter; usb_mouse_report_t* ActiveUsbMouseReport = usbMouseReports; @@ -49,11 +48,6 @@ static usb_mouse_feature_report_t usbMouseFeatureReport = { #endif }; -usb_hid_protocol_t UsbMouseGetProtocol(void) -{ - return usbMouseProtocol; -} - usb_status_t UsbMouseAction(void) { if (!UsbCompositeDevice.attach) { @@ -71,9 +65,6 @@ usb_status_t UsbMouseAction(void) SwitchActiveUsbMouseReport(); } - // latch the active protocol to avoid ISR <-> Thread race - usbMouseProtocol = ((usb_device_hid_struct_t*)UsbCompositeDevice.mouseHandle)->protocol; - return usb_status; } @@ -153,18 +144,6 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param break; } - case kUSB_DeviceHidEventSetProtocol: { - uint8_t report = *(uint16_t*)param; - if (report <= 1) { - hidHandle->protocol = report; - error = kStatus_USB_Success; - } - else { - error = kStatus_USB_InvalidRequest; - } - break; - } - default: break; } diff --git a/right/src/usb_interfaces/usb_interface_mouse.h b/right/src/usb_interfaces/usb_interface_mouse.h index 2c7d98199..ebca45be5 100644 --- a/right/src/usb_interfaces/usb_interface_mouse.h +++ b/right/src/usb_interfaces/usb_interface_mouse.h @@ -22,12 +22,6 @@ // Typedefs: - // Note: We support boot protocol mode in this interface, thus the mouse - // report may not exceed 8 bytes and must conform to the HID mouse boot - // protocol as specified in the USB HID specification. If a different or - // longer format is desired in the future, we will need to translate sent - // reports to the boot protocol format when the host has set boot protocol - // mode. typedef struct { #ifdef USB_MOUSE_REPORT_ID uint8_t id; @@ -49,7 +43,6 @@ #ifndef __ZEPHYR__ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param); usb_status_t UsbMouseAction(void); - usb_hid_protocol_t UsbMouseGetProtocol(void); #endif float VerticalScrollMultiplier(void); From 042d3380c9141f7f41f96aeb2a00058aa56fb5e7 Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Wed, 30 Apr 2025 12:27:53 +0200 Subject: [PATCH 4/4] uhk60: fix mouse HID report descriptor --- right/src/usb_descriptors/usb_descriptor_mouse_report.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/right/src/usb_descriptors/usb_descriptor_mouse_report.h b/right/src/usb_descriptors/usb_descriptor_mouse_report.h index f112773b1..c18bf076e 100644 --- a/right/src/usb_descriptors/usb_descriptor_mouse_report.h +++ b/right/src/usb_descriptors/usb_descriptor_mouse_report.h @@ -79,8 +79,8 @@ HID_RI_REPORT_SIZE(8, 16), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), - HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), HID_RI_PUSH(0), + HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), HID_RI_LOGICAL_MINIMUM(8, 0), HID_RI_LOGICAL_MAXIMUM(8, 1), HID_RI_PHYSICAL_MINIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE), @@ -93,12 +93,11 @@ HID_RI_COLLECTION(8, HID_RI_COLLECTION_LOGICAL), // Horizontal wheel - HID_RI_USAGE_PAGE(8, HID_RI_USAGE_PAGE_CONSUMER), - HID_RI_USAGE(16, HID_RI_USAGE_CONSUMER_AC_PAN), + HID_RI_USAGE(32, (HID_RI_USAGE_PAGE_CONSUMER << 16) | HID_RI_USAGE_CONSUMER_AC_PAN), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), - HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), HID_RI_PUSH(0), + HID_RI_USAGE(8, HID_RI_USAGE_GENERIC_DESKTOP_RESOLUTION_MULTIPLIER), HID_RI_LOGICAL_MINIMUM(8, 0), HID_RI_LOGICAL_MAXIMUM(8, 1), HID_RI_PHYSICAL_MINIMUM(8, USB_MOUSE_REPORT_DESCRIPTOR_MIN_RESOLUTION_MULTIPLIER_PHYSICAL_VALUE),