linux-surface / linux-surface

Linux Kernel for Surface Devices
4.62k stars 201 forks source link

Ghost touches since latest kernel upgrade and after resume from sleep #417

Open lviggiani opened 3 years ago

lviggiani commented 3 years ago

Sine latest kernel upgrade, I'm experiencing ghost / fake input. For example, I'm typing in terminal and all the above text gets selected or I'm in Fireforx and suddenly the address bar gets focus and the on screen keyboard appears or the browser navigates backward etc This happens always and only when resuming from sleep

lviggiani commented 3 years ago

dmesg.log jourlanctl.log

Also, sometimes after reboot, the touch screen won't work and in other cases by using the pen causes the gnome shell to crash (Wayland session)- I never experienced any of those issues in the past. Attached dmesg.log and journalctl.log refers to a non working touchscreen / pen after reboot. Prior to this reboot I was in a situation where after resume from sleep I was having ghost touches. I hope this helps

StollD commented 3 years ago

Regarding the first issue: Does running sudo iptsd-reset-sensor stop the ghost touches? (You need the latest iptsd version for that, 0.4)

Regarding the second issue: It seems that iptsd starts, but then fails because the UAPI is not fully ready yet. /dev/ipts/[0-8] exist, but it fails to open /dev/ipts/9. It should be resolvable by having the iptsd service definition depend on /dev/ipts/15 instead of /dev/ipts/0. Interesting that noone ever hit this before... Your systemd must be cursed :P

lviggiani commented 3 years ago

Hi, running sudo iptsd-reset-sensor seems to do the trick thanks! For the second issue, is it something I can tweak in systemd service file or is it something you need to do at source level?

lviggiani commented 3 years ago

Also, after linux 5.11.7 the issue seems to be gone away. I'll keep trying in the next few days and close the issue is everything goes well

StollD commented 3 years ago

For the second issue, is it something I can tweak in systemd service file or is it something you need to do at source level?

You can try changing all mentions of dev-ipts-0.device in /usr/lib/systemd/system/iptsd.service to dev-ipts-15.device. Then do a reboot and see if the issue still occurs.

lviggiani commented 3 years ago

Also, after linux 5.11.7 the issue seems to be gone away. I'll keep trying in the next few days and close the issue is everything goes well

Unfortunately ghost touches are back, however sudo iptsd-reset-sensor works. Maybe it would be a good idea ti automatically execute it on resume?

lviggiani commented 3 years ago

For the second issue, is it something I can tweak in systemd service file or is it something you need to do at source level?

You can try changing all mentions of dev-ipts-0.device in /usr/lib/systemd/system/iptsd.service to dev-ipts-15.device. Then do a reboot and see if the issue still occurs.

Thanks, I'm trying this now as it also happens (randomly) that the touchscreen stops working after resume. Let's see if that solves even this issue.

lviggiani commented 3 years ago

