From 70f4991fba4873dd71d17dc32f334d02565da16f Mon Sep 17 00:00:00 2001 From: Ellie T Date: Fri, 22 Nov 2024 22:15:30 +1100 Subject: [PATCH] Unbreak relative mouse mode by adding pan to descriptor --- src/include/usb_descriptors.h | 9 +++++++++ src/usb_descriptors.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/usb_descriptors.h b/src/include/usb_descriptors.h index 65f1ed4..ae23af7 100644 --- a/src/include/usb_descriptors.h +++ b/src/include/usb_descriptors.h @@ -198,6 +198,15 @@ HID_COLLECTION_END \ HID_REPORT_COUNT( 1 ) ,\ HID_REPORT_SIZE ( 8 ) ,\ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ) ,\ + /* Horizontal wheel (AC Pan) */ \ + HID_USAGE_PAGE ( HID_USAGE_PAGE_CONSUMER ) ,\ + HID_LOGICAL_MIN ( 0x81 ) ,\ + HID_LOGICAL_MAX ( 0x7f ) ,\ + HID_REPORT_COUNT( 1 ) ,\ + HID_REPORT_SIZE ( 8 ) ,\ + HID_USAGE_N ( HID_USAGE_CONSUMER_AC_PAN, 2 ) ,\ + HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ) ,\ + \ /* Mouse mode (0 = absolute, 1 = relative) */ \ HID_REPORT_COUNT( 1 ), \ HID_REPORT_SIZE ( 8 ), \ diff --git a/src/usb_descriptors.c b/src/usb_descriptors.c index 2f02594..ef665a0 100644 --- a/src/usb_descriptors.c +++ b/src/usb_descriptors.c @@ -81,10 +81,10 @@ uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance) { } } - uint8_t instance = ITF_NUM_HID; - uint8_t report_id = REPORT_ID_MOUSE; bool tud_mouse_report(uint8_t mode, uint8_t buttons, int16_t x, int16_t y, int8_t wheel, int8_t pan) { mouse_report_t report = {.buttons = buttons, .wheel = wheel, .x = x, .y = y, .mode = mode, .pan = pan}; + uint8_t instance = ITF_NUM_HID; + uint8_t report_id = REPORT_ID_MOUSE; if (mode == RELATIVE) { instance = ITF_NUM_HID_REL_M;