5

I have an Optical GreatEye Wheelmouse which has 2 scroll wheels and 5 "buttons" (three including middle as "click" on first scroll wheel) and left and right side buttons (dark side areas in image below) and despite the xinput --list-props output looking correct BOTH scroll wheels are behaving as buttons 4 and 5 instead of the second one working on 6 and 7, why is this and how do I fix it (get 2nd scroll wheel working as horizontal scroll wheel would)?

Manufacter's Product Image of A4Tech Optical GreatEye Wheelmouse

Above image from: A4Tech website

Output from xinput list-props # where # is the correct device Id:

Device 'ImExPS/2 Generic Explorer Mouse':
    Device Enabled (142):   1
    Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (269): 0
    Device Accel Constant Deceleration (270):   1.000000
    Device Accel Adaptive Deceleration (271):   1.000000
    Device Accel Velocity Scaling (272):    10.000000
    Device Product ID (261):    2, 6
    Device Node (262):  "/dev/input/event1"
    Evdev Axis Inversion (273): 0, 0
    Evdev Axes Swap (275):  0
    Axis Labels (276):  "Rel X" (152), "Rel Y" (153), "Rel Horiz Wheel" (267), "Rel Vert Wheel" (268)
    Button Labels (277):    "Button Left" (145), "Button Middle" (146), "Button Right" (147), "Button Wheel Up" (148), "Button Wheel Down" (149), "Button Horiz Wheel Left" (150), "Button Horiz Wheel Right" (151), "Button Side" (265), "Button Extra" (266), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264)
    Evdev Scrolling Distance (278): 1, 1, 1
    Evdev Middle Button Emulation (279):    0
    Evdev Middle Button Timeout (280):  50
    Evdev Third Button Emulation (281): 0
    Evdev Third Button Emulation Timeout (282): 1000
    Evdev Third Button Emulation Button (283):  3
    Evdev Third Button Emulation Threshold (284):   20
    Evdev Wheel Emulation (285):    0
    Evdev Wheel Emulation Axes (286):   0, 0, 4, 5
    Evdev Wheel Emulation Inertia (287):    10
    Evdev Wheel Emulation Timeout (288):    200
    Evdev Wheel Emulation Button (289): 4
    Evdev Drag Lock Buttons (290):  0

Using xev I have seen that the events being seen for the two scroll wheels are identical. To me this suggests that it is a kernel/module issue, I am using Debian "Jessie" with backports - the latter mean that I am currently using, as per uname -a:

Linux XXXXX 4.9.0-0.bpo.1-rt-amd64 #1 SMP PREEMPT RT Debian 4.9.2-2~bpo8+1 (2017-01-26) x86_64 GNU/Linux

As a speculative hypothesis I am wondering (give the limited number of mice that actually have more that one real scroll-wheel) whether this might be something actually kernel related - so, as a supplementary answer, where could I start looking to find out more about what is going wrong?

Update: perhaps I was wrong, in that:

Evdev Wheel Emulation Axes (286):     0, 0, 4, 5

should be:

Evdev Wheel Emulation Axes (286):     6, 7, 4, 5

but just changing that with xinput set-props # 286 6 7 4 5 where # is the correct ID number did not in itself produce any changes...

Curiously, grep-ping my /var/log/Xorg.0.log file yields:

