4

The tablet functionality stops working after I wake my Lenovo Tablet from sleep mode (closing & opening lit). The error message is "Tablet Serial Wacom Tablet (Lenovo X201) removed" (screenshot: http://dl.dropbox.com/u/2471034/MOS-ASH1.jpeg). In the system settings under input devices it states that "No tablet device is detected". Only a restart helps and the touch screen works again.

This error appeared only after upgrading from Kubuntu 12.04 to 14.04. In 12.04 the same error message appeared after waking from sleep mode, but then another followed that the tablet was activated again and it worked properly. Any ideas how this could be fixed?

Thod
  • 135
  • 1
  • 10
  • 1
    Have you tried a sudo rmmod wacom; sudo modprobe wacom? If it works it can be easily scripted. – Rmano Aug 14 '14 at 14:45
  • @Rmano I read a little about rmmod and modprobe and tried your command line suggestion. The result was: "rmmod: ERROR: Module wacom is not currently loaded". But the touch screen worked at that moment. However, same result in the state when the Wacom tablet was removed after sleep mode. – Thod Aug 14 '14 at 17:48
  • @Rmano What did you mean, under which circumstances could what be scripted? – Thod Aug 14 '14 at 18:34
  • So it seems that the driver is unloaded at suspend, but not reloaded at resume. It is possible to write a script that is run at resume; I can try to prepare something for you tomorrow (it's 1am here) or you can try yourself following for example http://askubuntu.com/questions/107276/how-can-i-get-a-script-to-always-run-on-resume-in-lubuntu --- it's still valid for all the Ubuntu flavors. – Rmano Aug 14 '14 at 22:48

2 Answers2

2

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:

  1. 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
    
  2. 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.

Thod
  • 135
  • 1
  • 10
1

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:

  1. 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.

  2. 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.

z0r
  • 123
Rmano
  • 31,947
  • Thank you for your assistance! I followed your steps, learned again more about linux ;) but it won't work. No change at all. What I did was: Opened editor (Kate), pasted your script, saved under "/etc/pm.sleep.d/04_myscript". Then in terminal I made the file executable with the "chmod" command. So, the script file is there, executable, rwx r-x r-x, but no result. If I try to manually run the script in terminal with ./04_myscript.sh it gives "no such file or directory". If I do ./04_myscript there's no output at all. What did I miss? – Thod Aug 18 '14 at 09:09
  • Double check The path name it should be /etc/pm/sleep.d/04_myscript, owned by root. To execute it manually, you have to add the argument, like /etc/pm/sleep.d/04_myscript resume. – Rmano Aug 18 '14 at 21:08
  • I double checked the path and everything else. Even trying to execute the script manually as you suggested just doesn't give any noticeable result. I guess the only way now is screenshots: Path (http://dl.dropbox.com/u/2471034/Selection_003.png) File extension (http://dl.dropbox.com/u/2471034/Selection_004.png) Root and executable (http://dl.dropbox.com/u/2471034/Selection_005.png) Script text (http://dl.dropbox.com/u/2471034/Selection_006.png) Do you see what's missing to make your solution work? Using Kubuntu 14.04 after upgrade from 12.04. – Thod Aug 20 '14 at 10:48
  • So, thanks for the hints. But this script doesn't seem to help for the time being. Maybe I should file it as a bug of Kubuntu 14.04. – Thod Aug 24 '14 at 13:04
  • Comment posted as answer: your solution worked for me, I found that I was able to unplug and replug my tablet to reenable it after resume as a temporary measure prior to the fix to continue working. – Elder Geek Jun 04 '15 at 17:01