Wacom Serial Tablet PC Stylus

From ThinkWiki
Revision as of 14:43, 6 February 2012 by Wseltzer (Talk | contribs) (Troubleshooting: fix for oneiric stylus)
Jump to: navigation, search
Wacom Logo

Wacom Serial Tablet PC Stylus

This is a stylus made for tablet PCs by Wacom.

Features

  • Chipset: Wacom
  • Serial: irq 5 port 0x0200

Linux Support

The pen is supported by the XFree/Xorg Wacom driver. New tablets also have the MultiTouch capability. MultiTouch is experimentally supported presently by the Linux wacom project. The pen works regardless of MultiTouch support.


First steps

Get the linux wacom driver and install it on your system.

The pen uses serial and appears on some /dev/ttySnn device where nn is a number. An easy way to find it is to map /dev/ttyS0 to the pen's port and irq. The values can be found under the windows driver properties. Using values from an X41 Tablet 1869-5CU, the command is: # setserial /dev/ttyS0 port 0x0200 irq 5 autoconfig (you need to run this after every suspend/resume cycle).

This may be inserted into startup scripts in /etc/rc.d/ or /etc/rc.local

After mapping the pen, you can check its output with # wacdump -f tpc /dev/ttyS0. This will list raw information about the pens position an click status. Hit Ctrl+C to exit wacdump.

Setting up your Xorg.conf

X-Server >= 1.8 (udev)

since X-Server 1.8 udev is the default way to detect any wacom-tablet. on some distributions you have to add the file /etc/udev/rules.d/10-wacom.rules with following content:

   ACTION!="add|change", GOTO="wacom_end"
    # Match all wacom tablets with a serial ID starting with WACf or FUJ*
    ATTRS{id}=="WACf*" ENV{NAME}="Serial Wacom Tablet", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
    ATTRS{id}=="FUJ*" ENV{NAME}="Serial Wacom Tablet", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
   LABEL="wacom_end"

and /usr/share/X11/xorg.conf.d/50-wacom:

   Section "InputClass"
       Identifier "Wacom serial class identifiers"
       MatchProduct "WACf|WACf004|FUJ02e5|FUJ02e7"
       Driver "wacom"
   EndSection

thanks to the Wacom Tablet - ArchWikipage and this Archlinux-Thread

X-Server >=1.6? (hal)

if HAL is configured as it should be, your wacom-tablet is working out of the box

older X-Server (static configuration)

If you are sure, you don't want to update to a newer version, add the following sections to your xorg.conf:

   Section "InputDevice"
     Driver        "wacom"
     Identifier    "cursor"
     Option        "Device"        "/dev/ttyS0"
     Option        "Type"          "cursor"
     Option        "ForceDevice"   "ISDV4"     
     Option        "Mode"          "Absolute"
   EndSection
   
   Section "InputDevice"
     Driver        "wacom"
     Identifier    "stylus"
     Option        "Device"        "/dev/ttyS0"
     Option        "Type"          "stylus"
     Option        "ForceDevice"   "ISDV4"
   EndSection
   
   Section "InputDevice"
     Driver        "wacom"
     Identifier    "eraser"
     Option        "Device"        "/dev/ttyS0"
     Option        "Type"          "eraser"
     Option        "ForceDevice"   "ISDV4"
   EndSection
   # support for "touch" (with finger, available on x200t and some x61t)
  Section "InputDevice"
    Driver        "wacom"
    Identifier    "touch"
    Option        "Device"        "/dev/ttyS0"          # SERIAL ONLY
    Option        "Type"          "touch"
    Option        "ForceDevice"   "ISDV4"               # Serial Tablet PC ONLY
  EndSection
  Section "ServerLayout"
    Identifier     "Default Layout"
    Screen 0 "Default Screen"   0 0
    InputDevice    "Configured Mouse"    "CorePointer"
    InputDevice    "cursor" "SendCoreEvents"
    InputDevice    "stylus" "SendCoreEvents"
    InputDevice    "eraser" "SendCoreEvents"
    #InputDevice   "touch"  "SendCoreEvents" #Uncomment if you have this feature.
  EndSection

