Bug 1964036

Summary: Elantech trackpoint loses sync and jumps to the corner/edge of the screen
Product: [Fedora] Fedora Reporter: Joerg <jkastning>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: acaringi, adscvr, airlied, alciregi, bskeggs, hdegoede, jarodwilson, jeremy, jglisse, jonathan, josef, kernel-maint, lgoncalv, linville, masami256, mchehab, mihai, mpearson, ptalbert, steved
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-01 12:32:25 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:
Attachments:
Description Flags
Requested output of journalctl
none
Proposed patch from Oleg Trifonov
none
Logs gathered with running rawhide kernel none

Description Joerg 2021-05-24 15:01:27 UTC
Created attachment 1786477 [details]
Requested output of journalctl

1. Please describe the problem:
The Elantech TrackPoint on a ThinkPad occasionally loses sync making the mouse pointer jumping to an edge/corner of the screen.

2. What is the Version-Release number of the kernel:

~~~
$ cat /proc/version
Linux version 5.12.5-300.fc34.x86_64 (mockbuild.fedoraproject.org) (gcc (GCC) 11.1.1 20210428 (Red Hat 11.1.1-1), GNU ld version 2.35.1-41.fc34) #1 SMP Wed May 19 18:03:50 UTC 2021
~~~

3. Did it work previously in Fedora? If so, what kernel version did the issue
   *first* appear?  Old kernels are available for download at
   https://koji.fedoraproject.org/koji/packageinfo?packageID=8 :

Myself encountered the issue in kernel-5.11.21-300.fc34.x86_64 for the first time. A report on bugzilla.kernel.org [0] reports this issue for kernel 5.9.8. Several users confirm it for several other kernel versions.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=209167


4. Can you reproduce this issue? If so, please provide the steps to reproduce
   the issue below:
Happens after using the TrackPoint for some minutes.

Steps to Reproduce:
1. Take a ThinkPad with TrackPoint from Elantech
2. Install current F34 release
3. Start using the TrackPoint and wait for it to happen

Actual results:
Suddently the mouse pointer jumps to an edge or a corner on the screen.

Checking `dmesg` immediatly after that happend shows:


~~~
[ 4088.142608] psmouse serio1: Touchpad at isa0060/serio1/input0 lost sync at byte 6
[ 4088.149975] psmouse serio1: Touchpad at isa0060/serio1/input0 - driver resynced.
[ 4089.655555] psmouse serio1: elantech: PS/2 packet [04 00 80 26 00 00]
[ 4395.194067] psmouse serio1: Touchpad at isa0060/serio1/input0 lost sync at byte 6
[ 4395.200747] psmouse serio1: Touchpad at isa0060/serio1/input0 - driver resynced.
[ 4937.115055] psmouse serio1: elantech: PS/2 packet [30 80 80 36 00 00]
~~~

The dmesg output relates to the Touchpad though and **not** to the TrackPoint. I'm not sure if it hase something to do with the current issue.

Expected results:
I would expect that the described behaviour wouldn't happen at all, because it is pretty much annoying and disrupting any workflow.

Possible Fix:
Oleg Trifonov posted a patch in [0] which I attached to this bugzilla. I re-build my kernel with this patch and haven't seen the issue since I started using the patched kernel (using it several hours now).

5. Does this problem occur with the latest Rawhide kernel? To install the
   Rawhide kernel, run ``sudo dnf install fedora-repos-rawhide`` followed by
   ``sudo dnf update --enablerepo=rawhide kernel``:

Not yet. I'll try to do that and report back here.


6. Are you running any modules that not shipped with directly Fedora's kernel?:
No.

Comment 1 Joerg 2021-05-24 15:04:28 UTC
Created attachment 1786478 [details]
Proposed patch from Oleg Trifonov

This patch seems to fix the issue. I re-compiled my current kernel with it and haven't seen the issue since.

Comment 2 Joerg 2021-05-24 15:38:39 UTC
I confirm that the issue occurs using the following Rawhide kernel, too.

~~~
$ cat /proc/version 
Linux version 5.13.0-0.rc2.20210521git79a106fc6585.22.fc35.x86_64 (mockbuild.fedoraproject.org) (gcc (GCC) 11.1.1 20210512 (Red Hat 11.1.1-2), GNU ld version 2.36.1-12.fc35) #1 SMP Fri May 21 19:22:56 UTC 2021
~~~

