Bug 48118 - IBM ScrollPoint mouse scrolls too fast
Summary: IBM ScrollPoint mouse scrolls too fast
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/evdev (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL: https://bugzilla.redhat.com/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-31 05:48 UTC by Trevor Cordes
Modified: 2013-10-21 06:42 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Add configuration options for smooth scrolling (1/2) (2.90 KB, patch)
2012-10-03 21:32 UTC, Peter De Wachter
no flags Details | Splinter Review
Export smooth scroll settings as Xinput properties (2/2) (6.75 KB, patch)
2012-10-03 21:33 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH 1/3] Map REL_DIAL to vertical scrolling (960 bytes, patch)
2013-03-20 00:43 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH 2/3] Add configuration options for smooth scrolling. (5.26 KB, patch)
2013-03-20 00:44 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH 3/3] Export smooth scroll settings as an XInput property. (6.94 KB, patch)
2013-03-20 00:47 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH v3 2/3] Add configuration options for smooth scrolling. (5.33 KB, patch)
2013-10-08 23:07 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH v3 3/3] Export smooth scroll settings as an XInput property. (6.25 KB, patch)
2013-10-08 23:07 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH v4 2/3] Add configuration options for smooth scrolling. (5.33 KB, patch)
2013-10-10 06:38 UTC, Peter De Wachter
no flags Details | Splinter Review
[PATCH v4 3/3] Export smooth scroll settings as an XInput property. (6.18 KB, patch)
2013-10-10 06:39 UTC, Peter De Wachter
no flags Details | Splinter Review

Description Trevor Cordes 2012-03-31 05:48:45 UTC
IBM ScrollPoint mouse MO18B 37L7318 has a special IBM eraser-tip type scroll-wheel device.  It is limited to 1 axis: vertical.  It creates events where the REL_WHEEL value is too high.  Tapping it gives values of 25, scrolling harder gives values of 63.  This causes the window to scroll so fast and in such magnitudes it is not humanly usable.

There are many versions of this mouse, and I assume all have the same problem.  There is a version of this mouse with horizontal scrolling in the same eraser-tip, but I don't own one.

Before evdev, this mouse ran under PS2 emulation I think and it worked much better then, extremely touchy, but usable.

Hacking evdev to cap REL_WHEEL at +/-1 makes it usable.  Perhaps hacking evdev to scale the value down would work even better.

See info in RH bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=807493
Comment 1 Trevor Cordes 2012-03-31 05:58:27 UTC
Some ancient conversation about this bug:


http://us.generation-nt.com/answer/patch-mousedev-fix-scrollwheel-thingy-ibm-scrollpoint-mice-help-181832041.html

Nice pics (mine is the one on the right, "Pro")
http://www.almaden.ibm.com/u/zhai/topics/scrollpoint.htm

and interesting bits about "high scrolling resolution and wide dynamic range, sub-line scrolling accuracy".  Not sure if "sub-line" scrolling is supported in evdev, ex: REL_WHEEL=0.25.  If we scaled down by 16X (for example), I think a 0<REL_WHEEL<1 value would be best served as being increased to 1.

Interesting bit from:
http://cgit.freedesktop.org/xorg/driver/xf86-input-mouse/tree/README

  ScrollPoint has a "stick" in between the two buttons.  This "stick" is
  the same as the stick-shaped pointing device often found on notebook
  computers, on which you move the mouse cursor by pushing the stick.
  The stick movement is recognized as the Z axis motion.  You can push
  the stick to right and left, as well as forward and backward. Give
  four numbers to ZAxisMapping option to map movement along all these
  four directions to button actions.

  This mouse is compatible with Logitech MouseMan+.  To use this mouse
  as the PS/2 device and the OS supports PS/2 mouse initialization:
Comment 2 Simon Thum 2012-04-01 14:05:01 UTC
When smooth scrolling was discussed with Max Schwartz (I might recall wrongly), we discussed using the axis resolution as means to cope with high-resolution devices.

That wasn't how it was implemented, but perhaps the option is still on the table? I admit I don't know the current code very well, so this might be bogus advice.
Comment 3 Peter Hutterer 2012-04-12 20:33:28 UTC
we have the scoll increment for exactly that reason, but it's automatically set and just 1/-1 for REL_(H)WHEEL. synaptics uses a default of 100 so that it doesn't scroll insanely fast.

the problem here is that we need an option to set this. presumably by the client.
Comment 4 Steve Riley 2012-05-01 10:59:16 UTC
I recently purchased a pair of these mice and immediately noticed the same problem -- scrolling is simply too fast to be usable. I traced the development of the bug report from Launchpad through RedHat and finally here at Free Desktop.

Just curious if there are plans to work a fix into evdev? Hacking driver source code is, alas, outside my scope of abilities...
Comment 5 Peter De Wachter 2012-10-03 21:31:37 UTC
I did some hacking and got these mice working pretty well.

First: all ScrollPoint mice can do horizontal scrolling, but that doesn't work due to missing kernel support. I made small module that fixes this: https://github.com/pdewacht/hid-scrollpoint/ . I'll submit this upstream once the scroll speed issue is fixed. (Hyper vertical scrolling is bad but hyper horizontal scrolling is way worse.)

