5

I have a Thinkpad Yoga 14 with support for Pen and Touch on the screen. When resuming, sometimes the networking does not work properly. I can fix this with service network-manager restart. What also always happens is that Pen and Touch does not work anymore. There do not seem to be probems with it's configuration with xinput and synclient. So I assume that there may be some service I can restart or so? Or some other fix to make it work again without restarting or logging off. Maybe someone has an Idea. service wacom-inputattach restart did not work, unfortunately.

verpfeilt
  • 2,874

5 Answers5

5

This same problem cropped up for me a few months ago on my Thinkpad Yoga 14, running Ubuntu 14.04: while the touchscreen/pen worked perfectly fine for over a year, no matter how many sleep/resume cycles, they stopped responding after sleep/resume sometime around December 2016 (presumably due to a change in an updated kernel?). Pen and touch still worked fine on initial boot, including the splash screen. Various suggestions from the web did not resolve the issue:

  • Alt+Ctrl+F1 / Alt+Ctrl+F6 didn't work
  • sudo modprobe hid_multitouch didn't work
  • xinput disable/enable (touchscreen ID) didn't work
  • I didn't even try the firmware upgrade, as pen/touch were obviously still functioning on fresh restart

Finally, buried deeply in some links that led to http://linuxwacom.sourceforge.net/wiki/index.php/Input-wacom , I found a solution which seems simple in hindsight: reloading the wacom and wacom_w8001 modules

sudo modprobe -r wacom
sudo modprobe -r wacom_w8001
sudo modprobe wacom
sudo modprobe wacom_w8001

You could write a script to automatically run this on resume; I just threw it in a shell script to run manually when necessary. Hope this helps someone

pjcigan
  • 66
2

/usr/sbin/rtcwake -m freeze -s 1 - does the trick for me!

Thanks to: (https://forums.lenovo.com/t5/Other-Linux-Discussions/X1Y3-Touchscreen-not-working-after-resume-on-Linux/td-p/4021200)

You can make a service that runs the script on system resume.

Create a file in /etc/systemd/system/: e.g. wake_hack.service:

[Unit]
Description=Wakeup
After=suspend.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/rtcwake -m freeze -s 1

[Install]
WantedBy=suspend.target

enable in standard way: (as root)

systemctl enable wake_hack.service

Oliver
  • 121
  • Indeed, this also works for me (currently on Ubuntu 18.04). Thanks! I tried the command manually (with sudo), not the rest (yet). Anyway, it's strange: The solution here is some kind of suspend state for one second. Anyway, I think I will try to set up the service tomorrow. Say, did the other solution help you (with modprobe)? I think it's execution is faster, and I might try to set up the service with the other solution. Big thanks for pointing out how to create a service with systemd. – verpfeilt Apr 04 '19 at 22:05
  • 2
    Sadly this doesn't seem to work on an ThinkPad X1 Yoga 3G. Any ideas what could be different here? – aef Jul 05 '19 at 08:16
  • @aef were you ever able to find a solution? – Caleb_Allen Sep 13 '19 at 03:10
  • 2
    @Caleb_Allen I am able to avoid the problem most of the times by putting the machine to standby before closing the laptop lid. If the touchscreen device is ever missing, I use hibernation to get it back. The least annoying workaround I found so far. Still looking for improvement. – aef Sep 16 '19 at 08:54
  • At least for me under Ubuntu 20.04, this has the effect to enter a permanent "freeze" state after resume, and usually no keyboard action can bring the system back from that. Only a reboot will help then. Take care! – tanius Oct 11 '20 at 21:16
  • My Thinkpad X1 Yoga 3G also have the same issue with 20.04 Ubuntu. rtcwake mentioned above does not help to reactive the touchscreen. What helps to reactive touchscreen after sleep is closing and reopening the lid right after that. – Ievgen Jan 02 '22 at 07:58
0

Here is a solution for systemd based systems (Ubuntu 16.10 and newer):

Instructions

  1. Find out which serial device your Wacom touchscreen is recognized as. For that, run sudo cat /proc/tty/driver/serial | grep 16550A and look at the first number in the output line. For example if the output is:

    4: uart:NS16550A port:00000200 irq:5 tx:19 rx:411732 RTS|DTR
    

    then your Wacom tablet is /dev/ttyS4. If you see multiple lines, test all corresponding devices one after the other by executing sudo inputattach --dump /dev/ttyS… for the device and then touching the screen to see if it generates some output. The device that does is your touchscreen device.

  2. Create a file /etc/systemd/system/restart-wacom-inputattach.service with this content, supplying your own device number instead of the 4 in ttyS4:

    [Unit]
    Description=restart the wacom-inputattach service
    After=suspend.target
    

    [Service] User=root Type=simple ExecStart=/bin/systemctl --no-block restart wacom-inputattach@ttyS4 TimeoutSec=0 StandardOutput=syslog

    [Install] WantedBy=suspend.target

  3. Enable your new service with:

    sudo systemctl enable /etc/systemd/system/restart-wacom-inputattach.service
    

Explanations and Details

  • The problem of restarting a Wacom touchscreen reoccurred in multiple versions of Ubuntu. Any report before Ubuntu 16.10 is related to the pm-utils system and solutions (like from here) and cannot be applied to the systemd based system we have now. The solution provided above is for systemd based systems.

  • Ubuntu comes with a service /lib/systemd/system/wacom-inputattach@.service provided by package xserver-xorg-input-wacom. The problem is, it does not survive a suspend-and-resume cycle. Our solution is to create another service that will restart it whenever the system comes back from suspend, as seen here.

  • Services having an @ in their name can be started with a parameter, which we do here using the touchscreen's serial device name. On most systems, this device name is constant between reboots and after a resume, but if not, you will need a more complex solution along the lines of this one.

  • For diagnostic purposes, check the output of your custom service in journalctl to see if it is actually doing something:

    journalctl -u restart-wacom-inputattach.service
    
  • Our custom service does not execute a long-running command but just restarts another service (that in turn runs the long-running command). Due to this, you can schedule other services to run after it finished. This is useful for example to calibrate the touchscreen after resume, for example for use in a dual-monitor setup – see my other answer.

  • You will often see the proposal to execute sudo inputattach --daemon -w8001 /dev/ttyS4 (or similar) to restart your touchscreen. That works when done in a terminal, but for reasons unknown to me fails when done in a systemd service, even though it produces the same output in dmesg. Fortunately, the command isdv4-serial-inputattach, as used in the wacom-inputattach@.service service, can be used inside systemd services to do the same.

tanius
  • 6,303
  • 1
  • 39
  • 49
0

The similar problem has occured on my Lenovo Yoga laptop when touchscreen and stylus were not working. Solution proposed by @pjcigan helped me with the touchscreen but not with stylus. For that, you need to restart more drivers.

#!/bin/bash

sudo modprobe -r wacom sudo modprobe -r wacom_w8001 sudo modprobe -r wacom_i2c sudo modprobe -r wacom_serial4

sudo modprobe wacom sudo modprobe wacom_w8001 sudo modprobe wacom_i2c sudo modprobe wacom_serial4

-2

This simple bash script to reload the atmel_mxt_ts module works for me:

echo "Running rmmod and modprobe...\n"
rmmod atmel_mxt_ts
modprobe atmel_mxt_ts
echo "Mouse pad / touchscreen should be working again? ;-)\n"
Zanna
  • 70,465