Check the wacom driver man page and website for other options.

For handwriting recognition using pen you can use CellWriter.

To get the right mouse button to map to the stylus button use this script and run it through .bashrc

   #!/bin/bash
   xsetwacom set stylus Button1 1
   xsetwacom set stylus Button2 3
   xsetwacom set stylus Button3 3

Wacomcpl

I found it useful to create a .desktop file for launching the wacomcpl program which is used for many user options for the tablet pen.

   [Desktop Entry]
   Type=Application
   Encoding=UTF-8
   Name=wacomcpl
   GenericName=linux wacom config
   Comment=linux wacom configuration tool
   TryExec=wacomcpl
   Exec=wacomcpl
   Terminal=false
   Categories=System;
   Icon=wacomcpl.png

To have your settings restore after logout/suspend/restart you will need to edit /home/yourusername/.xinitrc. Go to the last line and change

   . /etc/X11/xinit/xinitrc

to read as

   # . /etc/X11/xinit/xinitrc

Next you need to create a new sessions preference to load the user file.

For Debian [lenny] go to System > Preferences > Sessions. Add a new startup program and add the command

   sh /home/yourusername/.xinitrc

click ok.

For Ubuntu use System > Preferences > Startup Applications. add the same startup program as above.

--Jeremy! 14:49, 29 October 2009 (UTC)

Screen rotation for X41 and X61 tablets

ROTgui - Python program for screen rotation.

The above is a simple program that you bind to a key (I bound it to the "rotate" button on the screen) that will let you rotate the screen 4 ways (90, 180, 270 and 0 degrees).

I prefer manually selecting when I want to rotate the screen because I don't want to accidentally rotate it while moving the laptop around.

The site says it's for an X41, but I can confirm that it works on my X61 as well! (Only tried on Ubuntu, but being a Python program, it should work on other OS-es as well).

The code also has a python module, that will allow you to script your own screen control, if you'd rather not use the GUI (or want to use keybindings/write your own interface on top of it).

--Ogi 10:05, 6 November 2010 (UTC)

xrandr Rotation

There is work underway to create a Tablet Screen Rotation Support package for Ubuntu. Because I can afford only one tablet computer, and since this is relatively new and not many others have put any work into it yet, so far it mainly supports the Lenovo Thinkpad X61 Tablet. The next phase of development involves refactoring in such a way that it can easily be expanded to support other brands and models of tablet computer. The planned mechanism is similar to that used by the scripts in the Debian acpi-support package.

So far, it supports auto-rotation on conversion from laptop to tablet mode, including rebinding the navpad keys and turning the logical orientation of the Wacom tablet to match. It is done as an event called when the X Server has changed it's xRandR orientation. The actual work is carried out by a quick set of shell scripts that can easily be adapted and extended. The idea is that no matter what piece of software actually caused the X Server to rotate, the same things need to happen whenever it does. So the best place to hook in the support event is on an event handler for the RandR Rotate event. The programs and packaging are simple, and the source is available at the URL above. I encourage you to get a copy and learn from it while helping make it work for a new kind of tablet no other developer has created support for yet! If you can write an essay, you can write the necessary program.

Because this ThinkWiki page is one of the sources I drew from when I initially created tablet-screen-rotation-support. The following scripts by Gtx, radix, and Papertiger probably contain some elements in common. --KarlHegbloom 21:55, 9 February 2009 (UTC)

xrotate support scripts

linuxwacom is very buggy. I needed some time to get the tablet work with "xrandr -r". I use the script below to do screen rotation. copy the source an put it in /usr/local/bin/xrotate. You may change output and devices to fit to you're system (the default values work fine for an x41 tablet)

