diff options
| author | eynsai <47629346+eynsai@users.noreply.github.com> | 2024-10-06 05:26:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-06 11:26:55 +0200 |
| commit | 2cb35373c6ecc4341b538cc5ad37accf3e5030e4 (patch) | |
| tree | bd578fdeceb031dc54e43a8274255c58781a0db0 /tmk_core/protocol | |
| parent | bf6de46d7fd9ab185c57c1ebb9372ea980846040 (diff) | |
Extended wheel reports (#24422)
extended wheel reports
Diffstat (limited to 'tmk_core/protocol')
| -rw-r--r-- | tmk_core/protocol/report.h | 10 | ||||
| -rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 24 | ||||
| -rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 30 |
3 files changed, 49 insertions, 15 deletions
diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h index 0e4f6e9def..37c8ea48f1 100644 --- a/tmk_core/protocol/report.h +++ b/tmk_core/protocol/report.h | |||
| @@ -199,6 +199,12 @@ typedef int16_t mouse_xy_report_t; | |||
| 199 | typedef int8_t mouse_xy_report_t; | 199 | typedef int8_t mouse_xy_report_t; |
| 200 | #endif | 200 | #endif |
| 201 | 201 | ||
| 202 | #ifdef WHEEL_EXTENDED_REPORT | ||
| 203 | typedef int16_t mouse_hv_report_t; | ||
| 204 | #else | ||
| 205 | typedef int8_t mouse_hv_report_t; | ||
| 206 | #endif | ||
| 207 | |||
| 202 | typedef struct { | 208 | typedef struct { |
| 203 | #ifdef MOUSE_SHARED_EP | 209 | #ifdef MOUSE_SHARED_EP |
| 204 | uint8_t report_id; | 210 | uint8_t report_id; |
| @@ -210,8 +216,8 @@ typedef struct { | |||
| 210 | #endif | 216 | #endif |
| 211 | mouse_xy_report_t x; | 217 | mouse_xy_report_t x; |
| 212 | mouse_xy_report_t y; | 218 | mouse_xy_report_t y; |
| 213 | int8_t v; | 219 | mouse_hv_report_t v; |
| 214 | int8_t h; | 220 | mouse_hv_report_t h; |
| 215 | } PACKED report_mouse_t; | 221 | } PACKED report_mouse_t; |
| 216 | 222 | ||
| 217 | typedef struct { | 223 | typedef struct { |
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index 7454c9a7c4..0ac02bb19f 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c | |||
| @@ -165,20 +165,34 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { | |||
| 165 | # endif | 165 | # endif |
| 166 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), | 166 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), |
| 167 | 167 | ||
| 168 | // Vertical wheel (1 byte) | 168 | // Vertical wheel (1 or 2 bytes) |
| 169 | HID_RI_USAGE(8, 0x38), // Wheel | 169 | HID_RI_USAGE(8, 0x38), // Wheel |
| 170 | # ifndef WHEEL_EXTENDED_REPORT | ||
| 170 | HID_RI_LOGICAL_MINIMUM(8, -127), | 171 | HID_RI_LOGICAL_MINIMUM(8, -127), |
| 171 | HID_RI_LOGICAL_MAXIMUM(8, 127), | 172 | HID_RI_LOGICAL_MAXIMUM(8, 127), |
| 172 | HID_RI_REPORT_COUNT(8, 0x01), | 173 | HID_RI_REPORT_COUNT(8, 0x01), |
| 173 | HID_RI_REPORT_SIZE(8, 0x08), | 174 | HID_RI_REPORT_SIZE(8, 0x08), |
| 175 | # else | ||
| 176 | HID_RI_LOGICAL_MINIMUM(16, -32767), | ||
| 177 | HID_RI_LOGICAL_MAXIMUM(16, 32767), | ||
| 178 | HID_RI_REPORT_COUNT(8, 0x01), | ||
| 179 | HID_RI_REPORT_SIZE(8, 0x10), | ||
| 180 | # endif | ||
| 174 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), | 181 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), |
| 175 | // Horizontal wheel (1 byte) | 182 | // Horizontal wheel (1 or 2 bytes) |
| 176 | HID_RI_USAGE_PAGE(8, 0x0C), // Consumer | 183 | HID_RI_USAGE_PAGE(8, 0x0C),// Consumer |
| 177 | HID_RI_USAGE(16, 0x0238), // AC Pan | 184 | HID_RI_USAGE(16, 0x0238), // AC Pan |
| 185 | # ifndef WHEEL_EXTENDED_REPORT | ||
| 178 | HID_RI_LOGICAL_MINIMUM(8, -127), | 186 | HID_RI_LOGICAL_MINIMUM(8, -127), |
| 179 | HID_RI_LOGICAL_MAXIMUM(8, 127), | 187 | HID_RI_LOGICAL_MAXIMUM(8, 127), |
| 180 | HID_RI_REPORT_COUNT(8, 0x01), | 188 | HID_RI_REPORT_COUNT(8, 0x01), |
| 181 | HID_RI_REPORT_SIZE(8, 0x08), | 189 | HID_RI_REPORT_SIZE(8, 0x08), |
| 190 | # else | ||
| 191 | HID_RI_LOGICAL_MINIMUM(16, -32767), | ||
| 192 | HID_RI_LOGICAL_MAXIMUM(16, 32767), | ||
| 193 | HID_RI_REPORT_COUNT(8, 0x01), | ||
| 194 | HID_RI_REPORT_SIZE(8, 0x10), | ||
| 195 | # endif | ||
| 182 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), | 196 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), |
| 183 | HID_RI_END_COLLECTION(0), | 197 | HID_RI_END_COLLECTION(0), |
| 184 | HID_RI_END_COLLECTION(0), | 198 | HID_RI_END_COLLECTION(0), |
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index c8ab494253..886ee2375e 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
| @@ -524,23 +524,37 @@ const PROGMEM uchar shared_hid_report[] = { | |||
| 524 | # endif | 524 | # endif |
| 525 | 0x81, 0x06, // Input (Data, Variable, Relative) | 525 | 0x81, 0x06, // Input (Data, Variable, Relative) |
| 526 | 526 | ||
| 527 | // Vertical wheel (1 byte) | 527 | // Vertical wheel (1 or 2 bytes) |
| 528 | 0x09, 0x38, // Usage (Wheel) | 528 | 0x09, 0x38, // Usage (Wheel) |
| 529 | # ifndef WHEEL_EXTENDED_REPORT | ||
| 529 | 0x15, 0x81, // Logical Minimum (-127) | 530 | 0x15, 0x81, // Logical Minimum (-127) |
| 530 | 0x25, 0x7F, // Logical Maximum (127) | 531 | 0x25, 0x7F, // Logical Maximum (127) |
| 531 | 0x95, 0x01, // Report Count (1) | 532 | 0x95, 0x01, // Report Count (1) |
| 532 | 0x75, 0x08, // Report Size (8) | 533 | 0x75, 0x08, // Report Size (8) |
| 534 | # else | ||
| 535 | 0x16, 0x01, 0x80, // Logical Minimum (-32767) | ||
| 536 | 0x26, 0xFF, 0x7F, // Logical Maximum (32767) | ||
| 537 | 0x95, 0x01, // Report Count (1) | ||
| 538 | 0x75, 0x10, // Report Size (16) | ||
| 539 | # endif | ||
| 533 | 0x81, 0x06, // Input (Data, Variable, Relative) | 540 | 0x81, 0x06, // Input (Data, Variable, Relative) |
| 534 | // Horizontal wheel (1 byte) | 541 | // Horizontal wheel (1 or 2 bytes) |
| 535 | 0x05, 0x0C, // Usage Page (Consumer) | 542 | 0x05, 0x0C, // Usage Page (Consumer) |
| 536 | 0x0A, 0x38, 0x02, // Usage (AC Pan) | 543 | 0x0A, 0x38, 0x02, // Usage (AC Pan) |
| 537 | 0x15, 0x81, // Logical Minimum (-127) | 544 | # ifndef WHEEL_EXTENDED_REPORT |
| 538 | 0x25, 0x7F, // Logical Maximum (127) | 545 | 0x15, 0x81, // Logical Minimum (-127) |
| 546 | 0x25, 0x7F, // Logical Maximum (127) | ||
| 547 | 0x95, 0x01, // Report Count (1) | ||
| 548 | 0x75, 0x08, // Report Size (8) | ||
| 549 | # else | ||
| 550 | 0x16, 0x01, 0x80, // Logical Minimum (-32767) | ||
| 551 | 0x26, 0xFF, 0x7F, // Logical Maximum (32767) | ||
| 539 | 0x95, 0x01, // Report Count (1) | 552 | 0x95, 0x01, // Report Count (1) |
| 540 | 0x75, 0x08, // Report Size (8) | 553 | 0x75, 0x10, // Report Size (16) |
| 541 | 0x81, 0x06, // Input (Data, Variable, Relative) | 554 | # endif |
| 542 | 0xC0, // End Collection | 555 | 0x81, 0x06, // Input (Data, Variable, Relative) |
| 543 | 0xC0, // End Collection | 556 | 0xC0, // End Collection |
| 557 | 0xC0, // End Collection | ||
| 544 | #endif | 558 | #endif |
| 545 | 559 | ||
| 546 | #ifdef EXTRAKEY_ENABLE | 560 | #ifdef EXTRAKEY_ENABLE |
