linux-surface / iptsd

Userspace daemon for Intel Precise Touch & Stylus
GNU General Public License v2.0
98 stars 47 forks source link

wouse events weird after update to 0.3.1-1 #30

Open stegerpl opened 3 years ago

stegerpl commented 3 years ago

I am working on a surface pro-4 with KDEneon (ubuntu focal basis) and run the iptsd update today. After the update my surface was almost not operable anymore. The mouse cursor was jumping and activating things randomly. However I also realized, that the Stylus and Touch Input was now working - but heavily displaced (both of them). Same situation with X11 as well as wayland.

I had to deinstall iptsd completely to get my surface working again.

kernel 5.9.11-surface | KDE 5.77.0 | QT 5.15.2 | Plasma 5.20.4

sp1ritCS commented 3 years ago

I face the same issue on my SP4 too.

After upgrading today to Fedora 33, apperantly random touch inputs are beeing sent to libwacom. While this was happening, the area where my pen was working was only the upper left quarter of my sceen, but the pen input was streched to fit the whole screen.

But after downgrading iptsd, the thing was still broken. So this might be more an issue of the ipts kernel module?

For now, I disabled iptsd but I'd like to use touch and stylus.

StollD commented 3 years ago

Sometimes the touch sensor will randomly start to return very noisy data, which iptsd cannot handle properly right now. It cannot distinguish between the noise and normal inputs, so it thinks your fingers are dancing tango on the display.

There is a workaround - resetting the touch sensor - but thats not possible in the released versions of iptsd and the kernel module. I added the neccessary code for it yesterday, so if you want you could build and install the master branches of the module and the daemon to try it out.

Another possible mitigation would be to enable blocking all inputs when a palm is detected. That might reduce the garbage data that is sent to the system, because iptsd will throw away all inputs if a palm (i.e. a large enough contact area) is detected. Depending on the noise that is read from the sensor, that might or might not be the case. To enable it, add this to /etc/ipts.conf

[Config]
BlockOnPalm = true
StollD commented 3 years ago

Oh, also, it would be great if you could get us a dump of the data thats coming from IPTS, so we can take a look whats actually happening. To do that, please stop iptsd, and then run sudo ipts-dbg -b ipts-noise.bin. Let that run for a few seconds, maybe also touch the screen once or twice. Then upload the ipts-noise.bin file.

sp1ritCS commented 3 years ago

Hmm, I had to reboot my surface (suspend to memory somehow killed the wifi module) and now it's gone. I will dump that the next time that occures.

What is still not fixed tho is that only the first quarter of the screen gets accepted as the pen area (Touch works fine tho).

I tried running the iptsd manually, I get "Connected to device 1b96:006a". This corrospends with the surface-pro-4-a.conf. But taking a quick look at your code, it seems like it dosn't log what config it is now using. Is this a known issue, or is that something with gnome-shell potentially as it only occures with the pen?

Also, is it intentional that the Fedora package does not carry the /etc/ipts.conf?

StollD commented 3 years ago

What is still not fixed tho is that only the first quarter of the screen gets accepted as the pen area (Touch works fine tho).

Are you using X11 or Wayland? For me everything works fine with Gnome Wayland. Do you have an external monitor connected? What display scale are you using? (100%, 200%, something inbetween)

Also, could you run sudo evtest, select the IPTS Stylus device, use the stylus a bit, and post the full output?

I tried running the iptsd manually, I get "Connected to device 1b96:006a". This corrospends with the surface-pro-4-a.conf. But taking a quick look at your code, it seems like it dosn't log what config it is now using. Is this a known issue, or is that something with gnome-shell potentially as it only occures with the pen?

Yeah it doesn't log the config it is using. But it also kills itself if it didnt find a matching config (or rather, if the display size is 0, which happens if no config was found).

Also, is it intentional that the Fedora package does not carry the /etc/ipts.conf?

