[RFC PATCH 0/5] Add high-resolution 2D mouse wheel support to USB HID

Soumyajyotii Ssarkar posted 5 patches 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260331170823.72511-1-soumyajyotisarkar23@gmail.com
hw/input/hid.c         | 117 ++++++++++++++++++++++---
hw/usb/dev-hid.c       | 191 ++++++++++++++++++++++++++++++++---------
include/hw/input/hid.h |   5 ++
3 files changed, 262 insertions(+), 51 deletions(-)
[RFC PATCH 0/5] Add high-resolution 2D mouse wheel support to USB HID
Posted by Soumyajyotii Ssarkar 1 week, 4 days ago
This RFC series adds high resolution vertical and horizontal wheel support
to QEMU's USB HID mouse device.

The current USB HID mouse implementation only reports fixed wheel deltas and
does not support horizontal scrolling.
Modern touchpads and trackpoints can generate finer grained wheel movement
and simultaneous horizontal & vertical scrolling,
however guests currently cannot make use of these capabilities.

Windows Vista onward their has been support for
Microsoft's high resolution wheel protocol,  including resolution multipliers
and horizontal scrolling via AC Pan usage.

This series updates the USB HID mouse descriptor and report format to support:
- High-resolution vertical wheel events
- Horizontal wheel / AC Pan events
- Resolution multiplier feature reports
- Simultaneous vertical and horizontal scrolling
- Boot protocol compatibility
The enhanced report protocol uses Report ID 1 for pointer input reports and
Report ID 2 for wheel resolution feature reports. Moreover, vertical wheel scaling and
horizontal pan scaling are preserved across VM migration using residual state.

With this change, guests can receive smaller wheel deltas
such as 25 units instead of only legacy 120-unit wheel notches,
resulting in smoother scrolling behavior in Windows and Linux guests.

Testing was performed using Windows 10 guest and Microsoft's wheel event viewer:
https://domeventviewer.com/wheel-event-viewer.html

Observed behavior:
- Without patch: wheel delta values appear as coarse 120-unit steps
- With patch: wheel delta values appear as smaller increments
- Horizontal scrolling events are reported correctly

Reference documentation:
https://download.microsoft.com/download/b/d/1/bd1f7ef4-7d72-419e-bc5c-9f79ad7bb66e/wheel.docx

Signed-off-by: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>

Soumyajyotii Ssarkar (5):
  input/hid: add horizontal pan to pointer event path
  usb/hid: add enhanced wheel mouse report descriptor and packet size
  input/hid: emit protocol aware mouse reports with pan support
  usb/hid: handle mouse feature report for wheel/pan multipliers
  input/hid: apply multiplier scaling with residual accumulation

 hw/input/hid.c         | 117 ++++++++++++++++++++++---
 hw/usb/dev-hid.c       | 191 ++++++++++++++++++++++++++++++++---------
 include/hw/input/hid.h |   5 ++
 3 files changed, 262 insertions(+), 51 deletions(-)

--
2.53.0