Difference between revisions of "Wacom Serial Tablet PC Stylus"

From ThinkWiki
Jump to: navigation, search
(Fist steps)
(Wacomcpl)
Line 111: Line 111:
  
 
For Debian [lenny] go to System > Preferences > Sessions.
 
For Debian [lenny] go to System > Preferences > Sessions.
Add a new startup program and add the command {{cmdroot|sh /home/yourusername/.xinitrc}}. click ok.
+
Add a new startup program and add the command  
 +
    sh /home/yourusername/.xinitrc
 +
click ok.
  
 
==xrandr Rotation==
 
==xrandr Rotation==

Revision as of 15:41, 29 October 2009

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.


Fist 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/

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

Now that you see the pen working correctly you should configure your Xserver 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
   # support for "touch" (with finger, available on x200t)
  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"
  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.

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.

 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