Wacom tablet removed after sleep mode
Finally, I found a convenient solution! It is indeed some bug in (K)ubuntu 14.04 which affects many tablet PC users. The bug has been filed as Launchpad Bug #1275416.
A number of workaround solutions are suggested there. The solution offered in this answer by Rmano is not far off, but the suggested script just doesn't work in my case. (I'm using a Lenovo ThinkPad X201 Tablet.)
The script from post no. 21 of the bug report, plus the command from post no. 22, however, works:
-
Create a file
/etc/pm/sleep.d/20_x200-wacom-workaround
with this content:#!/bin/sh reenable_touch() { for idfile in /sys/class/tty/ttyS*/device/id; do if test -f $idfile; then if grep -q '^WACf00c$' $idfile; then devicefile=`echo "$idfile" | \ sed -n \ 's/^\/sys\/class\/tty\/ttyS\([0-9]\+\)\/.*$/\/dev\/ttyS\1/p'` if test -n $devicefile; then inputattach --daemon -w8001 $devicefile break fi fi fi done } case $1 in resume|thaw) reenable_touch ;; esac
-
Make that file executable to ensure it can run on resume:
sudo chmod +x /etc/pm/sleep.d/20_x200-wacom-workaround
After waking from sleep mode, the notification that the Wacom tablet is removed is now followed right after by another notification saying that the Wacom tablet is reactivated … exactly how it used to be in (K)ubuntu 12.04 as well. Problem solved.
During the suspend and resume phases, Ubuntu (really every Linux system using pm-utils) executes a series of scripts located in the directory /etc/pm/sleep.d/
; they are executed in alphabetic order --- from 0..9A..Z during suspend, and the other way around during resume. Conventionally all scripts start with a number (00,01,02...) and there is also a conventional meaning to the numbering. More info on the really well made page on Arch Linux doc site. Scripts are called with an argument that can be "suspend", "resume", "hibernate", "thaw" so they can know why they are called.
So if you want to unload and reload the wacom module at suspend and resume, respectively, you can add a script --- for example, /etc/pm/sleep.d/04_myscript
with the content:
#!/bin/sh
case "$1" in
resume|thaw)
modprobe wacom
;;
suspend|hibernate)
rmmod wacom
;;
esac
exit 0
And remember to make the script executable and readable by root, with
chmod 755 /etc/pm/sleep.d/04_myscript
Caveats:
all of the above must be done as root; so to edit the script and to change its permission you have to add the appropriate
sudo
.this is really a hack --- unloading and reloading the module can confuse applications. For example, it will definitely confuse
xournal
that would not be able to see the touchscreen after tat unless you restart it.