I have two patches for the evdev input driver. The first creates options to set the scroll speed, so that you can add something like this to xorg.conf:

  Option "VertScrollDelta" "20"
  Option "HorizScrollDelta" "20"

The second patch creates XInput properties for these settings, so that these settings can be changed dynamically. (There are probably bugs here.)

What's missing is autoconfiguration. I'm not sure what the proper approach is.
Comment 6 Peter De Wachter 2012-10-03 21:32:43 UTC
Created attachment 68058 [details] [review]
Add configuration options for smooth scrolling (1/2)
Comment 7 Peter De Wachter 2012-10-03 21:33:26 UTC
Created attachment 68059 [details] [review]
Export smooth scroll settings as Xinput properties (2/2)
Comment 8 Peter Hutterer 2012-10-10 05:14:41 UTC
Comment on attachment 68058 [details] [review]
Add configuration options for smooth scrolling (1/2)

Review of attachment 68058 [details] [review]:
-----------------------------------------------------------------

looks good, but it's missing the man page bits. Please supply that as separate patch, I'll squash it in
Comment 9 Peter Hutterer 2012-10-10 05:22:45 UTC
Comment on attachment 68059 [details] [review]
Export smooth scroll settings as Xinput properties (2/2)

Review of attachment 68059 [details] [review]:
-----------------------------------------------------------------

looks good, a few comments though:
- please provide one property with three values instead of three properties
- synaptics names this property "Synaptics Scrolling Distance". We should name the evdev property "Evdev Scrolling Distance" to avoid confusion.
- "evdev: Failed to init float atom. Property support is disabled." is misleading since you don't actually exit here. Use xf86IDrvMsg instead, point out what is disabled and make the smooth scrolling props dependent on if (float_type)


I'm somewhat in two minds about this though. It's yet another driver-specific property when this should really be a proper protocol request in XI 2.3. I'll ponder this some more
Comment 10 Alex Corcoles 2013-03-16 12:38:40 UTC
What's the status on this?

I'm willing to test, as I just bought a Scrollpoint mouse and would like to have it fixed.

(gonna build with the patch and see what happens)
Comment 11 Peter De Wachter 2013-03-20 00:41:17 UTC
Sorry, I've been distracted for a while. I'll attach my updated patches.
Comment 12 Peter De Wachter 2013-03-20 00:43:09 UTC
Created attachment 76789 [details] [review]
[PATCH 1/3] Map REL_DIAL to vertical scrolling

This fixes a small inconsistency. EvdevAddAbsValuatorClass interprets REL_DIAL as horizontal motion, while the original EvdevAddRelValuatorClass code path interprets it as vertical motion. I assume this was not intended.
Comment 13 Peter De Wachter 2013-03-20 00:44:29 UTC
Created attachment 76790 [details] [review]
[PATCH 2/3] Add configuration options for smooth scrolling.

This adds the xorg.conf options. Now with documentation.
Comment 14 Peter De Wachter 2013-03-20 00:47:28 UTC
Created attachment 76791 [details] [review]
[PATCH 3/3] Export smooth scroll settings as an XInput property.

Creates a new XInput property "Evdev Scrolling Distance" with three values.

I'm really not sure if this interacts correctly with the "Allow relative scroll valuators on absolute devices (#54387)" change. I don't understand that code, and I don't know how to test it.
Comment 15 Trevor Cordes 2013-04-03 09:33:01 UTC
Hi again!  I'm trying to apply these 3 patches against the stock Fedora 17 SRPMs (xorg-x11-drv-evdev-2.7.3-5.fc17.src.rpm) so I can rpmbuild, but they won't apply.

Do these need to be applied against 2.8.0 or should they work on 2.7.3?  Or does 2.8.0 have them already?  Just wanted to check before I attempt to get 2.8.0 working with Fedora without having to mess with too many other things.

Thanks!
Comment 16 Trevor Cordes 2013-09-29 11:28:32 UTC
I finally got the patches you supplied to compile in, by upgrading to the newer Fedora with evdev xorg-x11-drv-evdev-2.8.1-2.fc19.i686

I am now running X with those patches installed.  However, I can't seem to figure out how to activate the new features in evdev.  It looks like you are supposed to add options to the mouse section of your xorg.conf, but I do not have an xorg.conf anymore, with xrandr doing everything.

I tried a few things but can't get it to trigger the new features in the patches.

I tried adding to /etc/X11/xorg.conf.d/99-scrollpoint-mouse.conf
Section "InputDevice"
  Identifier "ScrollPointMouse"
  Driver "evdev"
  Option "Device" "/dev/input/event2"
  Option "VertScrollDelta" "50.0"
EndSection

With various values for Device and VertScrollDelta.  I know it's reading that file because if I put a syntax error in it and startx it errors and dies.  I tried to guess the Device name based on Xorg.0.log output.

What is the preferred way to add the required option(s) to a modern system with xrandr?
Comment 17 Trevor Cordes 2013-09-29 14:17:38 UTC
Success!  I managed to get the setting to take effect by putting in the auto pointer stuff in /usr/share/X11/xorg.conf.d/10-evdev.conf

