From 8e0560e4d3aa9684020b8ce912e1a71fa7c5e4d8 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Tue, 12 Nov 2024 08:06:17 -0800 Subject: [PATCH] [Mouse] Add 32 buttons for mouse reports Because why the fuck not --- quantum/mousekey.c | 2 +- quantum/pointing_device/pointing_device.c | 4 ++-- tmk_core/protocol/report.h | 4 ++-- tmk_core/protocol/usb_descriptor.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 9649943a0d..723be72bf0 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -655,7 +655,7 @@ void mousekey_clear(void) { static void mousekey_debug(void) { if (!debug_mouse) return; print("mousekey [btn|x y v h](rep/acl): ["); - print_hex8(mouse_report.buttons); + print_hex32(mouse_report.buttons); print("|"); print_decs(mouse_report.x); print(" "); diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c index 3d1de8cb6f..9d2cff6bd4 100644 --- a/quantum/pointing_device/pointing_device.c +++ b/quantum/pointing_device/pointing_device.c @@ -195,7 +195,7 @@ __attribute__((weak)) bool pointing_device_send(void) { host_mouse_send(&local_mouse_report); } // send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device - uint8_t buttons = local_mouse_report.buttons; + uint32_t buttons = local_mouse_report.buttons; memset(&local_mouse_report, 0, sizeof(local_mouse_report)); local_mouse_report.buttons = buttons; @@ -278,7 +278,7 @@ __attribute__((weak)) bool pointing_device_task(void) { #if defined(SPLIT_POINTING_ENABLE) # if defined(POINTING_DEVICE_COMBINED) - static uint8_t old_buttons = 0; + static uint32_t old_buttons = 0; local_mouse_report.buttons = old_buttons; local_mouse_report = pointing_device_driver->get_report(local_mouse_report); old_buttons = local_mouse_report.buttons; diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h index d854f51d5c..c8cd7b5533 100644 --- a/tmk_core/protocol/report.h +++ b/tmk_core/protocol/report.h @@ -29,7 +29,7 @@ along with this program. If not, see . // clang-format off /* HID report IDs */ -enum hid_report_ids { +enum hid_report_ids { REPORT_ID_ALL = 0, REPORT_ID_KEYBOARD = 1, REPORT_ID_MOUSE, @@ -209,7 +209,7 @@ typedef struct { #ifdef MOUSE_SHARED_EP uint8_t report_id; #endif - uint8_t buttons; + uint32_t buttons; #ifdef MOUSE_EXTENDED_REPORT int8_t boot_x; int8_t boot_y; diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index c7fb660b65..87a2f1a008 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -135,10 +135,10 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { // Buttons (8 bits) HID_RI_USAGE_PAGE(8, 0x09), // Button HID_RI_USAGE_MINIMUM(8, 0x01), // Button 1 - HID_RI_USAGE_MAXIMUM(8, 0x08), // Button 8 + HID_RI_USAGE_MAXIMUM(8, 0x20), // Button 8 HID_RI_LOGICAL_MINIMUM(8, 0x00), HID_RI_LOGICAL_MAXIMUM(8, 0x01), - HID_RI_REPORT_COUNT(8, 0x08), + HID_RI_REPORT_COUNT(8, 0x20), HID_RI_REPORT_SIZE(8, 0x01), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),