Bug 89935 - T440s: middle and right clickpad buttons don't work if USB trackpoint is connected at boot
Summary: T440s: middle and right clickpad buttons don't work if USB trackpoint is conn...
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
Depends on:
Reported: 2015-04-07 09:56 UTC by Andreas Fleig
Modified: 2015-04-16 00:05 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

hid-lenovo patch that sets INPUT_PROP_POINTING_STICK (1.35 KB, text/plain)
2015-04-07 09:56 UTC, Andreas Fleig
evemu-describe output of the usb keyboard device (6.20 KB, text/plain)
2015-04-08 09:09 UTC, Andreas Fleig
evemu-describe output of the usb trackpoint device (10.74 KB, text/plain)
2015-04-08 09:09 UTC, Andreas Fleig
updated hid-lenovo patch (1.29 KB, text/plain)
2015-04-08 09:38 UTC, Andreas Fleig
0001-touchpad-only-pair-with-BUS_I8042-trackpoint-devices.patch (1.14 KB, patch)
2015-04-14 07:10 UTC, Peter Hutterer
Details | Splinter Review

Description Andreas Fleig 2015-04-07 09:56:44 UTC
Created attachment 114913 [details]
hid-lenovo patch that sets INPUT_PROP_POINTING_STICK

I added the prop INPUT_PROP_POINTING_STICK to the hid-lenovo driver to enable middle button scrolling for the Lenovo Compact USB keyboard by default (patch attached). The patch works well if the USB keyboard is plugged in after booting. If it's connected at boot time, the middle and right clickpad buttons of my Lenovo T440s are recognized as left clicks, and since there's no middle click, trackpoint scrolling with the integrated trackpoint doesn't work either.

Kernel: 4.0.0-0.rc5.git4.1.fc22.x86_64

Repeatable: always

Steps to reproduce:
0. Find a Thinkpad with T440s-like clickpad and a Lenovo Compact USB keyboard
1. Apply the attached patch to the hid-lenovo kernel module, recompile and install the module
2. Connect Lenovo Compact USB keyboard
3. Notice that middle button scrolling works with both the USB keyboard and the integrated trackpoint
4. Reboot the system leaving the USB keyboard connected
5. Notice that middle button scrolling works with the USB keyboard, but that middle and right click don't work on the clickpad anymore
Comment 1 Peter Hutterer 2015-04-08 00:34:34 UTC
with the patch applied, what is the evemu-describe output of this device?
Comment 2 Andreas Fleig 2015-04-08 09:09:08 UTC
Created attachment 114952 [details]
evemu-describe output of the usb keyboard device
Comment 3 Andreas Fleig 2015-04-08 09:09:27 UTC
Created attachment 114953 [details]
evemu-describe output of the usb trackpoint device
Comment 4 Andreas Fleig 2015-04-08 09:38:40 UTC
Created attachment 114954 [details]
updated hid-lenovo patch

Patch cleaned up after comments. Results are the same.
Comment 5 Peter Hutterer 2015-04-09 05:41:17 UTC
I suspect the cause here is the re-ordering of event nodes when you reboot with the keyboard plugged in, though I'm not yet sure why. Can you get the list of devices (a simple evemu-describe without arguments will list them) before/after rebooting?
Comment 6 Peter Hutterer 2015-04-09 05:43:39 UTC
Also make sure you update to libinput from git master. The keyboard looks like a fake MT device and we pushed a few fixes for that (see Bug 89783)
Comment 7 Peter Hutterer 2015-04-09 05:44:50 UTC
oh and another thing: are we talking about the bottom edge or the top edge of the clickpad here?
Comment 8 Hans de Goede 2015-04-14 06:30:16 UTC

I'm prety sure that the cause is the code in evdev-mt-touchpad.c which is responsible for selecting a trackstick to redirect the top software buttons to:

        if (tp->buttons.trackpoint == NULL &&
            (added_device->tags & EVDEV_TAG_TRACKPOINT)) {
                /* Don't send any pending releases to the new trackpoint */
                tp->buttons.active_is_topbutton = false;
                tp->buttons.trackpoint = added_device;  
                                        tp_trackpoint_event, tp);

Notice that currently this takes the first device which has EVDEV_TAG_TRACKPOINT set, we should change this to instead take the first ps/2 device (or maybe even the first "TPPS2 IBM TrackPoint").


Comment 9 Peter Hutterer 2015-04-14 07:10:09 UTC
Created attachment 115067 [details] [review]

untested, but it passes the test suite and that should be enough to fix this bug.
Comment 10 Andreas Fleig 2015-04-14 10:18:52 UTC
Thanks! Your patch works for me.
Comment 11 Peter Hutterer 2015-04-15 04:10:27 UTC
updated patch on the list now: http://lists.freedesktop.org/archives/wayland-devel/2015-April/021332.html
Comment 12 Peter Hutterer 2015-04-16 00:05:15 UTC
commit 7552cd04f7a50fb674ec826933dbdb7f804d7447
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Apr 14 17:04:45 2015 +1000

    touchpad: only pair internal trackpoint devices with internal touchpads

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.