Getting pen and rotation to work on X60t.
NOTE: I used Gentoo Linux with kernel 2.6.25 with tuxonice patch and linuxwacom-0.8.0_p20.
First make sure you have the wacom drivers that come with the kernel compiled into the kernel or compiled as a module.
Though I’m not sure if it is nessesary or not.
Deveice Drivers --->
Input Device Support --->
Tablets --->
<M> Wacom Intuos/Graphire tablet support (USB)
In gentoo you have to unmask the newest version of the linuxwacom driver. To do this do the following unless you are running
an ~arch:
echo "x11-drivers/linuxwacom ~*" >> /etc/portage/package.keywords
Now install the linuxwacom package:
emerge linuxwacom
When it is done installing we can add the nessesary sections in the Xorg.conf to make it respond to the input from the tablet.
Make your Section “ServerLayout” look similar to this (yours might look a little bit different, the important part is the
Stylus, Cursor and Eraser):
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Mouse1" "SendCoreEvents"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Cursor" "SendCoreEvents"
InputDevice "Stylus" "SendCoreEvents"
InputDevice "Eraser" "SendCoreEvents"
EndSection
We also need to add some device sections:
Section "InputDevice"
Identifier "Cursor"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "Type" "cursor"
Option "ForceDevice" "ISDV4"
Option "Mode" "Absolute"
Option "BottomY" "18432"
Option "BottomX" "24576"
EndSection
Section "InputDevice"
Identifier "Stylus"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4"
Option "TPCButton" "off"
Option "BottomY" "18432"
Option "BottomX" "24576"
Option "Mode" "Absolute"
EndSection
Section "InputDevice"
Identifier "Eraser"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "Type" "eraser"
Option "ForceDevice" "ISDV4"
Option "BottomY" "18432"
Option "BottomX" "24576"
EndSection
The Optiopn “ForceDevice” “ISDV4″ is nessesary when using serial tablets.
Before we can restart Xorg, we need to tell the system where the tablet device is, you have to do this on every boot:
setserial /dev/ttyS0 port 0x0200 irq 5 autoconfig
Add this line to /etc/conf.d/local.start (or at least that is how you do in gentoo, this might be different on other
distro’s with different kind of init systems).
After a restart of Xorg the tablet should now work. Try it out. I use Xournal to make notes.
Now we got the tablet to work we can play a bit with rotating the screen when you swivel down the screen and when you
swivel it up. Also when you push the rotate button on the buttons beneath the screen.
Make sure you have the newest thinkpad package and acpid installed:
echo "app-laptop/thinkpad ~*" >> /etc/portage/package.keywords
echo "sys-power/acpid ~*" >> /etc/portage/package.keywords
Install both packages:
emerge thinkpad acpid
Modprobe the thinkpad module and start the acpid daemon:
modprobe thinkpad
/etc/init.d/acpid start
Also make the daemon start and load the module on every boot:
rc-update add acpid default
echo 'modules_2_6="${modules_2_6} thinkpad"' >> /etc/conf.d/modules
echo 'module_thinkpad_args_2_6=""' >> /etc/conf.d/modules
When you swivel down the monitor and when you swivel it up it generates an acpi event. This event looks like this:
When swivling down:
Jun 9 02:22:37 arcadia acpid: received event "ibm/hotkey HKEY 00000080 00005009"
When swivling up:
Jun 9 02:22:45 arcadia acpid: received event "ibm/hotkey HKEY 00000080 0000500a"
You can find out what events your tablet makes either by tailing /var/log/messages or use acpi_listen.
When we know what events there are made, we can make acpid execute some scripts for us.
Make a file in /etc/acpi/events called x60t-swivel-down and one that is called x60t-swivel-up.
x60t-swivel-down should contain the following:
# called when tablet screen swivels down (into tablet mode)
event=ibm/hotkey HKEY 00000080 00005009
action=/etc/acpi/actions/x60t-swivel-down
x60t-swivel-up should contain:
# called when tablet screen swivels up (into laptop mode)
event=ibm/hotkey HKEY 00000080 0000500a
action=/etc/acpi/actions/x60t-swivel-up
As you can see in both files, I took the received events and and assigned some actions for them.
Make the action scripts, these are placed in /etc/acpi/actions:
x60t-swivel-up:
#!/bin/bash
/usr/bin/xrandr -o normal
xsetwacom set "Stylus" Rotate none
xsetwacom set "Cursor" Rotate none
xsetwacom set "Eraser" Rotate none
x60t-swivel-down:
#!/bin/bash
/usr/bin/xrandr -o inverted
xsetwacom set "Stylus" Rotate half
xsetwacom set "Cursor" Rotate half
xsetwacom set "Eraser" Rotate half
The -o option for xrandr indicates the rotation of the screen. You can use normal, left, right and inverted here.
You have to tell Xorg, which orientation the Stylus, Cursor and Eraser have when rotating.
Save the scripts. Restart acpid and test it:
/etc/init.d/acpid restart
Now try swivel the screen down, you should se the screen rotate. Swivel it up and it returns to normal.
You might also want to use the rotate button – this button does not generate acpi events, though it generates
X events, that you can grab with xev:
emerge xev
Now fire up xev and push the button, the output looks like this (your output might look different):
KeyRelease event, serial 30, synthetic NO, window 0x3a00001,
root 0x59, subw 0x0, time 719677542, (609,349), root:(613,403),
state 0x0, keycode 203, same_screen YES,
What we need is the keycode, which in this case is 203. If it does not appear, you might need to run:
setkeycodes 6c 153
That has to be done upon every boot. Add it to your /etc/conf.d/local.start, and try run the xev app again and see if
you can grab the event now.
Now make a file called .Xmodmap in your home directory containing:
keycode 203 = F13
And make a file called .xbindkeysrc containing the following:
"/home/username/bin/rotate"
F13
As you can see the file points to /home/username/bin/rotate we have to make that file, and this one contains:
#!/usr/bin/env bash
# This is a script that toggles rotation of the screen through xrandr,
# and also toggles rotation of the stylus, eraser and cursor through xsetwacom
# Check orientation
orientation=`xrandr --verbose -q | grep LVDS | awk '{print $5}'`
# Rotate the screen and stylus, eraser and cursor, according to your preferences.
if [ "$orientation" = "normal" ]; then
/usr/bin/xrandr -o right
xsetwacom set "Stylus" Rotate cw
xsetwacom set "Cursor" Rotate cw
xsetwacom set "Eraser" Rotate cw
elif [ "$orientation" = "inverted" ]; then
/usr/bin/xrandr -o left
xsetwacom set "Stylus" Rotate ccw
xsetwacom set "Cursor" Rotate ccw
xsetwacom set "Eraser" Rotate ccw
elif [ "$orientation" = "right" ]; then
/usr/bin/xrandr -o inverted
xsetwacom set "Stylus" Rotate half
xsetwacom set "Cursor" Rotate half
xsetwacom set "Eraser" Rotate half
elif [ "$orientation" = "left" ]; then
/usr/bin/xrandr -o normal
xsetwacom set "Stylus" Rotate none
xsetwacom set "Cursor" Rotate none
xsetwacom set "Eraser" Rotate none
fi
Remember to make it executable!
We are almost done. Make your window manager run xmodmap ~/.Xmodmap and xbindkeysrc upon start. I use gnome and made
a little script containing the two commands and configured the gnome session to run the scrip when starting.
Run the following commands and test the button:
xmodmap ~/.Xmodmap
xbindkeys
We are now done!