Unbreak relative mouse mode by adding pan to descriptor

This commit is contained in:
Ellie T 2024-11-22 22:15:30 +11:00
parent 28c3f1cdd1
commit 70f4991fba
2 changed files with 11 additions and 2 deletions

View File

@ -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 ), \

View File

@ -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;