Installing Ubuntu 6.10 on a ThinkPad X41 Tablet

From ThinkWiki
Revision as of 12:49, 4 September 2008 by DanFuhry (Talk | contribs) (ACPI Swivel Events: Corrected bad use of cat in swivel event files (sudo cat > foo should be cat | sudo tee foo))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This document describes the process of (installing and?) configuring Ubuntu Edgy Eft (final release expected October 2006) on a Lenovo ThinkPad X41 Tablet. With whatever relevance it may have, the particular model number used in testing was an 1869CSU. Keep in mind that at this document's inception 6.10 is a development version of the Ubuntu Linux OS.

Success Chart

Item Working
Installation Network Installation Yes
USB Installation Yes (CD)
Display Laptop Screen Yes
CRT / Projector Unknown
Screen Rotation Yes
Stylus Yes
Power Management Software Suspend (hibernate) Unknown
Suspend to Memory (ACPI sleep) Yes
Audio Yes
Wireless 802.11b/g Yes
Bluetooth Unknown
Extra Buttons Keyboard Section Unknown
Tablet buttons Unknown
Fingerprint Scanner Unknown
Harddisk Active Protection Yes

Pre-Installation Notes

Tablet Screen Rotation (updated i810 drivers)

This edition of Ubuntu (Edgy) has XRandR enabled i810 drivers, which allow you to rotate your screen orientation on the fly. The command xrandr -o [orientation] will rotate your screen to your liking. For more information about the xrandr command, refer to the man file (man xrandr).

Wireless Support

Wireless seems to be supported flawlessly in terms of drivers, though I'm not sure how well the built-in Network Manager works. I use the iwconfig command to manage my wireless, as I have a need to create pseudo-"profiles", and in this document I will describe this alternative process.

Fingerprint Reader Support

Honestly, I care very little about the fingerprint functionality. Its only real use seems to be for gksu-type logins while the tablet is swiveled down, which doesn't occur often in my setup. If someone wants to explore/expound, please do, but I won't include any details about the fingerprint reader in this document.

(There are extensive notes on the software used in some of the other notes in the X41 category.)

Terminology Used

For those of you new to Linux, I'll try to detail a few terms I use with little explanation:

  • Xorg configuration -- the display configuration file, residing in /etc/X11/xorg.conf
  • Execute a command -- press Alt-F2, then type gnome-terminal into the prompt and press enter -- this is a terminal into which you input said commands

Installation Notes

Booting With NetBOOT

To boot over NetBOOT I fisrt went into the BIOS and change the boot settings so that PXE was first on the list. Then I set my desktop to be a DHCP server (dhcp3-server) and configured it using this site Ubuntu_PXE_Install and installed tftpd-hpa

Then I downloaded the Dapper netboot archive (I tried the testing edgy but it would not run on my X41 as of 9/9/06)

Then I assigned my desktop a static IP in the range I set my DHCP server up for and plugged my laptop into it with a cross over cable and rebooted.

The X41 received an IP and then connected to lftp and the same screen as the Ubuntu netboot CD has came up and I followed the instructions.

Once it was intstalled and up-to-date I ran (leave in all quotes, they are important)

sudo aptitiude update && sudo aptitude upgrade gksudo "update-manager -c -d"

To upgrade to edgy eft

Post-Installation Notes

Configuring Xorg

TrackPoint

Like in all ThinkPad Xorg configurations, add the following under the "Configured Mouse" device to enable TrackPoint scrolling:

Option          "EmulateWheel"          "true"
Option          "EmulateWheelButton"    "2"

Wacom Stylus

First install the wacom drivers with the following command:

sudo apt-get install wacom-kernel-source xserver-xorg-input-wacom wacom-tools

After doing this, I strongly suggest that you reboot your computer; however, if you're one of those people whose uptime is on the order of four years, I'm sure you'll figure out an alternative that I won't be describing here.

Next step is to check to see if /dev/wacom exists. A 'ls -al /dev | grep wacom' should do the trick quite nicely. If it does exist, add the following to your Xorg configuration.

Section "InputDevice"
  Driver        "wacom"
  Identifier    "stylus"
  Option        "Device"        "/dev/wacom"
  Option        "Type"          "stylus"
  Option        "ForceDevice"   "ISDV4"
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "eraser"
  Option        "Device"        "/dev/wacom"
  Option        "Type"          "eraser"
  Option        "ForceDevice"   "ISDV4"
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "cursor"
  Option        "Device"        "/dev/wacom"
  Option        "Type"          "cursor"
  Option        "ForceDevice"   "ISDV4"
