Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High resolution scrolling and extended mouse wheel reports #24347

Draft
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

eynsai
Copy link
Contributor

@eynsai eynsai commented Aug 30, 2024

Description

This PR is for two closely related features (high resolution scrolling, and extended mouse wheel reports), as well as associated documentation.

Four settings macros/flags are added:

  • POINTING_DEVICE_HIRES_SCROLL_ENABLE
  • POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER
  • POINTING_DEVICE_HIRES_SCROLL_EXPONENT
  • WHEEL_EXTENDED_REPORT

The first three modify QMK's mouse report descriptor to enable high resolution scrolling. The fourth enables extended wheel reports, which work just like extended mouse reports. Extended wheel reports are more-or-less necessary for high resolution scrolling to work properly, because otherwise the wheel reports are typically too big to fit in an int8_t.

I also modified the USB report hooks in ChibiOS, LUFA, and VUSB by adding the ability to read resolution multiplier feature reports from the host computer. This allows the keyboard to know whether the host computer has chosen to use high-resolution scrolling (the keyboard can only advertise that it has high-resolution scrolling capability; the computer is in charge of deciding whether to use it). A function bool is_hires_scroll_on(void) is provided as an interface to this information. For platforms other than ChibiOS, LUFA, and VUSB, there is a default (weak) implementation of the function.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@zvecr zvecr changed the base branch from master to develop August 31, 2024 01:57
@eynsai
Copy link
Contributor Author

eynsai commented Aug 31, 2024

A few changes:

  • Removed drag scroll examples from docs; I'll make a separate PR for a "default drag scroll implementation".
  • Added ability for keyboard to parse resolution multiplier feature reports, at least on ChibiOS and LUFA. Not sure how to do it on the other platforms.

@IsaacElenbaas
Copy link
Contributor

Also just wanted to say this is a great first PR :) thank you for putting in all of the effort!

@drashna
Copy link
Member

drashna commented Sep 1, 2024

No VUSB support?

@eynsai
Copy link
Contributor Author

eynsai commented Sep 1, 2024

No VUSB support?

Oh my god there's separate USB HID descriptors in VUSB. I had no clue.

I'd like to support VUSB, but I don't have any keyboards that use VUSB, so I'm not sure I'd be able to test any code I write... not sure how to get past this roadblock on my own.

Earlier, I tried poking around at the VUSB code that handles USBRQ_HID_SET_REPORT. However, I was a bit confused - in ChibiOS and LUFA there's stuff there to deal with shared endpoints and NKRO, but not so in VUSB. I decided it would be safer to not touch anything, especially since I didn't have the ability to test any modified code.

Maybe now that I know that VUSB has its own HID descriptors, I can take a deeper look, I guess.

@eynsai
Copy link
Contributor Author

eynsai commented Sep 1, 2024

Also, I'd like to add that I've got the code ready for a default drag-scroll implementation hooked into pointing_device_task. However, the code depends on is_hires_scroll_on - which is part of this PR - so if I make a separate PR for drag-scroll, it'll be dependent on this PR... I'd appreciate any advice.

@eynsai
Copy link
Contributor Author

eynsai commented Sep 1, 2024

I think I've managed to bodge together the appropriate modifications to VUSB.

At this point, I haven't tested using LUFA or VUSB - only ChibiOS. Things compile on LUFA and VUSB, of course, but I don't have the hardware to actually verify that smooth scrolling works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants