Bug 99064 - Pinch recognized but Swipe
Summary: Pinch recognized but Swipe
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: 1.5.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-12 13:26 UTC by Francecso
Modified: 2017-09-04 15:23 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
evemu-record log (107.97 KB, text/plain)
2016-12-14 01:38 UTC, Francecso
Details
libinput-debug-event Log (9.92 KB, text/plain)
2016-12-14 01:39 UTC, Francecso
Details
3 Finger Swipe with fingers in line ( Up - Down x 2 times ) (10.90 KB, text/x-log)
2016-12-17 08:00 UTC, Francecso
Details
3 Finger Swipe with fingers NOT in line ( Up - Down x 2 times ) (11.11 KB, text/x-log)
2016-12-17 08:02 UTC, Francecso
Details
Kernel git config (128.59 KB, text/plain)
2016-12-20 17:13 UTC, Francecso
Details
Kernel config git (new) (128.79 KB, text/x-mpsub)
2016-12-21 03:31 UTC, Francecso
Details
event-debug: short swipe not recognized (6.02 KB, text/x-log)
2016-12-21 03:57 UTC, Francecso
Details
Kernel config git (new 2) (126.23 KB, text/x-mpsub)
2016-12-22 03:18 UTC, Francecso
Details
event-debug with git kernel RMI4 (90.61 KB, text/plain)
2016-12-23 08:58 UTC, Francecso
Details

Description Francecso 2016-12-12 13:26:54 UTC
I am running Antergos linux ( based on Arch ) everything updated.

The issue:

Sometime I do a swipe with 3 or 4 finger but a Pinch is recognized, here some example using `libinput-debug-events` 

 event8 	GESTURE_PINCH_UPDATE  +4.63s	3 10.01/-58.61 (13.44/-78.74 unaccelerated)  1.03 @  0.35
 event8 	GESTURE_PINCH_UPDATE  +4.66s	3  9.20/-129.06 (11.52/-161.70 unaccelerated)  1.04 @  0.19
 event8 	GESTURE_PINCH_UPDATE  +4.68s	3  9.22/-152.98 (11.52/-191.23 unaccelerated)  1.04 @  1.51
 event8 	GESTURE_PINCH_UPDATE  +4.71s	3  4.61/-128.23 ( 5.76/-160.29 unaccelerated)  1.03 @  2.82
 event8 	GESTURE_PINCH_UPDATE  +4.73s	3  3.07/-77.62 ( 3.84/-97.02 unaccelerated)  1.03 @  0.46

 

Content of /sys/class/dmi/id/modalias: 

dmi:bvnInsydeCorp.:bvrA05:bd08/11/2016:svnTimi:pnTM1613:pvrA05:rvnTimi:rnTM1613:rvrA05:cvnTimi:ct10:cvrA05:


My Device as per `libinput-list-devices` output:

Device:           SynPS/2 Synaptics TouchPad
Kernel:           /dev/input/event8
Group:            6
Seat:             seat0, default
Size:             106.73x63.39mm
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


Is there anything I can do to calibrate the swipe/pinch tracking ?
Comment 1 Francecso 2016-12-12 13:27:56 UTC
I am running libinput 1.5.3
Comment 2 Peter Hutterer 2016-12-13 22:37:00 UTC
use evemu-record to record a few of these sequences please, then I can have a look on what's happening, thanks.
Comment 3 Francecso 2016-12-14 01:38:29 UTC
Created attachment 128458 [details]
evemu-record log
Comment 4 Francecso 2016-12-14 01:39:23 UTC
Created attachment 128459 [details]
libinput-debug-event Log
Comment 5 Francecso 2016-12-14 01:42:19 UTC
Thanks Peter,

I have recorded a couple of swipe up and down with 3 finger using `evemu-record` and `libinput-debug-event` ( I run them in the same )

Let me know if you need anything else
Comment 6 Peter Hutterer 2016-12-15 09:33:47 UTC
rightyo, checked what's happening and tp_gesture_same_directions() at the end of tp_gesture_handle_state_unknown() isn't triggered by your gesture, i.e. it looks like the points are moving into different directions. not sure why yet but I'm seriously ETIME-ing here.

if you know C, start in tp_gesture_handle_state_unknown and put a few printfs in to figure out what exactly is going on. use ./tools/event-debug --verbose to test so you don't have to restart all the time. Sorry I can't do more right now, this needs detailed analysis and that's what you can do best with the hardware in front of you :)
Comment 7 Francecso 2016-12-17 08:00:51 UTC
Created attachment 128508 [details]
3 Finger Swipe with fingers in line ( Up - Down x 2 times )
Comment 8 Francecso 2016-12-17 08:02:19 UTC
Created attachment 128509 [details]
3 Finger Swipe with fingers NOT in line ( Up - Down x 2 times )
Comment 9 Francecso 2016-12-17 08:04:52 UTC
Alright,

