Re: Logitech high-resolution scrolling..

From: Linus Torvalds
Date: Mon Oct 29 2018 - 17:12:02 EST


On Mon, Oct 29, 2018 at 12:17 PM Harry Cutts <hcutts@xxxxxxxxxxxx> wrote:
>
> I don't really understand why the half-multiplier thing would cause
> the instability; there's still a low-res threshold every 8 high-res
> units whichever way you do it

No there isn't.

So what the half-multiplier did, assuming a multiplier of 8 (which is
what my MX Anywhere 2S reports) would be:

- remainder starts at 3
- high-res is +1
- now remainder is 3+1, and it triggers the >= half logic
- 4/8 is 0, but then the code added 1 because high-res was positive,
so the code decides to add 1
- the code does a wheel update of 1, and updates remainder with -8,
so now it's -4

Next time around, if the high-res update is 0 or -1, it will go the
other direction. And then it will oscillate.

Notice how tiny movements of +1/-1 in the *high-res* count can
translate into +1/-1 in the regular wheel movement.

And those tiny movements very definitely happen. Maybe it's just my
mouse, but the undeniable fact is that the old algorithm was simply
not stable.

It was literally unusable. I had to be careful not to even touch the
wheel at all, or it would scroll randomly.

I do not believe that you actually ever *used* that code, or if you
did, you only did so with applications that were high-res aware and
ignored the regular wheel entirely because you were testing in an
environment with other changes than just the kernel.

Linus