Hi, unfortunately the thing is still unstable... today I got ghost touches after resume, I ran sudo iptsd-reset-sensor. The ghost touches disappeared but the touchscreen / pen stopped working as well :(

lviggiani commented 3 years ago

I've also noticed that it seems to happen more frequently when you change power source while in sleep. For example, yesterday night I put the computer in sleep while running on battery then this morning I plugged get external power in before waking the computer up and I got the issue

StollD commented 3 years ago

Hi, unfortunately the thing is still unstable... today I got ghost touches after resume, I ran sudo iptsd-reset-sensor. The ghost touches disappeared but the touchscreen / pen stopped working as well :(

Please post your dmesg.

Also, we cant really do anything about the ghost touches. The problem is that the touchscreen automatically calibrates itself sometimes, and we have no idea how to send it proper calibration data. The sensor reset is a mitigation that we figured out, but it doesnt solve the actual problem.

lviggiani commented 3 years ago

Hi I have another bad news :( (sorry about that). On Arch after updating to gnome-desktop-40 (not full gnome 40 yet, only some "pieces" received so far), the touch screen is working whereas pen is not working. This is always reproducible. Attached is dmesg.log dmesg

Again.... very strange: after a few minutes after reboot, the pen started working. Tried three times (three reboots) and always got same behaviour

danielzgtg commented 3 years ago

I found other conditions that trigger this:

1. Static-electrified hand

https://user-images.githubusercontent.com/25646384/112932266-9cf5c980-90eb-11eb-8342-52c7ade47fec.mp4

I kept charging my body with static electricity while using the touchscreen. After a while, the touchscreen calibrates itself to produce ghost touches. You can do this with some hair + a balloon, a van de graaff generator, or an ionizing hair dryer.

When I stop doing that, the sensor calibration take a long time to return to normal. I think it's a bit faster when I ground myself on a faucet first.

This also affects the touchpad. The interference is expected though.

Do you experience the same pattern of ghost touches?

2. Resetting the sensor with a finger still pressed down

https://user-images.githubusercontent.com/25646384/112932273-9ebf8d00-90eb-11eb-9ff7-215f1a02a72f.mp4

(around 0:53 for when I reset it without touching it)

It seems like the sensor reset just throws away the calibration data and just recalculates them depending on what is happening on startup.

Are you using resuming from sleep by opening the touch cover as a lid? It might be pressing on the touchscreen a bit, causing the calibration to be different.

I've also noticed that it seems to happen more frequently when you change power source while in sleep [...]

What happens when you try the following experiment:

  1. Wake the computer from sleep
  2. Ensure the type cover is down
  3. Place one of your hands on a faucet or some other ground, and keep it firmly pressed there
  4. Move your other hand along the touchscreen with your other hand and try to wipe and go over the entire area
  5. Touch the metal on the back
  6. Lift both hands into the air
  7. Run sudo iptsd-reset-sensor without touching the touchscreen
  8. Wait 1 second
  9. Use the touchscreen again

Does the problem ever occur when you ground yourself and the touchscreen like this?

Also, we cant really do anything about the ghost touches

We could do something about them in multitouch mode. The simplest solution would be to assume the noise floor is higher, and subtract a larger value. This would be at the cost of ignoring lighter presses and losing accuracy. We could also tune the constants in libqzed to reduce the problem

lviggiani commented 3 years ago

That's interesting! Actually it's been quite dry weather in the past few days (around 30% relative humidity). Today it's not happening, however the very first time I'll see the issue again I'll try the experiment and give a feedback. Thanks!

lviggiani commented 3 years ago

I found other conditions that trigger this:

1. Static-electrified hand

video1.mp4

I kept charging my body with static electricity while using the touchscreen. After a while, the touchscreen calibrates itself to produce ghost touches. You can do this with some hair + a balloon, a van de graaff generator, or an ionizing hair dryer.

When I stop doing that, the sensor calibration take a long time to return to normal. I think it's a bit faster when I ground myself on a faucet first.

This also affects the touchpad. The interference is expected though.

Do you experience the same pattern of ghost touches?

2. Resetting the sensor with a finger still pressed down

video2.mp4

(around 0:53 for when I reset it without touching it)

It seems like the sensor reset just throws away the calibration data and just recalculates them depending on what is happening on startup.

Are you using resuming from sleep by opening the touch cover as a lid? It might be pressing on the touchscreen a bit, causing the calibration to be different.

I've also noticed that it seems to happen more frequently when you change power source while in sleep [...]

What happens when you try the following experiment:

1. Wake the computer from sleep

2. Ensure the type cover is down

3. Place one of your hands on a faucet or some other ground, and keep it firmly pressed there

4. Move your other hand along the touchscreen with your other hand and try to wipe and go over the entire area

5. Touch the metal on the back

6. Lift both hands into the air

7. Run `sudo iptsd-reset-sensor` without touching the touchscreen

8. Wait 1 second

9. Use the touchscreen again

Does the problem ever occur when you ground yourself and the touchscreen like this?

Also, we cant really do anything about the ghost touches

We could do something about them in multitouch mode. The simplest solution would be to assume the noise floor is higher, and subtract a larger value. This would be at the cost of ignoring lighter presses and losing accuracy. We could also tune the constants in libqzed to reduce the problem

Hi, Ive tried the proedure desiribed in this post and ghost touches stop but the touch screen stops working too

lviggiani commented 3 years ago

I can also confirm that the issue only occurs when the external power is connected. Perhaps it introduces static electricity?

k4ever commented 3 years ago

I only have this issue on my SP4 when the Surface Typecover is attached and the tablet is plugged in. If I detach the keyboard, plug the tablet in, then put the tablet to sleep, it wakes up just fine every time. However, if the keyboard is attached prior to putting the tablet to sleep and plugging it in, once the tablet wakes, I get the touch screen issues described in this thread almost every time.

Augustronic commented 3 years ago

I must admit, I have the same issue all the time. This led me to the action, to clean-install Manjaro after years of flawless usage. It was re-introduced the moment I installed the surface-kernel and it's add-ons. libwacom-surface is suspect to me, but this is esotheric.I have no idea.

Augustronic commented 3 years ago

Btw, I am able to write this with my Bluetooth mouse switched off at boot.

Augustronic commented 3 years ago

Other than that my Surface Book 2 is unusable in Manjaro. Having Windows alongside, everything is fine.

Bodhi-Teraguchi commented 3 years ago

I have the same issue on surface pro 4.

tduck973564 commented 3 years ago

Same here, but I have been having them for a lot longer.

dossidr commented 2 years ago

Hello everyone,

I can also confirm the problem. There is a lot of phantom movement and input even though neither the keyboard nor the pen is used. I'm using a SP4 with 16Gb Ram. You have to say that my device also has the flicker problem as soon as it gets very warm. The on-screen keyboard does not work either. There is a double click and missing entries. Unlike what is described, it does not feel very airy. I tested FEDORA34 and UBUNTU 04/20. Both the same problem. This means that the PEN and TOUCH options cannot be used.

MichelJonkman commented 2 years ago

Hello everyone,

I can also confirm the problem. There is a lot of phantom movement and input even though neither the keyboard nor the pen is used. I'm using a SP4 with 16Gb Ram. You have to say that my device also has the flicker problem as soon as it gets very warm. The on-screen keyboard does not work either. There is a double click and missing entries. Unlike what is described, it does not feel very airy. I tested FEDORA34 and UBUNTU 04/20. Both the same problem. This means that the PEN and TOUCH options cannot be used.

Same device but the pen works, random clicks happen when not touching it and when holding my finger on it just goes haywire

dr-waterstorm commented 2 years ago

Sadly I can confirm this for my Surface Pro 4 with Manjaro.

Using sudo iptsd-reset-sensor stops the issue, but also disables the touchscreen completely. It starts works again after a reboot, but continues with the ghost touches. It does not matter if I plug in/unplug the power or the keyboard, it happens in any case.

The strange thing: sometimes (very rarely) after a reboot it does work for a few hours. But lately I could not use the touchscreen at all, even after many reboots.

MeisterLLD commented 2 years ago

Same problem here on Surface Pro 2017 on Arch Linux.

frederikb96 commented 2 years ago

I do also have this issue on my Surface Pro 4 with latest kernel. Sometimes it is gone after a reboot and/or detaching and reconnecting power supply and/or keyboard. However, I have not yet discovered a pattern that is always fixing the issue. Often, I just have to disable touch via sudo iptsd-reset-sensor and live with it.

Though, if I boot to Windows the problem does not occur at all. Consequently, I guess that the induced static electricity is at least somehow handled in Windows, such that it is not problematic.

It would already be very beneficial if there is a way to enable touch again after it has been disabled via sudo iptsd-reset-sensor.

frederikb96 commented 2 years ago

I found a way to improve my situation significantly. As reported in #389, it is possible to change the touch threshold in /etc/ipts.conf. I uncommented the line and tested values between 10 and 40. 10 let to the default result with ghost touches everywhere, and with 40 the touch was barely recognizable. However, 20 worked out really well for me, and it is much more usable this way, also way less accidental double taps. A reboot was necessary to apply the changes.

gitnoob78 commented 1 year ago

This worked for me.

SeongGino commented 1 year ago

FWIW, I too have this issue on an SP4, but editing /etc/ipts.conf's TouchThreshold to 18 worked for my device.

frederikb96 commented 1 year ago

I do also have this issue on my Surface Pro 4 with latest kernel. Sometimes it is gone after a reboot and/or detaching and reconnecting power supply and/or keyboard. However, I have not yet discovered a pattern that is always fixing the issue. Often, I just have to disable touch via sudo iptsd-reset-sensor and live with it.

Though, if I boot to Windows the problem does not occur at all. Consequently, I guess that the induced static electricity is at least somehow handled in Windows, such that it is not problematic.

It would already be very beneficial if there is a way to enable touch again after it has been disabled via sudo iptsd-reset-sensor.

I discovered that by using sudo systemctl stop iptsd.service and sudo systemctl start iptsd.service it is indeed possible to stop and start without rebooting.

However, sometimes it goes to a state where starting the service is always failing after 5s with Code=exited, status=237/KEYRING. In this case, only a reboot helps...

danielzgtg commented 1 year ago

only a reboot helps

Try:

sudo killall iptsd
sudo rmmod ipts
sleep 5
sudo modprobe ipts

Then you will only need to reboot if you see Intel ME errors.

frederikb96 commented 1 year ago

only a reboot helps

Try:

sudo killall iptsd
sudo rmmod ipts
sleep 5
sudo modprobe ipts

Then you will only need to reboot if you see Intel ME errors.

I will try it next time, thanks :)

frederikb96 commented 1 year ago

Ok, it really helped, but I had to modify it a little:

sudo systemctl stop iptsd.service; sleep 2; sudo killall iptsd; sudo rmmod ipts; sleep 5; sudo modprobe ipts; sleep 2; sudo systemctl start iptsd.service