I am a dev but I work on PHP/JS so my C skills are quite basic ( last time I touched some C code is about 10 ys ago )

 ... anyway the suggested mod are quite trivial so I was able to implement them, here my modifications to `tp_gesture_handle_state_unknown()`:
http://pastebin.com/gu3QuCJw
Now the problem is I am not sure what to do with the log :)

What I can see it that the pinch is recognized most of the time when I swipe but the 3 fingers are not perfect in line, for example the middle finger above the other two( something like _-_ ).
I have attached to logs containing one swipe up, one swipe down repeated 2 times, the first log is with all fingers inline the second with the fingers _-_


Let me know what else I can do, thax


Note:
I am not sure this is relate but sometime I get this message:
" kernel bug: Touch jump detected and discarded ... "
Comment 10 Peter Hutterer 2016-12-19 23:55:19 UTC
(In reply to Francecso from comment #9)
> What I can see it that the pinch is recognized most of the time when I swipe
> but the 3 fingers are not perfect in line, for example the middle finger
> above the other two( something like _-_ ).

one important thing: your touchpad can only track the position of 2 fingers at a time. for the third finger we merely get a "finger is down" bitflag but no position. So we cannot differ between a 3fg swipe and a 3fg pinch. If you fingers are set down in the order index, middle, ring, then chances are that it looks more like the start of a pinch gesture based on the finger position.
This is solved with the switch to RMI4 in kernel 4.10, that will at least give us tracking of more than 2 fingers.

But the real issue here is likely that we switch to pinch too early, as soon as we have 2 fingers down. In many cases, you have 2fg down before the third finger is detected. This definitely needs fixing.

> Note:
> I am not sure this is relate but sometime I get this message:
> " kernel bug: Touch jump detected and discarded ... "

That's also something that should be fixed with RMI4 and can also be the reason for the misdetection. I'll try to fix the above first, then we can look at this one separately.
Comment 11 Peter Hutterer 2016-12-20 02:46:48 UTC
ok, after playing around with this on my touchpad here and looking at your recording, the issue seems to be that when putting the fingers down we get a massive cursor jump, sometimes across half the touchpad (also likely the source of the error message). This jump triggers the direction detection, making it look like a pinch. Fixing this requires quite a few hacks, so first I need to know if this is still an issue with the RMI4 support. Please test dmitry's kernel here:
http://lkml.iu.edu/hypermail/linux/kernel/1612.2/00646.html

Note that's an early v4.10 kernel, some stability issues are expected. Once installed, the touchpad will come up with some weird-looking name (SYN002 or similar) that's how you know it's using the RMI4 protocol.
Comment 12 Francecso 2016-12-20 17:12:07 UTC
I have installed and compiled the given kernel but nothing looks to be changed and I also still have the error "libinput error: kernel bug: Touch jump detected and discarded ..."

During the compilation I was prompted for some `RMI4` modules so I have included them ( just to be sure everything is correct I am attaching the .config used for compilation )



"... weird-looking name (SYN002 or similar)"
-> where should I check this name ?
Comment 13 Francecso 2016-12-20 17:13:45 UTC
Created attachment 128594 [details]
Kernel git config
Comment 14 Peter Hutterer 2016-12-21 00:27:55 UTC
it says in the kernel config:
# CONFIG_RMI4_CORE is not set
# CONFIG_HID_RMI is not set
# CONFIG_MOUSE_SYNAPTICS_I2C is not set

you'll definitely need rmi4-core, enable the other two as well, just in case.

(In reply to Francecso from comment #12)
> "... weird-looking name (SYN002 or similar)"
> -> where should I check this name ?

run sudo evemu-describe and it gives you a list of devices detected. The SynPS/2 synaptics touchpad will still be there but it won't send events. Instead, it'll be something with a name like "Synaptics TM3053-004"
Comment 15 Francecso 2016-12-21 03:31:44 UTC
Created attachment 128598 [details]
Kernel config git (new)
Comment 16 Francecso 2016-12-21 03:55:34 UTC
I think this last kernel is ok ( see details below )

sudo evemu-describe ( still does not show the weird name )

Available devices:
/dev/input/event0:	AT Translated Set 2 keyboard
/dev/input/event1:	Lid Switch
/dev/input/event2:	Sleep Button
/dev/input/event3:	Power Button
/dev/input/event4:	PC Speaker
/dev/input/event5:	Video Bus
/dev/input/event6:	Video Bus
/dev/input/event7:	Dell AIO WMI hotkeys
/dev/input/event8:	HDA Digital PCBeep
/dev/input/event9:	HDA Intel PCH Headphone
/dev/input/event10:	HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event11:	HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event12:	HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event13:	SynPS/2 Synaptics TouchPad
/dev/input/event14:	XiaoMi USB 2.0 Webcam

... Anyway now:

 - Pinch / Swipe now looks ok !!!
 - sometime I still have the " ...Touch jump detected and discarded ..." 
(not very frequently )(not very frequently )

What I have noted is that when the swipe is really short sometime is detected:
 - a swipe but it does not trigger the relative `libinput-gestures` event (maybe it is a problem related to `libinput-gestures` ?
 - sometimes it detects a scroll
 - sometimes it is just say GESTURE_STATE_UNKNOWN

Find attached a log with the swipe not recognized.

This last issue is not so annoying:
- 99% of the swipe (excluding the short one) are now recognized as expected :) but I thought it was worth to share it ( from my understanding libinput aim is to become a new standard in Linux )

In case you want to dig into it you find attached a log with 3 swipe 

Thank you very much for your help.
Let me know if you want to dig more into the Touch Jump issue and the short swipe issue and what kind of info I can submit.


= KERNEL Config Details ( extract from 'Kernel config git (new)') =

CONFIG_RMI4_CORE=m
CONFIG_RMI4_I2C=m
CONFIG_RMI4_SPI=m
CONFIG_RMI4_SMB=m
CONFIG_RMI4_F03=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
# CONFIG_RMI4_F30 is not set
(not very frequently )CONFIG_RMI4_F34=y
CONFIG_RMI4_F54=y
CONFIG_RMI4_F55=y

// I forgot this :( ( if it is important I'll recompile, just let me know )
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
Comment 17 Francecso 2016-12-21 03:57:16 UTC
Created attachment 128599 [details]
event-debug: short swipe not recognized
Comment 18 Francecso 2016-12-21 08:45:31 UTC
Huston we have a problem:

My touchpad is not working at all now :( the pointer is displayed but it doesn't move and xinput doesn't show the device anymore.



What I did:

- I have recompiled the kernel adding the module:
CONFIG_MOUSE_SYNAPTIC_IC2
- I rebooted the new kernel -> touchpad not working anymore 

Even if I boot the stock kernel the pointer  

Any idea what is going on here ?
Comment 19 Francecso 2016-12-21 09:11:22 UTC
Ok I have solved
Comment 20 Francecso 2016-12-22 03:14:51 UTC
skip my last 3 comments.

I have compiled again the kernel with all the modules you suggested

So far I cannot see any difference.
Result with the GIT kernel:

 - Pinch is recognized instead of the Swipe
 - I don't see the weird name in `sudo evemu-describe` output
 - Still have the jump bug

( the reason why I though it is was working better is because I patched the `libinput` code to always recognize a Swipe )

------------------------------------------------------------------------------ 
I am attaching the whole kernel configuration here the summary of the modules enabled:


CONFIG_MOUSE_SYNAPTICS_I2C=m
CONFIG_RMI4_CORE=m
CONFIG_RMI4_I2C=m
CONFIG_RMI4_SPI=m
CONFIG_RMI4_SMB=m
CONFIG_RMI4_F03=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
CONFIG_RMI4_F30=y
CONFIG_RMI4_F34=y
CONFIG_RMI4_F54=y
CONFIG_RMI4_F55=y

I also have this xorg configuration file ( I am not sure if it can be any impact on the RMI4 thing not working ):

 Section "InputClass"
    Identifier "	touchpad catchall"
    Driver 		"libinput"
    MatchIsTouchpad 				"1"
    Option 		"Tapping" 		"1"
    Option 		"DisableWhileTyping"	"0"
    Option 		"TappingDragLock" 	"0"
EndSection


Let me know in case you need more informations
Comment 21 Francecso 2016-12-22 03:18:03 UTC
Created attachment 128623 [details]
Kernel config git (new 2)
Comment 22 Peter Hutterer 2016-12-22 03:37:11 UTC
sorry, what I thought got merged is apparently still missing. At least I couldn't figure out how to get this one to work either. Benjamin's branch here should include everything:
https://github.com/bentiss/linux/commits/synaptics-rmi4-v4.9-rc7%2B

After booting, as root do:

# echo 1 > /sys/module/psmouse/parameters/synaptics_intertouch
# echo -n rescan > /sys/bus/serio/devices/serio1/drvctl

That should work, except that at least for me it says:
[  556.052727] rmi4_smbus 9-002c: failed to get SMBus version number!

Benjamin, any hints?
Comment 23 Francecso 2016-12-23 08:58:46 UTC
Created attachment 128646 [details]
event-debug with git kernel RMI4
Comment 24 Francecso 2016-12-23 09:02:54 UTC
I have followed your instruction and attached a log with event-debug and the new kernel.

Here my findings:

 - I do not see the weird name for the Touchpad
 - the jump bug looks solved
 - checking `event-debug` logs looks now better recognizing the SWIPE however libinput-gesture do not register any swipe/pinch now

I also noted sometime I SWIPE and also the 3 finger tap get triggered.
Comment 25 Peter Hutterer 2016-12-27 09:31:42 UTC
(In reply to Francecso from comment #24)
>  - I do not see the weird name for the Touchpad

Your touchpad is now the "Synaptics TM3254-001" device, so this indicates RMI4 works. The old device stays around, but that's a cosmetic issue only, it doesn't send events.

>  - the jump bug looks solved

ok, great, that's what I was hoping for.

>  - checking `event-debug` logs looks now better recognizing the SWIPE
> however libinput-gesture do not register any swipe/pinch now
> 
> I also noted sometime I SWIPE and also the 3 finger tap get triggered.

hmm, not good, we may need some better handling there. I'm not sure about libinput-gesture though, event-debug uses the events as libinput provides them but iirc libinput-gesture depends on debugging output which is an unstable API.
Comment 26 Benjamin Tissoires 2017-01-03 08:13:33 UTC
(In reply to Peter Hutterer from comment #22)
> sorry, what I thought got merged is apparently still missing. At least I

Yes, I did not manage to get everything in shape for v4.10. Ongoing process for v4.11 (crossing fingers). For the record, what we are missing now is just the binding from PS/2 and the report of the trackstick buttons through the trackstick node.

> couldn't figure out how to get this one to work either. Benjamin's branch
> here should include everything:
> https://github.com/bentiss/linux/commits/synaptics-rmi4-v4.9-rc7%2B

Yep, that's the one with all my patches.

> 
> After booting, as root do:
> 
> # echo 1 > /sys/module/psmouse/parameters/synaptics_intertouch
> # echo -n rescan > /sys/bus/serio/devices/serio1/drvctl
> 
> That should work, except that at least for me it says:
> [  556.052727] rmi4_smbus 9-002c: failed to get SMBus version number!
> 
> Benjamin, any hints?

Not sure why this is happening. Which laptop are you using? If it's one of the thinkpads, that's an issue we an solve out of the scope of this bug.
Comment 27 Francecso 2017-01-07 15:34:42 UTC
Actually the more annoying bug here is that when I move the cursors sometime the tap is triggered.

Should I open a new bug report for this problem ? 

Regarding this bug I am not sure if you have enough info on my side or whatelse I can do.
Comment 28 Peter Hutterer 2017-01-09 04:26:52 UTC
(In reply to Francecso from comment #27)
> Actually the more annoying bug here is that when I move the cursors sometime
> the tap is triggered.
> 
> Should I open a new bug report for this problem ? 

yes please, different problem so we need a separate bug.
Comment 29 Francecso 2017-02-07 18:34:21 UTC
Sorry for late reply:

I am actually running the last git code and Wayland ( before I was using xorg )
so far the behavior look much better. 
( The main issue is now 3 fingers slide sometime act as 2 fingers scroll sometime as 3 fingers slide ... btw 4 fingers slide looks working fine )

You can close this bug:
I'll open a more specific bug report in case I'll face other problems and once you'll release a new stable version of libinput.

In the meanwhile, I want to thank you for your support and the amazing work you are delivering to the community :)
Comment 30 Peter Hutterer 2017-02-07 23:47:21 UTC
Ok, thanks. I'm closing this as "moved" because I'm not sure what the correct resolution would be otherwise :)

RMI4 should improve things and let's work on the other things one-by-one as we go along
Comment 31 Francecso 2017-09-04 15:23:24 UTC
ver 1.8.1

I just want to confirm this is now working fine: 
- now all swipes are correctly recognized.
( it looks the pinch with 3 finger has been dropped in favor of the swipe )

Thanks you guys for making linux super cool :)


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.