Bug 1455443

Summary: ThinkPad T540p: switched from synaptics to libinput and 3-finger tap is not that sensitive as before
Product: [Fedora] Fedora Reporter: Jan Hutař <jhutar>
Component: libinputAssignee: Peter Hutterer <peter.hutterer>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 25CC: hdegoede, jhutar, peter.hutterer
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libinput-1.6.3-6.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1470974 (view as bug list) Environment:
Last Closed: 2017-06-28 20:52:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1470974    
Attachments:
Description Flags
evemu-record
none
libinput-debug-events --device /dev/input/event5 --verbose
none
xinput list-props "SynPS/2 Synaptics TouchPad"
none
libinput-debug-events --enable-tap --verbose
none
libinput-debug-events --enable-tap --verbose # another unsuccessful 3-finger-tap
none
libinput-debug-events --enable-tap --verbose # 2 unsuccessful 3-finger-taps with libinput-1.6.3-5.bz1455443.fc25
none
libinput-debug-events --enable-tap --verbose # full output
none
`udevadm info /sys/class/input/event*` for relevant devices
none
libinput-debug-events --enable-tap --verbose # 2 unsuccessful 3-finger-taps with libinput-1.6.3-5.1bz1455443.fc25.x86_64
none
evemu-record # with libinput-1.6.3-5.1bz1455443.fc25.x86_64, 1st unsuccessful
none
libinput-debug-events --enable-tap --verbose # with libinput-1.6.3-5.1bz1455443.fc25.x86_64, 1st unsuccessful none

Description Jan Hutař 2017-05-25 07:54:50 UTC
Description of problem:
I'm on ThinkPad T540p with XFce4 and I have switched from synaptics to libinput and 3-finger click on the touchpad is not that sensitive as before. Often I have to do multiple attempts


Version-Release number of selected component (if applicable):
libinput-1.6.3-4.fc25.x86_64
xorg-x11-drv-libinput-0.23.0-4.fc25.x86_64
xfce4-session-4.12.1-9.fc25.x86_64


How reproducible:
always


Steps to Reproduce:
1. Use libinput on XFce on ThinkPad T540p
2. Try to do a 3-finger click (e.g. to paste content of the clipboard)


Actual results:
It is not that sensitive or reliable as it was with synaptics


Expected results:
Should be similarly sensitive

Comment 1 Peter Hutterer 2017-05-25 21:31:06 UTC
record a few 3-finger clicks with evemu-record please and attach the output here, so I can replay it.

Also, maybe test with sudo libinput-debug-events (optionally with --verbose) and look at the output, if events are misdetected there may be a hint in the output.

Comment 2 Jan Hutař 2017-05-26 05:16:23 UTC
Created attachment 1282479 [details]
evemu-record

