mbox series

[0/8] HID: MS and Logitech high-resolution scroll wheel support

Message ID 20181122063409.15816-1-peter.hutterer@who-t.net (mailing list archive)
Headers show
Series HID: MS and Logitech high-resolution scroll wheel support | expand

Message

Peter Hutterer Nov. 22, 2018, 6:34 a.m. UTC
This series enables high-resolution scrolling on some or many Microsoft mice
of the last decade and Logitech mice with the required feature support.

High resolution scrolling is exposed to userspace as REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES. An accumulated value of 120 signals one wheel click, mice
with higher granularity can send multiple values that are fractions of 120.
REL_WHEEL and REL_HWHEEL are emulated for backwards compatibility.
The 120 magic number comes from Windows and affects how hardware vendors
build their shiny (and the use of a multiplier in the hw that is a whole
fraction of 120).

This series adds implementations for generic HID and for Logitech's HID++.

Windows Vista added the Resolution Multiplier HID feature which gives
us a multiplier that is applied (in hardware) to the wheel data. For the
same physical motion and an example multiplier of 8, the hardware may: 
- send 8 events of value 1, or
- send 1 event of value 8, or
- send 8/n events of value 1 * n
The multiplier is a HID Feature and should default to an effective 1 in the
hardware. Windows Vista and newer set this to the logical maximum, we do the
same now. It's an approved HID Feature but so far, this feature has only
been found on some Microsoft mice.

Logitech mice do not seem to use it and have their own HID++ protocol to
apply that multiplier. Harry's patchset had previously been merged, the
exact implementation was incompatible with the Microsoft bits though so it
was reverted. Harry's patches in this series are adjusted accordingly but
are by and large the same.

Notable: The Logitech REL_WHEEL emulation cannot just hook into the HID
bits. The firmware drops some events so the point when we get the REL_WHEEL
event moves around. This is worked around by directional resets and a
timeout-based reset.

Devices tested:
- Microsoft Comfort Optical Mouse 3000
- Microsoft Sculpt Ergonomic Mouse
- Microsoft Surface mouse
- Logitech MX Anywhere 2S

The following devices were tested for the HID feature and didn't have it:
- Logitech G500s, G303
- Roccat Kone XTD
- all the cheap Lenovo, HP, Dell, Logitech USB mice that come with a
  workstation that I could find in the local office
- Etekcity something something
- Razer Imperator
- Microsoft Classic IntelliMouse
- Microsoft Surface Mobile Mouse

Cheers,
  Peter

Harry Cutts (3):
      HID: logitech: Use LDJ_DEVICE macro for existing Logitech mice
      HID: logitech: Add function to enable HID++ 1.0 "scrolling acceleration"
      HID: logitech: Enable high-resolution scrolling on Logitech mice

Peter Hutterer (5):
      Input: add `REL_WHEEL_HI_RES` and `REL_HWHEEL_HI_RES`
      HID: core: store the collections as a basic tree
      HID: core: process the Resolution Multiplier
      HID: input: use the Resolution Multiplier for high-resolution scrolling
      HID: logitech-hidpp: fix typo, hiddpp to hidpp

 Documentation/input/event-codes.rst    |  21 +++-
 drivers/hid/hid-core.c                 | 174 ++++++++++++++++++++++++++++++++
 drivers/hid/hid-input.c                | 137 ++++++++++++++++++++++++-
 drivers/hid/hid-logitech-hidpp.c       | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 include/linux/hid.h                    |  10 ++
 include/uapi/linux/input-event-codes.h |   2 +
 6 files changed, 690 insertions(+), 38 deletions(-)

Comments

Harry Cutts Nov. 28, 2018, 11:22 p.m. UTC | #1
On Wed, 21 Nov 2018 at 22:34, Peter Hutterer <peter.hutterer@who-t.net> wrote:
> [snip]
> Devices tested:
> - Microsoft Comfort Optical Mouse 3000
> - Microsoft Sculpt Ergonomic Mouse
> - Microsoft Surface mouse
> - Logitech MX Anywhere 2S
>
> The following devices were tested for the HID feature and didn't have it:
> - Logitech G500s, G303
> - Roccat Kone XTD
> - all the cheap Lenovo, HP, Dell, Logitech USB mice that come with a
>   workstation that I could find in the local office
> - Etekcity something something
> - Razer Imperator
> - Microsoft Classic IntelliMouse
> - Microsoft Surface Mobile Mouse

I just tested the patches with the Microsoft Comfort Optical Mouse
3000. I also tested with the Microsoft Surface Precision mouse [0],
and like the Surface Mobile mouse it didn't seem to report the HID
feature (at least, it was only reporting REL_WHEEL_HI_RES changes of
120 in evtest).