~ $ rpm -q --list iptsd-0.3.1-1.fc33.x86_64.rpm | grep etc
/etc/ipts.conf
~ $   

Its there for me. But its marked as noreplace, so it might not get installed on updates.

sp1ritCS commented 3 years ago

I'm using 200% Display-scaling, but this also occures on 100%.

I'm using wayland without external monitor. On GDM and GNOME on X it works.

Evlog: https://termbin.com/i6xz (I basically moved the Stylus from top left to the middle (at this point, the pointer reached the bottom right of the screen) and then I moved the stylus to the bottom right and stayed there for a few seconds.

This seems to me like an issue with gnome shell and not with iptsd, as it correctly reports where the stylus is.

StollD commented 3 years ago

It seems that iptsd creates the devices with the wrong resolution, it is too low. Your evtest log reports it as 10, but it should be somewhere around 40 (bit less than that, on my SB2 its 36).

A resolution thats 4 times smaller would make Gnome think that your screen is 4 times larger (its units / mm).

Did you change the display width / height in /etc/ipts.conf (or in /usr/share/ipts/surface-pro4-a.conf)? i.e., did you add something like this:

[Config]
Width = 9600
Height = 7200

Because then the calculation would infact be 9600 * 10 / 9600 == 10, explaining the weird resolution values.

sp1ritCS commented 3 years ago

No, everything is default. I've even reinstalled iptsd (to get the config file)

I tried changing that to either 9600, 7200 aswell as 2598, 1732. That didn't make a difference when restarting iptsd.

StollD commented 3 years ago

With which values did you generate the evtest log? Could you try to uninstall iptsd, remove /usr/share/ipts (if its still there) and /etc/ipts.conf and then reinstall it? Maybe also try restarting gnome, maybe it does some caching?

sp1ritCS commented 3 years ago

I've just tried checking the evtest of the touch, and yes there the resolution is 37 for X and 42 for Y.

Edit: sorry, didn's see your new message. my gh client doesn't have auto refresh

sp1ritCS commented 3 years ago

Could you try to uninstall iptsd, remove /usr/share/ipts (if its still there) and /etc/ipts.conf and then reinstall it? Maybe also try restarting gnome, maybe it does some caching?

Uninstalled iptsd, removed /usr/share/ipts/, restarted the display manager, installed iptsd. Still doesnt work.

I'm unsure what you mean with values from evtest.

sp1ritCS commented 3 years ago

Oh, just checked evtest again, now the resolution is indeed 37(x) and 42(y) for the stylus. That doesn't fix the issue tho :/.

stegerpl commented 3 years ago

Yesterday I set up a new installation of KDEneon and run into the same problem again. Not from the very beginning, but after reboot. I purged iptsd and everything was OK again (but missing touch and stylus). I came up with version 0.3.1 (actual we have 0.3.1-1). I faced the problem with wayland as well as X11. The resolution item sounds interesting, because a have a X-dislocation when I want to make a screenshot with flameshot. It is different (in distance as well as direction) between wayland and X11, shifting the whole screens areas (I have 3) towards the left or right for the capture.

sp1ritCS commented 3 years ago

Yesterday I set up a new installation of KDEneon and run into the same problem again. Not from the very beginning, but after reboot. I purged iptsd and everything was OK again (but missing touch and stylus). I came up with version 0.3.1 (actual we have 0.3.1-1). I faced the problem with wayland as well as X11.

Yes, from my understanding the "random" touch events occurr when the touch sensor returns garbage data. For me, it either does return garbage or it does not. Reboot a couple times and see if it still does this. (Or compile ipts and iptsd and reset the sensor, as @StollD wrote)

EuanFH commented 3 years ago

I think I'm having the same issue. I have to use the lts kernel and use its ipts drivers instead because of this at the moment. With the lts kernel my touch works perfectly. Is there anything I can do to help debug this issue?

GongT commented 2 years ago

+1 my stylus works well, can I disable touch only?

when my pen hover on screen, noise will pause.

ipts-noise.bin.zip