summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authoreynsai <47629346+eynsai@users.noreply.github.com>2025-04-22 18:04:31 -0400
committerGitHub <noreply@github.com>2025-04-23 00:04:31 +0200
commit7a2cd0fa962eb5e6e18ce8b0213a7171bc823c1f (patch)
treed7c62b67ba4d9402b822768d7013803d99cb9484 /tmk_core
parent83818d1d6f7d1f590946756ad552e407bf9a2e1f (diff)
High resolution scrolling (without feature report parsing) (#24423)
* hires scrolling without feature report parsing * fix valid range for exponent * fix incorrect minimum exponent value documentation
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/usb_descriptor.c24
-rw-r--r--tmk_core/protocol/usb_descriptor_common.h20
-rw-r--r--tmk_core/protocol/vusb/vusb.c28
3 files changed, 70 insertions, 2 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index c7fb660b65..ceab9eef9a 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -165,6 +165,24 @@ 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# ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
169 HID_RI_COLLECTION(8, 0x02),
170 // Feature report and padding (1 byte)
171 HID_RI_USAGE(8, 0x48), // Resolution Multiplier
172 HID_RI_REPORT_COUNT(8, 0x01),
173 HID_RI_REPORT_SIZE(8, 0x02),
174 HID_RI_LOGICAL_MINIMUM(8, 0x00),
175 HID_RI_LOGICAL_MAXIMUM(8, 0x01),
176 HID_RI_PHYSICAL_MINIMUM(8, 1),
177 HID_RI_PHYSICAL_MAXIMUM(8, POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER),
178 HID_RI_UNIT_EXPONENT(8, POINTING_DEVICE_HIRES_SCROLL_EXPONENT),
179 HID_RI_FEATURE(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
180 HID_RI_PHYSICAL_MINIMUM(8, 0x00),
181 HID_RI_PHYSICAL_MAXIMUM(8, 0x00),
182 HID_RI_REPORT_SIZE(8, 0x06),
183 HID_RI_FEATURE(8, HID_IOF_CONSTANT),
184# endif
185
168 // Vertical wheel (1 or 2 bytes) 186 // Vertical wheel (1 or 2 bytes)
169 HID_RI_USAGE(8, 0x38), // Wheel 187 HID_RI_USAGE(8, 0x38), // Wheel
170# ifndef WHEEL_EXTENDED_REPORT 188# ifndef WHEEL_EXTENDED_REPORT
@@ -179,6 +197,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = {
179 HID_RI_REPORT_SIZE(8, 0x10), 197 HID_RI_REPORT_SIZE(8, 0x10),
180# endif 198# endif
181 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), 199 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
200
182 // Horizontal wheel (1 or 2 bytes) 201 // Horizontal wheel (1 or 2 bytes)
183 HID_RI_USAGE_PAGE(8, 0x0C),// Consumer 202 HID_RI_USAGE_PAGE(8, 0x0C),// Consumer
184 HID_RI_USAGE(16, 0x0238), // AC Pan 203 HID_RI_USAGE(16, 0x0238), // AC Pan
@@ -194,6 +213,11 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = {
194 HID_RI_REPORT_SIZE(8, 0x10), 213 HID_RI_REPORT_SIZE(8, 0x10),
195# endif 214# endif
196 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), 215 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
216
217# ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
218 HID_RI_END_COLLECTION(0),
219# endif
220
197 HID_RI_END_COLLECTION(0), 221 HID_RI_END_COLLECTION(0),
198 HID_RI_END_COLLECTION(0), 222 HID_RI_END_COLLECTION(0),
199# ifndef MOUSE_SHARED_EP 223# ifndef MOUSE_SHARED_EP
diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h
index 909c230a99..f782d83fbc 100644
--- a/tmk_core/protocol/usb_descriptor_common.h
+++ b/tmk_core/protocol/usb_descriptor_common.h
@@ -32,3 +32,23 @@
32#ifndef RAW_USAGE_ID 32#ifndef RAW_USAGE_ID
33# define RAW_USAGE_ID 0x61 33# define RAW_USAGE_ID 0x61
34#endif 34#endif
35
36/////////////////////
37// Hires Scroll Defaults
38
39#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
40# ifdef POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER
41# if POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER > 127 || POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER < 1
42# error "POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER must be between 1 and 127, inclusive!"
43# endif
44# else
45# define POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER 120
46# endif
47# ifdef POINTING_DEVICE_HIRES_SCROLL_EXPONENT
48# if POINTING_DEVICE_HIRES_SCROLL_EXPONENT > 127 || POINTING_DEVICE_HIRES_SCROLL_EXPONENT < 0
49# error "POINTING_DEVICE_HIRES_SCROLL_EXPONENT must be between 0 and 127, inclusive!"
50# endif
51# else
52# define POINTING_DEVICE_HIRES_SCROLL_EXPONENT 0
53# endif
54#endif \ No newline at end of file
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index fdbfcc17dc..56cf82e5a6 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -520,6 +520,24 @@ const PROGMEM uchar shared_hid_report[] = {
520# endif 520# endif
521 0x81, 0x06, // Input (Data, Variable, Relative) 521 0x81, 0x06, // Input (Data, Variable, Relative)
522 522
523# ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
524 // Feature report and padding (1 byte)
525 0xA1, 0x02, // Collection (Logical)
526 0x09, 0x48, // Usage (Resolution Multiplier)
527 0x95, 0x01, // Report Count (1)
528 0x75, 0x02, // Report Size (2)
529 0x15, 0x00, // Logical Minimum (0)
530 0x25, 0x01, // Logical Maximum (1)
531 0x35, 0x01, // Physical Minimum (1)
532 0x45, POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER, // Physical Maximum (POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER)
533 0x55, POINTING_DEVICE_HIRES_SCROLL_EXPONENT, // Unit Exponent (POINTING_DEVICE_HIRES_SCROLL_EXPONENT)
534 0xB1, 0x02, // Feature (Data, Variable, Absolute)
535 0x35, 0x00, // Physical Minimum (0)
536 0x45, 0x00, // Physical Maximum (0)
537 0x75, 0x06, // Report Size (6)
538 0xB1, 0x03, // Feature (Constant)
539# endif
540
523 // Vertical wheel (1 or 2 bytes) 541 // Vertical wheel (1 or 2 bytes)
524 0x09, 0x38, // Usage (Wheel) 542 0x09, 0x38, // Usage (Wheel)
525# ifndef WHEEL_EXTENDED_REPORT 543# ifndef WHEEL_EXTENDED_REPORT
@@ -534,6 +552,7 @@ const PROGMEM uchar shared_hid_report[] = {
534 0x75, 0x10, // Report Size (16) 552 0x75, 0x10, // Report Size (16)
535# endif 553# endif
536 0x81, 0x06, // Input (Data, Variable, Relative) 554 0x81, 0x06, // Input (Data, Variable, Relative)
555
537 // Horizontal wheel (1 or 2 bytes) 556 // Horizontal wheel (1 or 2 bytes)
538 0x05, 0x0C, // Usage Page (Consumer) 557 0x05, 0x0C, // Usage Page (Consumer)
539 0x0A, 0x38, 0x02, // Usage (AC Pan) 558 0x0A, 0x38, 0x02, // Usage (AC Pan)
@@ -549,8 +568,13 @@ const PROGMEM uchar shared_hid_report[] = {
549 0x75, 0x10, // Report Size (16) 568 0x75, 0x10, // Report Size (16)
550# endif 569# endif
551 0x81, 0x06, // Input (Data, Variable, Relative) 570 0x81, 0x06, // Input (Data, Variable, Relative)
552 0xC0, // End Collection 571
553 0xC0, // End Collection 572# ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
573 0xC0, // End Collection
574# endif
575
576 0xC0, // End Collection
577 0xC0, // End Collection
554#endif 578#endif
555 579
556#ifdef EXTRAKEY_ENABLE 580#ifdef EXTRAKEY_ENABLE