For the series:
Acked-by: Harry Cutts <hcutts@chromium.org>
Verified-by: Harry Cutts <hcutts@chromium.org>

Harry Cutts
Chrome OS Touch/Input team

[0]: https://microsoft.com/en-us/p/surface-precision-mouse/8qc5p0d8ddjt
Peter Hutterer Nov. 29, 2018, 4:27 a.m. UTC | #2
On Wed, Nov 28, 2018 at 03:22:14PM -0800, Harry Cutts wrote:
> On Wed, 21 Nov 2018 at 22:34, Peter Hutterer <peter.hutterer@who-t.net> wrote:
> > [snip]
> > Devices tested:
> > - Microsoft Comfort Optical Mouse 3000
> > - Microsoft Sculpt Ergonomic Mouse
> > - Microsoft Surface mouse
> > - Logitech MX Anywhere 2S
> >
> > The following devices were tested for the HID feature and didn't have it:
> > - Logitech G500s, G303
> > - Roccat Kone XTD
> > - all the cheap Lenovo, HP, Dell, Logitech USB mice that come with a
> >   workstation that I could find in the local office
> > - Etekcity something something
> > - Razer Imperator
> > - Microsoft Classic IntelliMouse
> > - Microsoft Surface Mobile Mouse
> 
> I just tested the patches with the Microsoft Comfort Optical Mouse
> 3000. I also tested with the Microsoft Surface Precision mouse [0],
> and like the Surface Mobile mouse it didn't seem to report the HID
> feature (at least, it was only reporting REL_WHEEL_HI_RES changes of
> 120 in evtest).

IIRC that's the same mouse benjamin has and it does have the HID feature, it
just ends up reporting the same number of clicks anyway so there's no
visible effect. Which in itself is a good sign for the patch series, I
guess ;)

> For the series:
> Acked-by: Harry Cutts <hcutts@chromium.org>
> Verified-by: Harry Cutts <hcutts@chromium.org>

thanks, much appreciated.

Cheers,
   Peter

> Harry Cutts
> Chrome OS Touch/Input team
> 
> [0]: https://microsoft.com/en-us/p/surface-precision-mouse/8qc5p0d8ddjt
Benjamin Tissoires Nov. 29, 2018, 10:25 a.m. UTC | #3
On Thu, Nov 29, 2018 at 5:27 AM Peter Hutterer <peter.hutterer@who-t.net> wrote:
>
> On Wed, Nov 28, 2018 at 03:22:14PM -0800, Harry Cutts wrote:
> > On Wed, 21 Nov 2018 at 22:34, Peter Hutterer <peter.hutterer@who-t.net> wrote:
> > > [snip]
> > > Devices tested:
> > > - Microsoft Comfort Optical Mouse 3000
> > > - Microsoft Sculpt Ergonomic Mouse
> > > - Microsoft Surface mouse
> > > - Logitech MX Anywhere 2S
> > >
> > > The following devices were tested for the HID feature and didn't have it:
> > > - Logitech G500s, G303
> > > - Roccat Kone XTD
> > > - all the cheap Lenovo, HP, Dell, Logitech USB mice that come with a
> > >   workstation that I could find in the local office
> > > - Etekcity something something
> > > - Razer Imperator
> > > - Microsoft Classic IntelliMouse
> > > - Microsoft Surface Mobile Mouse
> >
> > I just tested the patches with the Microsoft Comfort Optical Mouse
> > 3000. I also tested with the Microsoft Surface Precision mouse [0],
> > and like the Surface Mobile mouse it didn't seem to report the HID
> > feature (at least, it was only reporting REL_WHEEL_HI_RES changes of
> > 120 in evtest).
>
> IIRC that's the same mouse benjamin has and it does have the HID feature, it
> just ends up reporting the same number of clicks anyway so there's no
> visible effect. Which in itself is a good sign for the patch series, I
> guess ;)
>
> > For the series:
> > Acked-by: Harry Cutts <hcutts@chromium.org>
> > Verified-by: Harry Cutts <hcutts@chromium.org>
>
> thanks, much appreciated.

Thanks everyone.

Just a small note that there is a mess up in Peter's series that he is
already aware of: patch 6/8 depends on 8/8 so there is either a small
refactoring to do or change the order of the patches.

I also have asked Peter to look for regression tests in hid-tools[0]
before I can merge this. FWIW, I am putting together a CI system that
will run this test suite for every submitted patch (plus a few other
tests). But the test suite simply lacks basic wheel testing, so it's
hard to see regressions :)

I should be able to apply the series in the next following days or
next week I think.

Cheers,
Benjamin

[0] https://gitlab.freedesktop.org/libevdev/hid-tools/