[    46.173] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/event1)
[    46.173] (**) ImExPS/2 Generic Explorer Mouse: Applying InputClass "evdev pointer catchall"
[    46.173] (**) ImExPS/2 Generic Explorer Mouse: Applying InputClass "evdev pointer catchall"
[    46.173] (II) Using input driver 'evdev' for 'ImExPS/2 Generic Explorer Mouse'
[    46.173] (**) ImExPS/2 Generic Explorer Mouse: always reports core events
[    46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: Device: "/dev/input/event1"
[    46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Vendor 0x2 Product 0x6
[    46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found 9 mouse buttons
[    46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found scroll wheel(s)
[    46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found relative axes
[    46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found x and y relative axes
[    46.173] (II) evdev: ImExPS/2 Generic Explorer Mouse: Configuring as mouse
[    46.173] (II) evdev: ImExPS/2 Generic Explorer Mouse: Adding scrollwheel support
[    46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: YAxisMapping: buttons 4 and 5
[    46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[    46.173] (II) XINPUT: Adding extended input device "ImExPS/2 Generic Explorer Mouse" (type: MOUSE, id 9)
[    46.174] (II) evdev: ImExPS/2 Generic Explorer Mouse: initialized for relative axes.
[    46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) keeping acceleration scheme 1
[    46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration profile 0
[    46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration factor: 2.000
[    46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration threshold: 4
[    46.174] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/mouse0)

Note that although there is a line including YAxisMapping: buttons 4 and 5 there is no corresponding XAxisMapping: buttons 6 and 7 - which is suggestive...

Note: (in response to comment) it is a PS/2 connector mouse so USB related diagnostics are probably not going to be helpful.

After installing the evtest package I found that the events for the two scroll wheels had the same type 2 (EV_REL), code 8 (EV_WHEEL) but that the first scroll wheel had value 1 or -1 (for movement in the two opposite directions) but the second scroll wheel had value 2 or -2. Interestingly I recall that in use I had notice that in some applications the second scroll wheel produced scrolling actions TWICE as large as for the first - which is starting to sound like some code could be misinterpreting value as a move quantity rather than a "direction"!

1
  • Working through the input hierarchy: Is it an USB device? Is it a HID device (check dmesg)? What kind of events do you see when you run evtest as root on the mouse device? Are the two wheels distinguishable that way? If not, do you get distinguishable events in the hidraw device with usbhid-dump, assuming it's a HID device?
    – dirkt
    Mar 2, 2017 at 17:29

1 Answer 1

7

It seems as though this was noted fifteen years ago! A series of posts over a couple of days (2002/07/17-18) on the Linux Kernel Mailing List, with the title "PS2 Input Core Support" suggests that this was known about but as there was more than one way to process the same data it was likely to have to be handled for this particular product with a manual module parameter. However that never seemed to materialise. The details can best be seen in this post:

...

Problem is that A4Tech driver does not care. It just interprets incoming data in the way I described: +-1 is vertical move, +-2 is horizontal, 0 is no move, and everything else is ignored... This is A4Tech's interpretation of ImPS/2 and ExPS/2 protocols.

So we can either assume (like GPM does) that wheel movement can be only +-1, and so we can safely assume that +-2 is horizontal move, and then everything is fine, or we need some option which will affect mouse driver behavior.

All my (A4Tech...) PS/2 wheel mouse report wheel movement only +-1 even with 10Hz sample rate, but I do not think that my mouses are representative sample of available ExPS/2 implementations.

No, normal ImPS/2 and ExPS/2 mice indeed can report values greater than 1 for wheel movement.

We can either make some heuristic (ever saw movement of 3? If yes, then it's not an A4Tech mouse ...), or go for the command line parameter.

I guess I'll pull out some of my A4Tech mice and torture them a bit to see if they'd react to some sequence ...

Another thing is then USB A4Tech mice, which use a button to differentiate between the wheels, while the USB spec has provisions for two wheels on a mouse :(. But those are at least possible to detect.

--
Vojtech Pavlik
SuSE Labs

So I intend to engage in a bit of kernel hackery to add a module parameter to ./drivers/input/mouse/psmouse_base.c to clobber the data read from the mouse to fix it up when enabled for the case of psmouse_type being PSMOUSE_IMEX.

Well, I have something that now works for me and have posted it to the Linux Kernel Input group's area as input: psmouse - fix for second scroll wheel on A4Tech Dual-Scroll wheel mice but as it will be of use to only a very small group of users I am not sure that it will make it in. The patch is fairly small but because it modifies the behaviour that will be incompatible with other mice which use the PS/2 mouse protocol in a more normal manner it will not be activated by default. As a module it would be enabled by an option psmouse a4tech_hack=1 in modules.conf or whatever is used on the system nowadays - using evtest to demonstrate gives, first with the hack disabled:

stephen@Ripley:~$ sudo modprobe psmouse options a4tech_hack=0 stephen@Ripley:~$ sudo evtest --grab /dev/input/event1 Input driver version is 1.0.1 Input device ID: bus 0x11 vendor 0x2 product 0x6 version 0x0 Input device name: "ImExPS/2 Generic Explorer Mouse" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 272 (BTN_LEFT) Event code 273 (BTN_RIGHT) Event code 274 (BTN_MIDDLE) Event code 275 (BTN_SIDE) Event code 276 (BTN_EXTRA) Event type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 6 (REL_HWHEEL) Event code 8 (REL_WHEEL) Properties: Property type 0 (INPUT_PROP_POINTER) Testing ... (interrupt to exit) Event: time 1511190325.037494, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.037494, -------------- SYN_REPORT ------------ Event: time 1511190325.069545, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.069545, -------------- SYN_REPORT ------------ Event: time 1511190325.103279, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.103279, -------------- SYN_REPORT ------------ Event: time 1511190325.360609, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.360609, -------------- SYN_REPORT ------------ Event: time 1511190325.754597, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190325.754597, -------------- SYN_REPORT ------------ Event: time 1511190326.226203, type 2 (EV_REL), code 8 (REL_WHEEL), value 2 Event: time 1511190326.226203, -------------- SYN_REPORT ------------ Event: time 1511190326.335886, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.335886, -------------- SYN_REPORT ------------ Event: time 1511190326.420238, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.420238, -------------- SYN_REPORT ------------ Event: time 1511190326.849670, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.849670, -------------- SYN_REPORT ------------

then with it enabled note how the REL_WHEEL events with value of +/-2 now get correctly mapped to be REL_HWHEEL events:

stephen@Ripley:~$ sudo modprobe -r psmouse stephen@Ripley:~$ sudo modprobe psmouse options a4tech_hack=1 stephen@Ripley:~$ sudo evtest --grab /dev/input/event1 Input driver version is 1.0.1 Input device ID: bus 0x11 vendor 0x2 product 0x6 version 0x0 Input device name: "ImExPS/2 Generic Explorer Mouse" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 272 (BTN_LEFT) Event code 273 (BTN_RIGHT) Event code 274 (BTN_MIDDLE) Event code 275 (BTN_SIDE) Event code 276 (BTN_EXTRA) Event type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 6 (REL_HWHEEL) Event code 8 (REL_WHEEL) Properties: Property type 0 (INPUT_PROP_POINTER) Testing ... (interrupt to exit) Event: time 1511190624.369531, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190624.369531, -------------- SYN_REPORT ------------ Event: time 1511190625.580824, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190625.580824, -------------- SYN_REPORT ------------ Event: time 1511190626.139235, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190626.139235, -------------- SYN_REPORT ------------ Event: time 1511190626.419281, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190626.419281, -------------- SYN_REPORT ------------ Event: time 1511190626.693413, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190626.693413, -------------- SYN_REPORT ------------ Event: time 1511190628.506133, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.506133, -------------- SYN_REPORT ------------ Event: time 1511190628.669774, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190628.669774, -------------- SYN_REPORT ------------ Event: time 1511190628.921986, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.921986, -------------- SYN_REPORT ------------ Event: time 1511190628.970915, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.970915, -------------- SYN_REPORT ------------ Event: time 1511190629.235774, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.235774, -------------- SYN_REPORT ------------ Event: time 1511190629.425575, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.425575, -------------- SYN_REPORT ------------ Event: time 1511190629.475333, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.475333, -------------- SYN_REPORT ------------ Event: time 1511190629.668506, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.668506, -------------- SYN_REPORT ------------ Event: time 1511190629.730081, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.730081, -------------- SYN_REPORT ------------ Event: time 1511190629.862513, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.862513, -------------- SYN_REPORT ------------ Event: time 1511190629.909745, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.909745, -------------- SYN_REPORT ------------ Event: time 1511190630.139196, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190630.139196, -------------- SYN_REPORT ------------

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .