Wacom Serial Tablet PC Stylus

From ThinkWiki
Revision as of 10:16, 25 January 2009 by Gmaxwell (Talk | contribs) (Yes; there should be an eraser section here; current version of xsetwacom uses numbers.)
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.

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/

The X config file needs to be changed to use the stylus. 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


Add the following lines to the ServerLayout section:

   InputDevice    "cursor" "SendCoreEvents"
   InputDevice    "stylus" "SendCoreEvents"
   InputDevice    "eraser" "SendCoreEvents"

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

xrandr Rotation

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 my 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 "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

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

 case $geom in
         1)      xmodmap -e 'keycode 98 = Right';xmodmap -e 'keycode 100 = Up';xmodmap -e 'keycode 102 = Down';xmodmap -e 'keycode 104 = Left';;
         2)      xmodmap -e 'keycode 98 = Down';xmodmap -e 'keycode 100 = Right';xmodmap -e 'keycode 102 = Left';xmodmap -e 'keycode 104 = Up';;
         3)      xmodmap -e 'keycode 98 = Left';xmodmap -e 'keycode 100 = Down';xmodmap -e 'keycode 102 = Up';xmodmap -e 'keycode 104 = Right';;
         *)      xmodmap -e 'keycode 98 = Up';xmodmap -e 'keycode 100 = Left';xmodmap -e 'keycode 102 = Right';xmodmap -e 'keycode 104 = Down';;
 esac

--Papertiger 02:05, 16 January 2009 (UTC)

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)

Models featuring this Device