you can use "xrotate +" to rotate the screen CCW or "xrotate -" to rotate clockwise. use "xrotate x" where x is

  • 0 to set rotation to normal
  • 1 to set rotation to left
  • 2 to set rotation to inverted
  • 3 to set rotation to right
 #!/bin/sh
 
 output=LVDS
 if [ "$XROT_OUTPUT" ]
 then    
         output=$XROT_OUTPUT;
 fi
 devices="stylus cursor"
 
 geomnbr=0
 xrandr=normal
 wacom=normal
 if [ "$1" == "-" ] || [ "$1" == "+" ] || ! [ "$1" ];
 then    
         operator="$1";
         [ "$1" ] || operator='+';
         case `xrandr --verbose | grep "^$output " | sed "s/^[^ ]* [^ ]* [^ ]* ([^(]*) \([a-z]*\).*/\1/"` in
                 normal)         geom=0;;
                 left)           geom=1;;
                 inverted)       geom=2;;
                 right)          geom=3;;
         esac
         let geom=${geom}${operator}1+4
         let geom=${geom}%4
 else    
         geom="$1"
 fi
 
 
 case $geom in
         1)      wacom=2; xrandr=left ;;
         2)      wacom=3; xrandr=inverted ;;
         3)      wacom=1; xrandr=right ;;
         *)      wacom=0; xrandr=normal ;;
 esac
 
 echo "xrandr to $xrandr, xsetwacom to $wacom" >&2
 
 if xrandr --output "$output" --rotate "$xrandr"; then
         for d in $devices
         do      
                 xsetwacom set "$device" Rotate "$wacom"
         done
 fi
 
 #workaround for linuxwacom bug
 if [ "`xsetwacom get stylus Mode`" == '1' ]; then
         for d in $devices
         do      
                 xsetwacom set stylus CoreEvent "off"
                 xsetwacom set stylus Mode "off"
         done
         { sleep 1;
         for d in $devices
         do      
                 xsetwacom set stylus Mode "on"
                 xsetwacom set stylus CoreEvent "on"
         done; } &
 fi

--Gtx 13:34, 22 April 2008 (CEST)

modified script for linuxwacom 0.8.1-1.

  #!/bin/sh

output="(normal left inverted right)" #LVDS
 # if [ "$XROT_OUTPUT" ]
 # then     
 #         output=$XROT_OUTPUT;
 # fi
devices="stylus cursor"

geomnbr=0
xrandr=normal
wacom=normal
if [ "$1" == "-" ] || [ "$1" == "+" ] || ! [ "$1" ];
then    
        operator="$1";
        [ "$1" ] || operator='+';
        case `xrandr --verbose | grep "$output" | sed "s/^[^ ]* [^ ]* [^ ]* ([^(]*) \([a-z]*\).*/\1/"` in
                normal)         geom=0;;
                left)          geom=1;;
                inverted)       geom=2;;
                right)          geom=3;;
        esac
        let geom=${geom}${operator}1+4
        let geom=${geom}%4	
else    
        geom="$1"
fi
case $geom in
        1)      wacom=2; xrandr=left ;;
        2)      wacom=3; xrandr=inverted ;;
        3)      wacom=1; xrandr=right ;;
        *)      wacom=0; xrandr=normal ;;
esac

echo "xrandr to $xrandr, xsetwacom to $wacom" >&2

if xrandr -o "$xrandr"; then
        for d in $devices
        do      
                xsetwacom set "stylus" Rotate "$wacom"
        done
fi

#workaround for linuxwacom bug
if [ "`xsetwacom get stylus Mode`" == '1' ]; then
        for d in $devices
        do      
                xsetwacom set stylus CoreEvent "off"
                xsetwacom set stylus Mode "off"
        done
        { sleep 1;
        for d in $devices
        do      
                xsetwacom set stylus Mode "on"
                xsetwacom set stylus CoreEvent "on"
        done; } &
fi


--radix 13:15, 28 August 2008 (CEST)

Additional code for rotating the 4 navigation keys on the display frame.

 key_up=111
 key_down=116
 key_left=113
 key_right=114

 case $geom in
         1)      xmodmap -e "keycode $key_up = Right";xmodmap -e "keycode $key_left = Up";xmodmap -e "keycode $key_right = Down";xmodmap -e "keycode $key_down = Left";;
         2)      xmodmap -e "keycode $key_up = Down";xmodmap -e "keycode $key_left = Right";xmodmap -e "keycode $key_right = Left";xmodmap -e "keycode $key_down = Up";;
         3)      xmodmap -e "keycode $key_up = Left";xmodmap -e "keycode $key_left = Down";xmodmap -e "keycode $key_right = Up";xmodmap -e "keycode $key_down = Right";;
         *)      xmodmap -e "keycode $key_up = Up";xmodmap -e "keycode $key_left = Left";xmodmap -e "keycode $key_right = Right";xmodmap -e "keycode $key_down = Down";;
 esac