EndSection

And under the ServerLayout section add:

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

Some people seem to have slightly different configurations (potentially due to model differences). At any rate, if you're looking to find what serial device your stylus is, a simple 'dmesg | grep ttyS' should do the trick. Be sure to append to this article if the procedure varies from model to model.

If the stylus still does not work after suspending (even after applying the fix below) try replacing all the "/dev/wacom"'s in your xorg to "/dev/ttyS0".

Suspend Fix

Every suspend/resume cycle drops the wacom, so create the file /etc/acpi/resume.d/20-setserial.sh and add the following (modify settings for your device if necessary):

 #!/bin/bash
 /bin/setserial /dev/ttyS0 port 0x0200 irq 5 autoconfig

Then, go ahead and run a:

sudo chmod +x /etc/acpi/resume.d/20-setserial.sh

You should be all set to resume with stylus support.

ACPI Swivel Events

When you swivel your tablet's LCD down or up your computer triggers what's called an ACPI event. This is an event similar to pushing the power or sleep buttons -- it's telling the OS about something that's going on with the hardware.

In Linux, ACPI event handling is bundled into a nice neat little package. First, to make sure you can hear the ACPI event when it happens, run the command 'acpi_listen'. The command line will hang there until it picks up on an ACPI event that's occuring, and then it will dump it to the screen. After running acpi_listen, while it's hanging there, swivel your screen down, and then back up. You should get a result similar to this:

$ acpi_listen
ibm/hotkey HKEY 00000080 00005009
ibm/hotkey HKEY 00000080 0000500a

The first HKEY entry is your swivel-down-event identifier and the second is your swivel up. If your values differ from those displayed here, be sure to use your values instead.

Next, what we do is create new ACPI handler entries for the specified events, which we operate on in /etc/acpi/.

The /etc/acpi/ folder generally contains shell files to be executed when events occur. Since there's no shell files to handle swivel events yet, we're gonna go ahead and create some. Yeah, that'd be great.

Use your favorite text editor to modify the following files (the file names are the second line with the # symbol).

#!/bin/sh
#/etc/acpi/x41tsdown.sh
echo 'Rotating screen...'
if [ "`/usr/bin/xrandr -o right -v | grep -i 'randr' | wc -l`" -ne "1" ]
then
    echo '!! Something went wrong...'
    export DISPLAY=":0.0"
    export XAUTHORITY=/var/lib/gdm/\:0.Xauth
    /bin/xset -display $DISPLAY dpms
    echo 'Trying to rotate again...'
    /usr/bin/xrandr -o right
fi
echo 'Rotating stylus...'
/usr/bin/xsetwacom set stylus rotate 1
echo 'Starting keyboard...'
/usr/bin/xvkbd&
#!/bin/sh
#/etc/acpi/x41tsup.sh
echo 'Unrotating screen...'
if [ "`/usr/bin/xrandr -o normal -v | grep -i 'randr' | wc -l`" -ne "1" ]
then
    echo '!! Something went wrong...'
    export DISPLAY=":0.0"
    export XAUTHORITY=/var/lib/gdm/\:0.Xauth
    /bin/xset -display $DISPLAY dpms
    echo 'Trying to unrotate again...'
    /usr/bin/xrandr -o normal
fi
echo 'Rotating stylus...'
/usr/bin/xsetwacom set stylus rotate 0
echo 'Killing keyboard...'
killall xvkbd

Then run:

sudo chown root.root /etc/acpi/x41tsdown.sh
sudo chmod 755 /etc/acpi/x41tsdown.sh
sudo chown root.root /etc/acpi/x41tsup.sh
sudo chmod 755 /etc/acpi/x41tsup.sh

If you'd like to edit these scripts with your favorite text editor (which, I realize, is most likely ed), it's fairly obvious that they're located in /etc/acpi/ as x41tsdown.sh and x41tsup.sh. These commands make the shell scripts that handle the events... once we register the events. Let's do that now.

cat <<EOF | sudo tee /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
EOF
cat <<EOF | sudo tee /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
EOF

Now, awaken your inner ACPI daemon with the following commands:

sudo /etc/init.d/acpid force-reload 
sudo /etc/init.d/acpid restart

And swivel down your LCD to make sure it works.

CAUTION: Swiveling actions while in one of your tty sessions will kill gdm!!!

To be continued...

External Sources