KWin fails to reattach device for touchscreen/stylus interface after sleep state

I’ve encountered a new issue in the past couple weeks where after coming out of sleep state, I can’t interact with the touchscreen via touch or pen. Restarting machine resolves the issue, but I’d like to get the root cause sussed out and apply a fix myself. Libinput shows after sleep state that there are no wacom devices attached, only synaptics touchpad. Before sleep state(after system reboot) Both multitouch and pen show attached. I looked up trying to restart the devices by using a modprobe command, but it only returns a rmmod hid_multitouch output. Any help is greatly appreciated! Specs below.

KDE Neon 6.3.0 | Thinkpad X1 Yoga G3, Sleep power state optimized in BIOS.

Do any crashes show up in your coredumpctl after sleeping?

Nothing but spotify crashes anytime I run it. Never worried about that though; I can still use spotify. Are there specific switchs I should implement to dig deeper?

Unlikely you can do anything by yourself, it is clearly a KWin bug or lower the stack. But you can report it and gather information so somebody can fix itk

There is sudo libinput debug-events to see if the issue is in KWin or in libinput.
If you don’t see touchscreen events when you touch the screen such as:

)
 event16  TOUCH_FRAME                 +4.481s
 event16  TOUCH_MOTION              2 +4.491s   0 (0) 60.81/36.48 (184.54/68.38mm)
 event16  TOUCH_FRAME                 +4.491s
 event16  TOUCH_MOTION              2 +4.501s   0 (0) 60.76/36.27 (184.38/68.00mm)

The issue is in libinput/kernel/driver, if you see some, the bug is in KWin.

Then Please report a bug to KWin for the input component.

If you don’t see libinput output, report a bug to libinput.

If you follow through the process including good input (hardware, system details… kinfo + libinput --version at least, logs), the right developer will get informed and will be able to fix the issue.

1 Like

I had a feeling it would need to be a bug submission; Just wanted to check with the community before crying wolf. Libinput shows null for wacom devices after sleep state, infact showing precisely when the devices are detached when lid state = 1.

-event3   KEYBOARD_KEY            +12.478s      KEY_LEFTMETA (125) pressed
 event3   KEYBOARD_KEY            +12.557s      KEY_LEFTMETA (125) released
-event5   TOUCH_DOWN              +18.100s      0 (0) 47.22/92.49 (146.07/160.95mm)
 event5   TOUCH_FRAME             +18.100s
 event5   TOUCH_UP                +18.224s      0 (0)
 event5   TOUCH_FRAME             +18.224s
-event2   KEYBOARD_KEY            +24.512s      KEY_WAKEUP (143) pressed
 event2   KEYBOARD_KEY            +24.512s      KEY_WAKEUP (143) released
-event5   TOUCH_DOWN              +49.411s      0 (0) 82.16/51.16 (254.15/89.03mm)
 event5   TOUCH_FRAME             +49.411s
 event5   TOUCH_UP                +49.517s      0 (0)
 event5   TOUCH_FRAME             +49.517s
 event5   TOUCH_DOWN              +50.153s      0 (0) 13.58/55.71 (42.00/96.95mm)
 event5   TOUCH_FRAME             +50.153s
 event5   TOUCH_UP                +50.223s      0 (0)
 event5   TOUCH_FRAME             +50.223s
-event7   POINTER_MOTION          +52.731s        0.00/  0.30 ( +0.00/ +1.00)
 event7   POINTER_MOTION          +52.792s        0.00/  0.39 ( +0.00/ +1.00)
 event7   POINTER_MOTION          +52.841s        0.00/  0.42 ( +0.00/ +1.00)
 event7   POINTER_MOTION          +52.851s        0.95/  0.00 ( +1.00/ +0.00)
 event7   POINTER_MOTION          +52.911s        0.00/  0.40 ( +0.00/ +1.00)
-event1   SWITCH_TOGGLE           +52.948s      switch lid state 1
-event5   DEVICE_REMOVED          Wacom Pen and multitouch sensor Finger seat0 default group5  cap:t  size 309x174mm ntouches 10
-event6   DEVICE_REMOVED          Wacom Pen and multitouch sensor Pen seat0 default group5  cap:T  size 309x174mm
event1  - Lid Switch: client bug: event processing lagging behind by 725ms, your system is too slow
event2  - Power Button: client bug: event processing lagging behind by 724ms, your system is too slow
-event1   SWITCH_TOGGLE           +59.455s      switch lid state 0
-event2   KEYBOARD_KEY            +59.456s      KEY_WAKEUP (143) pressed
 event2   KEYBOARD_KEY            +59.456s      KEY_WAKEUP (143) released
-event7   POINTER_MOTION          +60.975s        0.00/ -0.30 ( +0.00/ -1.00)
 event7   POINTER_MOTION          +61.034s        0.00/ -0.40 ( +0.00/ -1.00)
 event7   POINTER_MOTION          +61.082s        0.00/ -0.42 ( +0.00/ -1.00)

I tested to see if it is just sleep state or only when lid was closed, and you can see by key_leftmeta and touch where i entered sleep mode manually. I’ll get that bug submission made per the instructions and refer it to this thread. Thanks for the help!

2 Likes

Freedesktop devs came back and state that the issue rests in the kernel, not in libinput. Not really sure where to go from here, because log output points to the issue resting in libinput explicitly, correct?

I decided to toy around with troubleshooting the root cause a bit more; I think it IS the specialized sleep state setting in the BIOS of this laptop. I emulated everything down to the last config file on another same-model device, and replicated the issue 1 to 1. Went back into the BIOS on my main device, switched sleep setting back ot Windows 10 optimized rather than standard S3. Low and behold, libinput reports the device being reattached successfully.

-event1   SWITCH_TOGGLE           +2.479s       switch lid state 1
-event5   DEVICE_REMOVED          Wacom Pen and multitouch sensor Finger seat0 default group5  cap:t  size 309x174mm ntouches 10
-event6   DEVICE_REMOVED          Wacom Pen and multitouch sensor Pen seat0 default group5  cap:T  size 309x174mm
-event15  DEVICE_REMOVED          Bose Color SoundLink (AVRCP)      seat0 default group10 cap:k
event1  - Lid Switch: client bug: event processing lagging behind by 3410ms, your system is too slow
event2  - Power Button: client bug: event processing lagging behind by 403ms, your system is too slow
-event1   SWITCH_TOGGLE           +9.243s       switch lid state 0
-event2   KEYBOARD_KEY            +12.250s      KEY_WAKEUP (143) pressed
 event2   KEYBOARD_KEY            +12.250s      KEY_WAKEUP (143) released
-event6   DEVICE_ADDED            Wacom Pen and multitouch sensor Pen seat0 default group11 cap:T  size 309x174mm calib
-event5   DEVICE_ADDED            Wacom Pen and multitouch sensor Finger seat0 default group11 cap:t  size 309x174mm ntouches 10 calib
-event6   TABLET_TOOL_PROXIMITY   +14.535s              197.57*/106.46* pressure: 0.00* pen      (0x9f9109f4, id 0x11) proximity-in         axes:p  btn:S

Downside to this is that the win10 optimized sleep is HORRIBLE for power efficiency on this laptop, and requires me to press the power button to come back out of sleep. Meanwhile, S3 (linux optimized per BIOS info) sleeps as soon as the lid is closed, and wakes as soon as the lid is reopened. I can keep the device asleep for a week and still come back from a full charge with ~50% battery life left.

TLDR, Lenovo Thinkpad X1 yoga Gen3 has sleep state bugs that conflict with the KDE Kernel and reattaching hardware devices to libinput.