--Papertiger 22:24, 12 March 2010 (UTC)


modified script

On my X200 Tablet i have a "invert" tablet button and a "flip" button, so i modified the the script for my needs. This scripts also works with xrandr program version 1.3.2 and xsetwacom 0.10.3 under Debian Testing (Squeeze). You can call the script with "./tablet.sh flip" or "./tablet.sh invert". I mapped these two functions on the hardware buttons. The full Tutorial can be found on my blog: http://dominikschuermann.de/index.php/2010/05/thinkpad-x200-tablet-for-debian-testing/

#!/bin/bash

# config
output="LVDS1"

# get current rotation
current=`xrandr --verbose | grep "$output" | sed "s/^[^ ]* [^ ]* [^ ]* ([^(]*) \([a-z]*\).*/\1/"`
case $current in
  normal)    geom=0;;
  left)      geom=1;;
  inverted)  geom=2;;
  right)     geom=3;;
esac

if [ "$1" == "invert" ] || [ "$1" == "flip" ];
then


  # based on current rotation set new rotation
  if [ "$1" == "invert" ];
  then
  
    # invert
    case $geom in
      0)  wacom=half; xrandr=inverted;;
      1)  wacom=cw; xrandr=right;;
      2)  wacom=none; xrandr=normal;;
      3)  wacom=ccw; xrandr=left;;
    esac

  else
    
    # flip
    case $geom in
      0)  wacom=cw; xrandr=right;;
      1)  wacom=half; xrandr=inverted;;
      2)  wacom=ccw; xrandr=left;;
      3)  wacom=none; xrandr=normal;;
    esac

  fi



  echo "xrandr to $xrandr, xsetwacom to $wacom" >&2

  # rotate display
  xrandr -o $xrandr

  # rotate wacom
  xsetwacom set "stylus" Rotate $wacom
  xsetwacom set "eraser" Rotate $wacom
  xsetwacom set "touch" Rotate $wacom

else

  echo "possible parameters: flip, invert"
 
fi

--Dominiks 18:47, 17 April 2010 (UTC)

another modified script (X41)

I'm using this script to rotate the screen on my X41 (1866-WG4). The rotation is either absolute using the arguments normal, inverted, left and right or relative to the current orientation using cw or ccw.

  #!/bin/sh
  
  xrandr=normal
  wacom=NONE
  
  case "$1" in
  	normal)
  		xrandr=normal
  		wacom=NONE
  		;;
  	inverted)
  		xrandr=inverted
  		wacom=HALF
  		;;
  	right)
  		xrandr=right
  		wacom=CW
  		;;
  	left)
  		xrandr=left
  		wacom=CCW
  		;;
  	cw|ccw)
  		case `xrandr --verbose -q -o normal --dryrun | grep "Current rotation" | sed "s/Current\ rotation\ \-\ //g"` in
  			normal)
  				if [ "$1" = "cw" ]; then
  					xrandr=right
  					wacom=CW
  				else
  					xrandr=left
  					wacom=CCW
  				fi
  				;;
  			left)
  				if [ "$1" = "cw" ]; then
  					xrand=normal
  					wacom=NONE
  				else
  					xrandr=inverted
  					wacom=HALF
  				fi
  				;;
  			inverted)
  				if [ "$1" = "cw" ]; then
  					xrandr=left
  					wacom=CCW
  				else
  					xrandr=right
  					wacom=CW
  				fi
  				;;
  			right)
  				if [ "$1" = "cw" ]; then
  					xrandr=inverted
  					wacom=HALF
  				else
  					xrandr=normal
  					wacom=NONE
  				fi
  				;;
  		esac
  		;;
  	*)
  		echo "Usage: $0 {normal|left|right|inverted|cw|ccw}"
  		exit 1
  		;;
  esac
   
  if xrandr --output LVDS1 --rotate "$xrandr"; then
  	xsetwacom --set stylus0 Rotate "$wacom"
  	xsetwacom --set cursor0 Rotate "$wacom"
  	xsetwacom --set eraser0 Rotate "$wacom"
  	exit 0
  fi
  
  exit 1