Third (I'm quite sure) and sixth (not sure, maybe fifth or seventh) three-finger click was unsuccessful.

Comment 3 Jan Hutař 2017-05-26 05:31:03 UTC
When running `libinput-debug-events`, usual three-finger clicks (successful or unsuccessful) does not log anything. Only time I have seen something (and it was for unsuccessful three-finger click) was:

# libinput-debug-events 
-event2   DEVICE_ADDED     Power Button                      seat0 default group1  cap:k
-event4   DEVICE_ADDED     Video Bus                         seat0 default group2  cap:k
-event1   DEVICE_ADDED     Sleep Button                      seat0 default group3  cap:k
-event14  DEVICE_ADDED     Integrated Camera                 seat0 default group4  cap:k
-event3   DEVICE_ADDED     AT Translated Set 2 keyboard      seat0 default group5  cap:k
-event5   DEVICE_ADDED     SynPS/2 Synaptics TouchPad        seat0 default group6  cap:pg  size 97x67mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
-event6   DEVICE_ADDED     ThinkPad Extra Buttons            seat0 default group7  cap:k
[...]
 event5   GESTURE_PINCH_BEGIN +14.01s	3
 event5   GESTURE_PINCH_UPDATE +14.01s	3  0.11/ 0.00 ( 0.47/ 0.00 unaccelerated)  1.00 @ -0.03
 event5   GESTURE_PINCH_END +14.04s	3
[...]

Comment 4 Jan Hutař 2017-05-26 05:50:46 UTC
Created attachment 1282480 [details]
libinput-debug-events --device /dev/input/event5 --verbose

I have been inserting (with middle click) string "AAAAAAAAA" so please ignore it. Also it feels like when I'm running libinput-debug-events, it is much more reliable (say 4 of 5 attempts) than without it (say 1 of 3).

Comment 5 Jan Hutař 2017-05-26 05:55:43 UTC
I have tried to save `xinput list-props 11 > normal` when libinput-debug-events was and was not running, but outputs are identical.

Comment 6 Peter Hutterer 2017-05-26 06:35:39 UTC
wait, are we talking about tapping or clicking here? i.e. physical click with 3 fingers on the touchpad or a three-finger tap?

https://wayland.freedesktop.org/libinput/doc/latest/tapping.html

Comment 7 Jan Hutař 2017-05-26 06:57:44 UTC
Sorry, did not knew there is a difference. I'm talking about 3 fingers touching touchpad at the same time (emulating middle mouse button). And I'm just (silently) touching the touchpad, not pressing it (which gives that "click" sound).

Comment 8 Peter Hutterer 2017-06-06 03:20:43 UTC
ok, in that case the next question is: is tapping enabled? xinput list-props "device name" should show us, please attach or paste the output here.

Comment 9 Jan Hutař 2017-06-06 05:38:31 UTC
Created attachment 1285203 [details]
xinput list-props "SynPS/2 Synaptics TouchPad"

It is enabled. It just takes me 2 - 3 attempts to 3-finger tap when pasting text. Any idea?

Comment 10 Peter Hutterer 2017-06-13 03:04:04 UTC
run sudo libinput-debug-events --enable-tap --verbose and check the output. What we found on those particular devices is that the tripletap data isn't always reliable, i.e. in quite a few cases a three-finger tap wouldn't send BTN_TOOL_TRIPLETAP so libinput would think it's a 2-finger tap. Or there was some movement before the data comes in.

If you run debug-events the state debugging may give a hint of what states libinput sees. Likewise, if you run evemu-record on the side you can keep an eye out on BTN_TOOL_TRIPLETAP. The recording you submitted had a few in it but that doesn't mean all got detected.

Comment 11 Jan Hutař 2017-06-13 06:04:58 UTC
Created attachment 1287166 [details]
libinput-debug-events --enable-tap --verbose

Comment 12 Jan Hutař 2017-06-13 06:09:01 UTC
Created attachment 1287167 [details]
libinput-debug-events --enable-tap --verbose   # another unsuccessful 3-finger-tap

Comment 13 Jan Hutař 2017-06-13 06:17:34 UTC
# libinput-list-devices
[...]
Device:           SynPS/2 Synaptics TouchPad
Kernel:           /dev/input/event5
Group:            6
Seat:             seat0, default
Size:             97.33x66.86mm
Capabilities:     pointer 
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    *button-areas clickfinger 
Disable-w-typing: enabled
Accel profiles:   none
Rotation:         n/a
[...]

Please do you have any idea on why there is "Tap-to-click: disabled" although tapping works? Also I'll try to disable all scroll edges and button areas bacause these might interfere.

Comment 14 Jan Hutař 2017-06-13 06:32:58 UTC
Hmm, in this output tapping is enabled:

# xinput list-props 11
Device 'SynPS/2 Synaptics TouchPad':
	Device Enabled (140):	1
	Coordinate Transformation Matrix (142):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Tapping Enabled (275):	1
	libinput Tapping Enabled Default (276):	0
	libinput Tapping Drag Enabled (277):	1
	libinput Tapping Drag Enabled Default (278):	1
	libinput Tapping Drag Lock Enabled (279):	0
	libinput Tapping Drag Lock Enabled Default (280):	0
	libinput Tapping Button Mapping Enabled (281):	1, 0
	libinput Tapping Button Mapping Default (282):	1, 0
	libinput Accel Speed (283):	0.500000
	libinput Accel Speed Default (284):	0.000000
	libinput Natural Scrolling Enabled (285):	0
	libinput Natural Scrolling Enabled Default (286):	0
	libinput Send Events Modes Available (260):	1, 1
	libinput Send Events Mode Enabled (261):	0, 0
	libinput Send Events Mode Enabled Default (262):	0, 0
	libinput Left Handed Enabled (287):	0
	libinput Left Handed Enabled Default (288):	0
	libinput Scroll Methods Available (289):	1, 1, 0
	libinput Scroll Method Enabled (290):	1, 0, 0
	libinput Scroll Method Enabled Default (291):	1, 0, 0
	libinput Click Methods Available (292):	1, 1
	libinput Click Method Enabled (293):	1, 0
	libinput Click Method Enabled Default (294):	1, 0
	libinput Middle Emulation Enabled (295):	0
	libinput Middle Emulation Enabled Default (296):	0
	libinput Disable While Typing Enabled (297):	1
	libinput Disable While Typing Enabled Default (298):	1
	Device Node (263):	"/dev/input/event5"
	Device Product ID (264):	2, 7
	libinput Drag Lock Buttons (299):	<no items>
	libinput Horizontal Scroll Enabled (300):	1

(only change I did is I have set acceleration to 0.5)

Comment 15 Jan Hutař 2017-06-13 06:46:12 UTC
From `man libinput`:

       libinput Scroll Methods Available
              3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".  Indicates which scroll methods are available on this device.

       libinput Scroll Method Enabled
              3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".  Indicates which scroll method is currently enabled on this device.

So looks like "ibinput Scroll Method Enabled Default (291): 1, 0, 0" is what I want (i.e. no scroll edges).

I'm out of ideas. Again.

Comment 16 Peter Hutterer 2017-06-13 23:16:53 UTC
(In reply to Jan Hutař from comment #13)
> # libinput-list-devices

man libinput-list-devices:
"Each device shows available configurations the respective default configuration setting."

X has its own libinput context, the tools can't see into that context so nothing in those tools will give you the exact data the driver has internally. That should explain why tapping is enabled in the properties - those are the values the driver actually has.

libinput-debug-events behaves differently because of that too, it will see the same events as the X driver, but it has a separate context with potentially different options.

Ok, now to the state debugging:
tap state: TAP_STATE_TOUCH_2 → TAP_EVENT_TOUCH → TAP_STATE_TOUCH_3
tap state: TAP_STATE_TOUCH_3 → TAP_EVENT_MOTION → TAP_STATE_TOUCH_3_HOLD
tap state: TAP_STATE_TOUCH_3_HOLD → TAP_EVENT_MOTION → TAP_STATE_TOUCH_3_HOLD

So it detects 2fg touch, then a touch, goes to the 3fg state. But then it detects a motion event above the movement threshold and goes into "three fingers down but no tap" state. This is the bit we have to watch out for in the evemu recordings, I'll try to have a look at that asap.

Comment 17 Peter Hutterer 2017-06-14 06:22:50 UTC
right, as expected, the recording has a jump at timestamp 5.393864, that is causing the state transition to 3-finger-hold rather than tap. synaptics doesn't look at finger positions so it doesn't care when they're moving - hence why it's more reliable here. Not 100% how to fix this yet.

Comment 18 Jan Hutař 2017-06-14 07:57:44 UTC
Thank you for the investigation and explaining to me.

Maybe I'm just not touching/tapping correctly if others are not complaining about that. Is there some option do disable that motion detection? Or way to increase threshold?

Comment 19 Peter Hutterer 2017-06-15 02:56:03 UTC
it's a hardware-dependent problem, so there isn't that much you can do. The thresholds are largely hard-coded, increasing them isn't really helping much because then you'll find touch movements will be affected, etc. the only real solution would be to switch to the BTN_TOOL_* detection that synaptics does, but that means we'd lose gestures.

Comment 20 Peter Hutterer 2017-06-15 04:29:48 UTC
https://koji.fedoraproject.org/koji/taskinfo?taskID=20026845

Can you give this scratch build a try please? Thanks

Comment 21 Jan Hutař 2017-06-15 05:21:20 UTC
Hello, I'm running that now:

# rpm -q libinput
libinput-1.6.3-5.fc25.x86_64
# rpm -Uvh https://kojipkgs.fedoraproject.org//work/tasks/6847/20026847/libinput-1.6.3-5.bz1455443.fc25.x86_64.rpm
Retrieving https://kojipkgs.fedoraproject.org//work/tasks/6847/20026847/libinput-1.6.3-5.bz1455443.fc25.x86_64.rpm
Preparing...                          ################################# [100%]
	package libinput-1.6.3-5.fc25.x86_64 (which is newer than libinput-1.6.3-5.bz1455443.fc25.x86_64) is already installed
# rpm -Uvh --oldpackage https://kojipkgs.fedoraproject.org//work/tasks/6847/20026847/libinput-1.6.3-5.bz1455443.fc25.x86_64.rpm
Retrieving https://kojipkgs.fedoraproject.org//work/tasks/6847/20026847/libinput-1.6.3-5.bz1455443.fc25.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:libinput-1.6.3-5.bz1455443.fc25  ################################# [ 50%]
Cleaning up / removing...
   2:libinput-1.6.3-5.fc25            ################################# [100%]
# rpm -q libinput
libinput-1.6.3-5.bz1455443.fc25.x86_64

but IMO it is still same. I'm attaching `libinput-debug-events --enable-tap --verbose` for two unsuccessful 3-finger-taps.

Comment 22 Jan Hutař 2017-06-15 05:22:01 UTC
(and I have restarted laptop after package update)

Comment 23 Jan Hutař 2017-06-15 05:23:19 UTC
Created attachment 1287907 [details]
libinput-debug-events --enable-tap --verbose   # 2 unsuccessful 3-finger-taps with libinput-1.6.3-5.bz1455443.fc25

Comment 24 Peter Hutterer 2017-06-15 22:29:51 UTC
hmm, is that device tagged as synaptics serial touchpad? That's the only way I can see how the fix doesn't apply. Please submit a full libinput-debug-events --enable-tap --verbose, specifically the device list at the top, it should print the model tags applied. Also attach your udevadm info /sys/class/input/eventX output for that device, thanks.

Comment 25 Jan Hutař 2017-06-16 10:49:12 UTC
Created attachment 1288312 [details]
libinput-debug-events --enable-tap --verbose   # full output

Few unsuccessful 3-finger-taps, at the end one successful

Comment 26 Jan Hutař 2017-06-16 10:52:49 UTC
Created attachment 1288314 [details]
`udevadm info /sys/class/input/event*` for relevant devices

Hope I figured out which devices correctly. Also noticed there is "ThinkPad Extra Buttons", so added these as well in case these are relevant.

Comment 27 Jan Hutař 2017-06-16 10:55:46 UTC
Errr, sorry, your build was upgraded, let me try again later:

# rpm -qa | grep -e libinput -e synaptics
libinput-1.6.3-5.fc25.x86_64
xorg-x11-drv-libinput-0.23.0-4.fc25.x86_64

Comment 28 Peter Hutterer 2017-06-19 02:03:54 UTC
renamed the package in the spec file so it sorts higher than the f25 default one: https://koji.fedoraproject.org/koji/taskinfo?taskID=20062284

Comment 29 Peter Hutterer 2017-06-21 00:43:49 UTC
fwiw, I'd like to get this patch into libinput 1.8 and for that I need some testing feedback. If you could confirm whether the new scratch build works for you, that'd be great, thanks

Comment 30 Jan Hutař 2017-06-21 05:00:08 UTC
I'm sorry. Everything below comment 21 is wrong. When I have installed your scratch build and was about to reboot, I said to myself "if I'm going to reboot anyway, lets upgrade other fedora upgrades". Did that and did not checked that upgraded that package as well. My mistake, sorry for feeding wrong results.

As of now:

# rpm -q libinput
libinput-1.6.3-5.1bz1455443.fc25.x86_64

Comment 31 Jan Hutař 2017-06-21 05:03:15 UTC
Created attachment 1289926 [details]
libinput-debug-events --enable-tap --verbose   # 2 unsuccessful 3-finger-taps with libinput-1.6.3-5.1bz1455443.fc25.x86_64

Did 5 3-finger-taps here and they were:

1. successful
2. successful
3. unsuccessful
4. successful
5. unsuccessful

Comment 32 Jan Hutař 2017-06-21 05:12:06 UTC
So,I have done lots of 3-finger-taps now and looks pretty good. I'm not sure if these which fails (below 30% I guess) are still a bug or my clumpy fingers, but definitely I see improvement here, so please include the magic into next official build.

Comment 33 Peter Hutterer 2017-06-21 05:47:22 UTC
I think I'll need a new evemu record together with the libinput-debug-event recording at the same time. I don't know how you get

  tap state: TAP_STATE_TOUCH_3 → TAP_EVENT_MOTION → TAP_STATE_TOUCH_3_HOLD

That code path has been effectively disabled on your touchpad

Comment 34 Jan Hutař 2017-06-21 06:28:34 UTC
Created attachment 1289939 [details]
evemu-record   # with libinput-1.6.3-5.1bz1455443.fc25.x86_64, 1st unsuccessful

Comment 35 Jan Hutař 2017-06-21 06:30:11 UTC
Created attachment 1289940 [details]
libinput-debug-events --enable-tap --verbose   # with libinput-1.6.3-5.1bz1455443.fc25.x86_64, 1st unsuccessful

Comment 36 Jan Hutař 2017-06-21 06:32:34 UTC
So these two commands (last 2 attachments) were running in parallel and I did five 3-finger-taps. First was unsuccessful, rest of them worked. Hope this is output you wanted.

Comment 37 Peter Hutterer 2017-06-21 07:45:20 UTC
yep, perfect, thanks. found the issue: the new code works fine on finger down but if there's a movement on finger up, that triggers the motion just before the touch release. I'll get a fix for this out asap.

Comment 38 Peter Hutterer 2017-06-22 00:43:03 UTC
Scratch build with the fix available here:
https://koji.fedoraproject.org/koji/taskinfo?taskID=20083337

Comment 39 Peter Hutterer 2017-06-22 05:50:51 UTC
ok, another update to only limit this to 3fg touches (I don't want to touch 2fg ones until absolutely necessary):
https://koji.fedoraproject.org/koji/taskinfo?taskID=20088537

Comment 40 Jan Hutař 2017-06-23 07:27:25 UTC
Hello. IMO it is perfect now, thank you very much!

$ rpm -q libinput
libinput-1.6.3-5.3bz1455443.fc25.x86_64

Comment 41 Peter Hutterer 2017-06-26 01:34:15 UTC
awesome, thanks, proper update coming up.

Comment 42 Fedora Update System 2017-06-26 01:48:04 UTC
libinput-1.6.3-6.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-85017e5432

Comment 43 Fedora Update System 2017-06-27 03:23:08 UTC
libinput-1.6.3-6.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-85017e5432

Comment 44 Fedora Update System 2017-06-28 20:52:19 UTC
libinput-1.6.3-6.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.