Installing Linux, Ubuntu 8.04 Hardy, on a IBM Thinkpad X41 Tablet
UPDATE Aug 08 AUTOMATIC SCREEN ORIENTATION (based on HDAPS Orientation Sensor)
(See Below).
This document describes the process of configuring Linux, Ubuntu 8.04 Hardy (release 2008) on a IBM ThinkPad X41 Tablet, with my scripts and patches to download.
ENABLE STYLUS
/etc/X11/xorg.conf
#Uncomment if you have a wacom tablet InputDevice "stylus" "SendCoreEvents" InputDevice "cursor" "SendCoreEvents" InputDevice "eraser" "SendCoreEvents" #InputDevice "Synaptics Touchpad"
apt-get install wacom-tools
To download xorg.conf, for reference.
FINGERPRINT READER AND HDAPS SENSOR
/etc/modules
Add:
#Required for Fingerprint Reader uinput #Thinkpad access to the embedded controller. Battery tp_smapi #IBM Active Protection System and Orientation Sensor hdaps_ec
For Fingerprint sensor see How_to_enable_the_fingerprint_reader_with_ThinkFinger and my entry.
To try orientation sensor, apt-get install hdapsd hdaps-utils, then use hdaps-gl.
Add this to /etc/modprobe.d/options to correct orientation.
#Hdaps Orientation options hdaps invert=3 options hdaps_ec invert=3
SCRIPT TO ROTATE SCREEN, ACPI SWIVEL EVENTS AND TABLET BUTTONS
I have made this script in /usr/local/bin/rotatetablet (it’s is based on a script by Saikat Guha found here). It rotates screen, rotates stylus, changes tablet page down/up keys, and deactivate compiz if active (Because Compiz freezes with xrand )*. Arguments are [left|right|inverted|normal] or empty for next.
#!/bin/bash #STATUS_FILE=~/.rotate-status STATUS_FILE=/tmp/.rotate-status ################## Compiz Prevention function compiz_on { USER=`ps -ef |grep metacity |grep -v grep|awk -F" " '{print $1}'` #if [ "$(pidof metacity)" ] if [ "$USER" ] then echo 'Activating Compiz...' #DISPLAY=":0.0" sudo -H -u $USER /usr/bin/compiz --replace & #DISPLAY=":0.0" sudo -H -u $USER /usr/bin/emerald --replace & fi } function compiz_off { USER=`ps -ef | grep compiz.real | grep -v grep | awk -F" " '{print $1}'` #if [ "$(pidof compiz.real)" ] if [ "$USER" ] then echo 'Compiz Active. Deactivating...' DISPLAY=":0.0" sudo -H -u $USER /usr/bin/metacity --replace & fi } ################################################## ######################## Keycodes PgUp/PgDown function keymap() { USER=`who |grep tty7 |awk -F" " '{print $1}'` if [ "$USER" ] then case "$1" in 1) echo 'Modifying xmodmap ...' DISPLAY=":0.0" sudo -H -u $USER xmodmap -e 'keycode 105 = Prior' DISPLAY=":0.0" sudo -H -u $USER xmodmap -e 'keycode 99 = Next' ;; *) echo 'xmodmap normal ...' DISPLAY=":0.0" sudo -H -u $USER xmodmap -e 'keycode 105 = Next' DISPLAY=":0.0" sudo -H -u $USER xmodmap -e 'keycode 99 = Prior' ;; esac fi } ############################### function rotate() { case "$1" in 3|right) N=3; T=cw ; compiz_off ; keymap 0 ;; 1|left) N=1; T=ccw ; compiz_off ; keymap 1 ;; 2|inverted) N=2; T=half ; compiz_off; keymap 0 ;; 0|normal) N=0; T=none ; compiz_on ; keymap 0 ;; *) echo -e "Usage:n $(basename $0) [left|right|inverted|normal]"; echo -e "if no option is given, rotates the screen 90 degrees to the right.n"; exit 1 ;; esac #xrandr -o $N & #More secure if [ "`/usr/bin/xrandr -o $N -v | grep -i 'randr' | wc -l`" -ne "1" ] then echo '!! Something went wrong...' export DISPLAY=":0.0" export XAUTHORITY=/var/lib/gdm/:0.Xauth #/usr/bin/xset -display $DISPLAY dpms echo 'Trying to unrotate again...' /usr/bin/xrandr -o $N & fi xsetwacom set stylus Rotate $T & echo $N > $STATUS_FILE } if [ "$#" == "0" ]; then rotate $(((3+0$(cat $STATUS_FILE 2>/dev/null))%4)) else rotate $1 fi
To download rotatetablet script. (Make it executable with chmod +x )
Then create these 4 files to call it in response to acpi events:
/etc/acpi/events/x41t-swivel-down
# /etc/acpi/events/x41t-swivel-down # called when tablet head swivels down event=ibm/hotkey HKEY 00000080 00005009 action=/etc/acpi/x41tsdown.sh
/etc/acpi/events/x41t-swivel-up
# /etc/acpi/events/x41t-swivel-up # called when tablet head swivels up event=ibm/hotkey HKEY 00000080 0000500a action=/etc/acpi/x41tsup.sh
/etc/acpi/x41tsdown.sh (with chmod +x)
#!/bin/sh #/etc/acpi/x41tsdown.sh echo 'Rotating Tablet...' /usr/local/bin/rotatetablet right
/etc/acpi/x41tsup.sh (with chmod +x)
#!/bin/sh #/etc/acpi/x41tsup.sh echo 'Unrotating Tablet...' /usr/local/bin/rotatetablet normal
I use keylaunch (apt-get install keylaunch) to enable tablet buttons. It can be automatically started in Gnome Session programs. First button calls previous rotatetablet script and second one calls cellwriter program for tablets (apt-get install cellwriter) .
In $HOME/.keylaunchrc
key=...XF86RotateWindows:/usr/local/bin/rotatetablet key=...F21:cellwriter
In $HOME/.Xmodmap
! back and forward browser keys keycode 234 = F19 keycode 233 = F20 !Thinkpad Tablet Rotate keycode 203 = XF86RotateWindows !Thinkpad Tablet Menu keycode 193 = F21 !Thinkpad Access IBM keycode 159 = F22 !Thinkpad Tablet Reset keycode 146 = F23
————-
[*] It’s possible to deactivate Compiz windows manager by default, edit /usr/share/gnome/default.session, and replace line:
0,RestartCommand=gnome-wm --sm-client-id default0
by
0,RestartCommand=gnome-wm --default-wm /usr/bin/metacity --sm-client-id default0
—————
BOOT IN CONSOLE MODE, AND WITH COLORS. [OPTIONAL]
For boot in console mode:
/boot/grub/menu.lst
Add to kernel options vga=0×317 and remove splash.
kernel /boot/vmlinuz-2.6.24-19-generic root=... ro quiet vga=0x317 nohz=off
Then grub-install /dev/sda
In /etc/modprobe.d/blacklist-framebuffer, comment #blacklist vesafb to enable vesa framebuffer.
In /etc/initramfs-tools/modules, add
#Framebuffer modules fbcon vesafb
Then update-initramfs.
To activate colors I have done a patch for file /etc/lsb-base-logging.sh.
Localize the first line and comment inside lines. Leave it like this:
if [ "$COL" ] & & [ -x "$TPUT" ]; then #printf "r" #$TPUT hpa $COL #if [ "$1" -eq 0 ]; then # echo "[ OK ]" #else # printf '[' # $TPUT setaf 1 # red # printf fail # $TPUT op # normal # echo ']' #fi #PATCH COLS=`$TPUT cols` if [ -n "$COLS" ]; then COL=`$EXPR $COLS - 7` else COL=73 fi UP=`$TPUT cuu1` END=`$TPUT hpa $COL` START=`$TPUT hpa 0` RED=`$TPUT setaf 1` NORMAL=`$TPUT op` GREEN=`$TPUT setaf 2` if [ $1 -eq 0 ]; then echo "$END[${GREEN} OK ${NORMAL}]" else echo "$END[${RED}fail${NORMAL}]" fi #END PATCH else
To download patched lsb-base-logging.sh
KEYBOARD IN GDM AND SCREEN LOCK
apt-get install cellwriter
GDM
In /etc/gdm/Init/Default, before exit 0, add:
/usr/bin/cellwriter --keyboard-only --read-only --window-y=600 --window-x=200 &
In /etc/gdm/PostLogin/Default, add:
killall -u root cellwriter &
In /etc/gdm/PostSession/Default, before exit 0, add:
sudo killall -u $USER cellwriter
SCREEN LOCK
Edit Gnome Registry with gconf-editor. In apps/gnome-screensaver
embedded_keyboard_command cellwriter --keyboard-only --xid embedded_keyboard_enabled [TRUE]
SCREENSHOT, LINUX ON THINKPAD X41 TABLET
/*
UPDATE Aug 08
*/
AUTOMATIC SCREEN ORIENTATION (based on HDAPS Orientation Sensor)
Scripts (and instructions) by Dave Clawson
apt-get install libproc-process-perl (To install Perl module Proc::ProcessTree)
Download…
orientation tool: orient
orientation daemon: orientd
rotatetablet script: rotatetablet
The instructions to do this are as such:
1. Place the attached scripts (’orient’ and ‘orientd’) in /usr/local/bin and make them executable
2. Substitute /etc/acpi/x41tsup.sh and /etc/acpi/x41sdown.sh with these new versions and make sure that they’re executable.
/etc/acpi/x41tsdown.sh (with chmod +x)
#!/bin/sh #/etc/acpi/x41tsdown.sh #echo 'Rotating Tablet...' #/usr/local/bin/rotatetablet right echo 'Starting orientd...' /usr/local/bin/orientd start
/etc/acpi/x41tsup.sh (with chmod +x)
#!/bin/sh #/etc/acpi/x41tsup.sh echo 'Stopping orientd...' /usr/local/bin/orientd stop echo 'Unrotating Tablet...' /usr/local/bin/rotatetablet normal
3. Put the following line in /etc/rc.local (before the “exit 0” line):
/usr/local/bin/orient reorient
…and that should do it.
NOTE: /usr/local/bin/rotatetablet needs the ‘compiz –replace’ line uncommented if you use compiz.
Thursday, June 19, 2008 - 19:22:40
Does your wacom work after suspend? I’ve tried everything I can think of, but I can’t get it to work.
Friday, June 20, 2008 - 11:24:43
My wacom works after suspend, but frecuently stylus stops working properly. There is a bug: https://bugs.launchpad.net/ubuntu/+source/wacom-tools/+bug/234466
Friday, June 20, 2008 - 21:22:05
I used to have that problem under gutsy, but like I said I had suspend issues when I installed hardy. I just installed the wacom packages from the intrepid repositories (more updated version)
Here they are:
http://packages.ubuntu.com/intrepid/wacom-tools
http://packages.ubuntu.com/intrepid/xserver-xorg-input-wacom
And I have neither the jumpiness problem, nor the suspend/resume problem. I will say that when I had the the jumpiness problem under gutsy, suspending and resuming would fix it every time, so that’s something to try. But try the intrepid packages and see if that doesn’t solve your problem.
Saturday, August 2, 2008 - 22:52:51
Great tutorial. I was able to follow all of your instructions and they all worked except for the darn stylus. I still have no stylus.
When I add the lines to xorg.conf to enable the stylus and reboot I end up having to reconfigure the display adapter and reboot 2x then i am back to the proper screen resolution, but the lines I added to xorg.conf are gone.
Please, if you can, tell me what I am doing wrong.
Sunday, August 3, 2008 - 13:33:01
karb0n, I don’t know, but don’t reconfigure X again, make these changes in the orginal xorg.conf. This is my xorg.conf:
http://liken.otsoa.net/pub/x41t/xorg.conf
Try if it works for you.
Monday, August 4, 2008 - 03:28:25
Thanks so much man! You are awesome! everything works perfectly now.
I just copied your entire xorg.conf over mine and everything came out great.
Friday, August 8, 2008 - 17:02:21
I’m trying to get an x41 off ebay (in decent nick) to use for college with linux. I’m running sabayon on my laptop but seeing how well this seems to have work for you with ubuntu i think i’ll go down the same route.
Many many thanks for putting this up, it is the most complete piece on putting linux on the x41 and getting stuff working that i have seen. Yous saint.
Thursday, August 14, 2008 - 17:14:56
Check out that bug report on the stylus bug. The wacom driver bug report says it’s fixed in the newest version. I compiled and tested it and haven’t seen any issues in three days.
Tuesday, August 26, 2008 - 00:48:36
Was able to get the Tablet and Stylus working thanks to this, I can even use the rotate script to rotate my screen but can’t seem to get the automatic screen orientation working. I believe I am getting hung up on installing the Proc::ProcessTree module, I tried using CPAN to do this but it can’t find the module, any help would be appreciated.
Wednesday, August 27, 2008 - 11:42:53
Really usefull information.
Thanks you very much!
Thursday, August 28, 2008 - 10:25:20
> Frank Marano Says:
> …I believe I am getting hung up on installing the Proc::ProcessTree module, I tried using CPAN to do this but it can’t find the module, any help would be appreciated.
Oops. Well, it looks like Liken updated the doc with instructions on installing an Ubuntu package, but when I’d sent him the orientation stuff, I called the package Proc::ProcessTree in my email. It’s actually Proc::ProcessTable. Give that one a try, if you’re still stuck, please.
I’m not using the Perl module to do anything particularly brilliant. I should have just hand-rolled it to cut down on confusion that might come up for people. Anyway, if you still have trouble, I’ll gladly look into it. The rotating thing is kind of fun.
-dsc
Friday, August 29, 2008 - 22:00:43
Finally I got a problem, Cellwriter boot up at GDM but isn’t at the top. I use a GDM theme (like you certainly do) and it seems to cover the cellwriter window. Do you experience this problem?
I also have problem with the wrong orientation of my stylus when swivelling the screen and with compiz that shut-down well but don’t restart automaticaly but it’s more easy to solve with some reflexion IMO.
Anyway thanks again for your tutorial, it’s the first one that enable the swiveling event to work with Ubutnu and my X41tablet :)
Saturday, January 10, 2009 - 18:06:45
thanks for your work about the warom and I followed every details in your site
But my X41T pen just do not work……
I can see the warom.ko files in the lib drivers and also the xxd dev/ttyS0 give the output when I use the pen
I’m really puzzled by this. Can you help me? thanks for advance
Monday, February 23, 2009 - 04:22:31
thanks alot for your guide, the back and forward buttons didnt work using:
keycode 234 = F19
keycode 233 = F20
but i switched it to:
keycode 234 = XF86Back
keycode 233 = XF86Forward
and they work now
i installed your rotate script and the screen is rotating properlly but the stylus is inverted on all rotations but is still fine in the original mode know anything i couldve done wrong or why that would happen, thanks alot
Saturday, March 28, 2009 - 21:21:29
Great manual! I expected more difficulties with installing Linux to my machine. With this it was really easy.
Only two issues left: Swiveling the panel does not trigger screen rotation (I still have to rotate manually using the special buttons). And I could not yet figure out how to use the stylus for emulating right clicks.
Awesome work anyway. :)
Tuesday, March 31, 2009 - 09:57:20
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language ;)
See you!
Your, Raiul Baztepo
Thursday, June 18, 2009 - 17:51:12
Everything ok apart cellwriter that is not on top in the login screen. Any suggestions about it?
Thursday, November 19, 2009 - 19:32:25
Everything is working great except for compiz coming back online once the screen has rotated. It’s a simple thing to right click on fusion-icon and tell it to reload the window manager, but I thought you should be made aware of it.
Other than that everything on my X41T is working great.
Any chance of doing a write up for getting screen and mouse / stylus rotation going under karmic 9.10?
Sunday, December 13, 2009 - 22:49:23
I found this, which seems to fix the stylus rotation problem on Jaunty and Karmic:
http://www.linux.com/community/blogs/installing-ubuntu-904-on-a-ibm-x41-tablet.html
Best of luck!
-dsc