You will have to change lines 69 to 73 to suit your configuration. LVDS1 is the laptop screen as returned by xrandr; stylus0, cursor0 and eraser0 are what I have called the wacom devices in my xorg.conf. The software I'm using on my X41 is the following:

  $ xrandr -v
  xrandr program version       1.3.3
  Server reports RandR version 1.3
  
  $ xsetwacom -V
  0.10.5

I am using the intel driver for the graphics adapter; unfortunately, display rotation is not possible with the kernel's intel framebuffer driver and Xorg's fbdev. Both xrandr and xsetwacom were installed from debian sid repositories, xsetwacom came with the xserver-xorg-input-wacom package, not wacom-tools.

--mk 16.51, 6 August 2010 (CEST)


X41 tablet with UBUNTU 10.10

On my thinkpad X41 tablet with Ubuntu 10.10 i got this message with the previous script:

Cannot find device 'stylus0'.
Cannot find device 'cursor0'.
Cannot find device 'eraser0'

In order to get it work I had to change this script a little bit (I didn't need to change or create an "xorg.conf" or anything else, I only used this script):

1. Type in a terminal: 'xinput --list':

maxi@maxi-ThinkPad-X41-Tablet:~$ xinput --list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                   	id=10	[slave  pointer  (2)]
⎜   ↳ Serial Wacom Tablet eraser              	id=12	[slave  pointer  (2)]
⎜   ↳ Serial Wacom Tablet stylus              	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=8	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=9	[slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  	id=11	[slave  keyboard (3)]
maxi@maxi-ThinkPad-X41-Tablet:~$

So you know the id numbers of your Eraser (12) and Stylus (13)

2. Modify the script given in this article: Instead of "Eraser" and "Stylus" use your id-numbers: Change

  if xrandr --output LVDS1 --rotate "$xrandr"; then
  	xsetwacom --set stylus0 Rotate "$wacom"
  	xsetwacom --set cursor0 Rotate "$wacom"
  	xsetwacom --set eraser0 Rotate "$wacom"
  	exit 0
  fi

into

  if xrandr --output LVDS1 --rotate "$xrandr"; then
  	xsetwacom --set 13 Rotate "$wacom"
#  	xsetwacom --set cursor0 Rotate "$wacom"
  	xsetwacom --set 12 Rotate "$wacom"
  	exit 0
  fi

So in total, you should have the following script saved in a file (for example xrandr in your homefolder /home/"username")

#!/bin/sh
  
  xrandr=normal
  wacom=NONE
  
  case "$1" in
  	normal)
  		xrandr=normal
  		wacom=NONE
  		;;
  	inverted)
  		xrandr=inverted
  		wacom=HALF
  		;;
  	right)
  		xrandr=right
  		wacom=CW
  		;;
  	left)
  		xrandr=left
  		wacom=CCW
  		;;
  	cw|ccw)
  		case `xrandr --verbose -q -o normal --dryrun | grep "Current rotation" | sed "s/Current\ rotation\ \-\ //g"` in
  			normal)
  				if [ "$1" = "cw" ]; then
  					xrandr=right
  					wacom=CW
  				else
  					xrandr=left
  					wacom=CCW
  				fi
  				;;
  			left)
  				if [ "$1" = "cw" ]; then
  					xrand=normal
  					wacom=NONE
  				else
  					xrandr=inverted
  					wacom=HALF
  				fi
  				;;
  			inverted)
  				if [ "$1" = "cw" ]; then
  					xrandr=left
  					wacom=CCW
  				else
  					xrandr=right
  					wacom=CW
  				fi
  				;;
  			right)
  				if [ "$1" = "cw" ]; then
  					xrandr=inverted
  					wacom=HALF
  				else
  					xrandr=normal
  					wacom=NONE
  				fi
  				;;
  		esac
  		;;
  	*)
  		echo "Usage: $0 {normal|left|right|inverted|cw|ccw}"
  		exit 1
  		;;
  esac
   
  if xrandr --output LVDS1 --rotate "$xrandr"; then
  	xsetwacom --set 13 Rotate "$wacom"