Comment 3 Joerg 2021-05-24 15:39:48 UTC
Created attachment 1786496 [details]
Logs gathered with running rawhide kernel

Comment 4 Hans de Goede 2021-05-24 16:05:13 UTC
Joerg, thank you for your bug-report. We are aware of this issue and are looking into it. Especially thank you for the bugzilla.kernel.org / patch link, we were not aware of that yet and having a working (workaround?) patch is always very helpful. 

Now that we know where to look we can hopefully fix this soon (or we might go with the workaround).

Comment 5 Joerg 2021-05-25 06:38:27 UTC
Hello Hans de Goede,
You're welcome and I'm glad to help. Unfortunately I think that the patch I attached doesn't cover all cases. Today I tested with my patched kernel (5.12.5-300.jumpy.trackpoint.v2.1.local.fc34.x86_64) again and faced the issue after some minutes while it worked for hours yesterday. 

I looked into `../linux-5.13-rc2-191-g79a106fc6585/drivers/input/mouse/elantec.c` and saw there is some other kind of workaround implemented in line 1629 and following. But that didn't work either.

So I'm unsure what to do about it and how to do further testing that might be helpful solving this problem. In case you have any advice, please share.

Comment 6 Mark Pearson 2021-05-25 13:38:20 UTC
Thanks Hans and Joerg,

FYI - I've forwarded the bug and workaround details to Elantech.
I've reproduced this myself locally so will aim to try it out later too. Thanks for letting me know!

Mark

Comment 7 Joerg 2021-05-29 19:34:09 UTC
(In reply to Mark Pearson from comment #6)
> Thanks for letting me know!

You are welcome!

Please keep us in the loop when there are any news. Of course I'm willing to help in testing.

Best regards,  
Joerg

Comment 8 Joerg 2021-06-29 19:52:10 UTC
I've added "psmouse.proto=imps" to the kernel command line and had no jumps since.

~~~
sudo grubby --update-kernel=ALL --args="psmouse.proto=imps"
~~~

Maybe this is a possible workaround until a fix is available. I found this workaround at: [TrackPoint “jumps” occasionally to edge/corner on Linux on X13 (AMD)](https://www.reddit.com/r/thinkpad/comments/imk7s9/trackpoint_jumps_occasionally_to_edgecorner_on/].

Comment 9 Joerg 2021-11-19 21:15:25 UTC
(In reply to Mark Pearson from comment #6)
> FYI - I've forwarded the bug and workaround details to Elantech.
> I've reproduced this myself locally so will aim to try it out later too.

Hi Mark,
Did you hear anything back from Elantech? Or are there any other news on this?

Regards,
Joerg

Comment 10 Mark Pearson 2021-11-30 19:54:32 UTC
Update from Elantech

---
Driver patch already approve and merge to kernel 5.15.3
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/input/mouse/elantech.c?h=v5.15.3&id=4f43e1c69280313f121283cb5c16e5e0b1036b3a

Cursor jump root cause: Touchpad FW will randomly send out coordinate(X,Y) that will bigger than 127 or smaller than -127, but trackpoint send out coordinate will be in -127 < (X,Y) < 127.
We use driver solution and modify driver when detect coordinate(X,Y) that bigger than 127 or smaller than -127 send out by trackpoint, we ignore these coordinate to prevent cursor jump.
---

Looks like the patch is in kernel-ark os-build already:
https://gitlab.com/cki-project/kernel-ark/-/commit/be896bd3b72b44126c55768f14c22a8729b0992e

So can we close this?
Mark

Comment 11 Joerg 2021-12-01 10:40:02 UTC
Hi,

Currently I'm running Fedora Linux 35 (Workstation Edition) on Lenovo T14s with kernel version `5.15.5-200.fc35.x86_64`. My workaround was disabled by:

~~~
sudo grubby --remove-args="psmouse.proto=imps" --update-kernel /boot/vmlinuz-5.15.5-200.fc35.x86_64
~~~

From my point of view, the issue seems to be solved and this case could be closed.

Thanks,
Joerg

Comment 12 Hans de Goede 2021-12-01 12:32:25 UTC
(In reply to Joerg from comment #11)
> Currently I'm running Fedora Linux 35 (Workstation Edition) on Lenovo T14s
> with kernel version `5.15.5-200.fc35.x86_64`.
> 
> From my point of view, the issue seems to be solved and this case could be
> closed.

Thanks for confirming the fix. 5.15.-5 is already in the stable updates repository, so lets close this.