A value of 18 for VertScrollDelta seems to work well for my mouse and tastes.

I'll report back if I see any bugs or problems but so far it looks very nice!  I can pull the scrollpoint down a bit to scroll slow and pull it hard to scroll fast.

I'll still need to figure out what file I should really be setting these overrides but for now I can just edit the global file.  I tried as per my previous comment and tried putting it just in /etc/X11/xorg.conf and it always seems to be ignored by the stuff in /usr/share/X11/xorg.conf.d/10-evdev.conf.

What do we do to get this patch included in mainline?

Thanks!!
Comment 18 Peter De Wachter 2013-09-29 14:43:30 UTC
Trevor, try putting a file with the this content in /etc/X11/xorg.conf.d:

Section "InputClass"
  Identifier "ScrollPoint"
  MatchUSBID "04b3:3100|04b3:3103|04b3:3105|04b3:3108|04b3:3109"
  Option "VertScrollDelta" "16"
  Option "HorizScrollDelta" "16"
EndSection

The MatchUSBID line lists all ScrollPoint USB IDs that I know of. (There's always a chance that your mouse has a different one, you can use the lsusb command to check.) This way non-ScrollPoint mice will not be affected.
Comment 19 Peter Hutterer 2013-09-30 01:25:52 UTC
that is indeed a quirk that we could ship. Trevor, does this work for you?

having said that: use Match... inside an InputClass section to match your device, that way it'll work with hotplugging. InputDevice sections (Comment 16) need to be added to your ServerLayout, otherwise they aren't actually applied.
Comment 20 Trevor Cordes 2013-10-01 08:48:43 UTC
To the 2 Peters:

Yes, that syntax and file placement idea indeed solves the problem.  My mouse is 04b3:3103.

Shipping this fix sounds perfect!  I've been using it for a couple of days now without any issue.  I can't believe it, after 10 years or so I finally have a working scroll "wheel"!  Thanks for all the hard work and coming up with a solution, you just made my decade!  I'm going to go scroll for a few hours in celebration now.

PS: when I applied the patches against evdev 2.8.1 I had to remove the man page hunks to get them to apply.  Probably because of recent changes between versions.
Comment 21 Peter Hutterer 2013-10-06 23:00:33 UTC
(In reply to comment #12)
> Created attachment 76789 [details] [review] [review]
> [PATCH 1/3] Map REL_DIAL to vertical scrolling

pushed as 54a3120e339e55fc4721543abb15692c3e9ede09


as for the other two: I don't think it's necessary to use floats here. after all the input events we get from the kernel are ints only.
Comment 22 Peter De Wachter 2013-10-08 23:04:50 UTC
I used floats because the underlying SetScrollValuator API expects floats and it seemed nice to have for fine tuning.

I can live with ints though. I'll upload a revised patch.
Comment 23 Peter De Wachter 2013-10-08 23:07:15 UTC
Created attachment 87307 [details] [review]
[PATCH v3 2/3] Add configuration options for smooth scrolling.
Comment 24 Peter De Wachter 2013-10-08 23:07:57 UTC
Created attachment 87308 [details] [review]
[PATCH v3 3/3] Export smooth scroll settings as an XInput property.
Comment 25 Peter Hutterer 2013-10-09 05:37:30 UTC
man, I hate git am. For some reason 3/3 won't apply here because of some man page conflicts. Can you rebase on top of current master (a75c43830ef2f) and then re-attach here please? thanks.

Couple of minor changes please:
typo in 3/3: "Proprety".
CARD32 means unsigned int, use INT32 instead in the comment
nitpick: int* data = (int *)val->data;
should be int *data = (int *)val->data;

EvdevSetScrollValuators seems like an odd loop. We only care about REL_WHEEL, REL_DIAL, REL_HWHEEL, so you can treat those separately instead of looping from REL_X.
Comment 26 Peter De Wachter 2013-10-10 06:38:33 UTC
Created attachment 87367 [details] [review]
[PATCH v4 2/3] Add configuration options for smooth scrolling.
Comment 27 Peter De Wachter 2013-10-10 06:39:04 UTC
Created attachment 87368 [details] [review]
[PATCH v4 3/3] Export smooth scroll settings as an XInput property.
Comment 28 Peter De Wachter 2013-10-10 06:43:00 UTC
Here are the changes you requested. You're right I misunderstood that loop.
I've no clue what went wrong with the manpage but I've checked that this version applies cleanly on top of a75c43830ef2f.
Comment 29 Peter Hutterer 2013-10-21 06:42:54 UTC
commit d171b3d9194581cb6ed59dbe45d6cbf009dc0eaa
Author: Peter De Wachter <pdewacht@gmail.com>
Date:   Wed Oct 3 22:08:12 2012 +0200

    Export smooth scroll settings as an XInput property.

commit c3251deb4b988610c3766081345e49f538fca865
Author: Peter De Wachter <pdewacht@gmail.com>
Date:   Wed Oct 3 20:48:24 2012 +0200

    Add configuration options for smooth scrolling.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.