#  	xsetwacom --set cursor Rotate "$wacom"
  	xsetwacom --set 12 Rotate "$wacom"
  	exit 0
  fi
  
  exit 1

After you saved it as "xrandr", open a terminal, go to the folder, in which you saved "xrandr", and type

chmod +x xrandr

in order to be able to use this script with typing in an terminal

./xrandr right
./xrandr normal

--User:klob 11.40, 24 October 2010 (CEST)


If you want to easily switch between two orientations, you can use the following script. You can assign this script to the corresponding button on the tablet. It os working on my Thinkpad X61 tablet. If you remove the "yes" after flipflop= the script works as the script above.

#!/bin/sh

#
# wether to run in flipflop-Mode. Leave blank if not.
# In flipflop mode you can easily switch between two preferred orientations.
#
flipflop=yes



par=$1
semaphore=/tmp/rotate.sem
if [ -n "$flipflop" ]; then
  # only if variable $flipflop is set
  if [ -f $semaphore ]; then 
    # semaphore exists
    rm $semaphore
    par=normal
  else
    # semaphore dont exist -> create it
    touch $semaphore
    par=right
  fi
fi



  xrandr=normal
  wacom=NONE
  
  case "$par" in
  	normal)
  		xrandr=normal
  		wacom=NONE
  		;;
  	inverted)
  		xrandr=inverted
  		wacom=HALF
  		;;
  	right)
  		xrandr=right
  		wacom=CW
  		;;
  	left)
  		xrandr=left
  		wacom=CCW
  		;;
  	cw|ccw)
  		case `xrandr --verbose -q -o normal --dryrun | grep "Current rotation" | sed "s/Current\ rotation\ \-\ //g"` in
  			normal)
  				if [ "$par" = "cw" ]; then
  					xrandr=right
  					wacom=CW
  				else
  					xrandr=left
  					wacom=CCW
  				fi
  				;;
  			left)
  				if [ "$par" = "cw" ]; then
  					xrand=normal
  					wacom=NONE
  				else
  					xrandr=inverted
  					wacom=HALF
  				fi
  				;;
  			inverted)
  				if [ "$par" = "cw" ]; then
  					xrandr=left
  					wacom=CCW
  				else
  					xrandr=right
  					wacom=CW
  				fi
  				;;
  			right)
  				if [ "$par" = "cw" ]; then
  					xrandr=inverted
  					wacom=HALF
  				else
  					xrandr=normal
  					wacom=NONE
  				fi
  				;;
  		esac
  		;;
  	*)
  		echo $flipflop
  		if [ -z $flipflop ]; then
  			# only if variable flipflop is not set
	  		echo "Usage: $0 {normal|left|right|inverted|cw|ccw}"
  			exit 1
  		fi
  		;;
  esac
   
  if xrandr --output LVDS1 --rotate "$xrandr"; then
  	xsetwacom --set 13 Rotate "$wacom"
#  	xsetwacom --set cursor Rotate "$wacom"
  	xsetwacom --set 12 Rotate "$wacom"
  	exit 0
  fi
  
  exit 1

--User:dcjfm 10.20, 23 November 2010 (CEST):

Troubleshooting

If the stylus still doesn't work try to reset the bios. This fixed it for me. --Gtx 08:22, 21 April 2008 (CEST)

Ubuntu 11.10 (Oneiric Ocelot): Per the thread at Ubuntuforums, comment out or remove /lib/udev/rules.d/40-inputattach.rules to get the stylus functioning.

Magick-Rotation is useful for auto-rotating the screen but may require switching the cw / ccw notations to match the stylus orientation to that of the screen (bug). --wseltzer

Models featuring this Device