1
0
Fork 0

Extended wheel reports (#24422)

extended wheel reports
This commit is contained in:
eynsai 2024-10-06 05:26:55 -04:00 committed by GitHub
parent bf6de46d7f
commit 2cb35373c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 37 deletions

View file

@ -199,6 +199,12 @@ typedef int16_t mouse_xy_report_t;
typedef int8_t mouse_xy_report_t;
#endif
#ifdef WHEEL_EXTENDED_REPORT
typedef int16_t mouse_hv_report_t;
#else
typedef int8_t mouse_hv_report_t;
#endif
typedef struct {
#ifdef MOUSE_SHARED_EP
uint8_t report_id;
@ -210,8 +216,8 @@ typedef struct {
#endif
mouse_xy_report_t x;
mouse_xy_report_t y;
int8_t v;
int8_t h;
mouse_hv_report_t v;
mouse_hv_report_t h;
} PACKED report_mouse_t;
typedef struct {

View file

@ -165,20 +165,34 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = {
# endif
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
// Vertical wheel (1 byte)
HID_RI_USAGE(8, 0x38), // Wheel
// Vertical wheel (1 or 2 bytes)
HID_RI_USAGE(8, 0x38), // Wheel
# ifndef WHEEL_EXTENDED_REPORT
HID_RI_LOGICAL_MINIMUM(8, -127),
HID_RI_LOGICAL_MAXIMUM(8, 127),
HID_RI_REPORT_COUNT(8, 0x01),
HID_RI_REPORT_SIZE(8, 0x08),
# else
HID_RI_LOGICAL_MINIMUM(16, -32767),
HID_RI_LOGICAL_MAXIMUM(16, 32767),
HID_RI_REPORT_COUNT(8, 0x01),
HID_RI_REPORT_SIZE(8, 0x10),
# endif
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
// Horizontal wheel (1 byte)
HID_RI_USAGE_PAGE(8, 0x0C), // Consumer
HID_RI_USAGE(16, 0x0238), // AC Pan
// Horizontal wheel (1 or 2 bytes)
HID_RI_USAGE_PAGE(8, 0x0C),// Consumer
HID_RI_USAGE(16, 0x0238), // AC Pan
# ifndef WHEEL_EXTENDED_REPORT
HID_RI_LOGICAL_MINIMUM(8, -127),
HID_RI_LOGICAL_MAXIMUM(8, 127),
HID_RI_REPORT_COUNT(8, 0x01),
HID_RI_REPORT_SIZE(8, 0x08),
# else
HID_RI_LOGICAL_MINIMUM(16, -32767),
HID_RI_LOGICAL_MAXIMUM(16, 32767),
HID_RI_REPORT_COUNT(8, 0x01),
HID_RI_REPORT_SIZE(8, 0x10),
# endif
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
HID_RI_END_COLLECTION(0),
HID_RI_END_COLLECTION(0),

View file

@ -524,23 +524,37 @@ const PROGMEM uchar shared_hid_report[] = {
# endif
0x81, 0x06, // Input (Data, Variable, Relative)
// Vertical wheel (1 byte)
// Vertical wheel (1 or 2 bytes)
0x09, 0x38, // Usage (Wheel)
# ifndef WHEEL_EXTENDED_REPORT
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
# else
0x16, 0x01, 0x80, // Logical Minimum (-32767)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x95, 0x01, // Report Count (1)
0x75, 0x10, // Report Size (16)
# endif
0x81, 0x06, // Input (Data, Variable, Relative)
// Horizontal wheel (1 byte)
// Horizontal wheel (1 or 2 bytes)
0x05, 0x0C, // Usage Page (Consumer)
0x0A, 0x38, 0x02, // Usage (AC Pan)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
# ifndef WHEEL_EXTENDED_REPORT
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
# else
0x16, 0x01, 0x80, // Logical Minimum (-32767)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection
0xC0, // End Collection
0x75, 0x10, // Report Size (16)
# endif
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection
0xC0, // End Collection
#endif
#ifdef EXTRAKEY_ENABLE