Debian Linux on a Tablet PC Howto

There are by now many guides on setting up your favorite flavor of Linux on just about any kind of machine. I'm adding one more to this body of documentation because Linux is not well established on Tablet PCs and there is a great deal of work yet to be done.

I went through a considerable amount of trouble installing Debian on my Toshiba Portege M200. I wanted to write this guide to document some of the trouble spots. Although lot of the information here can be found elsewhere on the Internet, it contains a lot of my personal efforts in assembling easy to use scripts and just gathering the information. Using this guide will save you weeks of hassle.

Installation over LAN top

My Portege did not happen to come equipped with either a CD-ROM or a floppy drive. It did come with two card readers, useless for installation purposes. Linux LAN installation is relatively painless. You will need either a Windows Server, a Linux Desktop, or another computer capable of providing DHCP services (a router doesn't work). The basic procedure is as follows:

  • Turn off your router if you have one and disable any running DHCP servers. Now, setup a TFTP (Trivial File Transfer Protocol) server on your server machine. Exactly how you do this will depend on what you're running as a server. For a Debian server you simply install the tftpd package.
  • Download to your server the minimal Debian NetInst CD image. Extract this image into your TFTP shared folder.
  • Make sure your tablet is connected to the network and using your server as its DHCP server. Set your tablet BIOS settings to boot from the network. You should now be booting from the network installation image.

To support laptop and tablet hardware it's crucial that you install the latest Linux software. Installing Debian Stable is not going to cut it. Your best bet is to install Testing or Unstable. The downside is that you will often times end up having to downgrade packages because of missing dependencies. Familiarize yourself with running aptitude from a restore (single user) boot.

Kernel options

Likewise you will also need the latest 2.6 kernel. There should be no need to build a kernel from source. Installing the latest kernel package should do the trick. After you have installed the kernel package, you can optionally edit the Grub entry for the kernel (as root, edit /boot/grub/menu.lst) to enable optimal resolution for the text consoles. You need to find the kernel entry and add the vga= flag:

title		Debian GNU/Linux, kernel 2.6.18-4-686
root		(hd0,2)
kernel		/boot/vmlinuz-2.6.18-4-686 root=/dev/sda3 ro vga=0x31A quiet
initrd		/boot/initrd.img-2.6.18-4-686
savedefault

You will need to find the correct VGA code for your desired resolution. Some of the codes for unusual resolutions can be hard to find. For the Portege's 1400×1050 LCD the code is vga=840. You can look up codes for standard resolutions here.

Wireless networking top

The wireless card is an Intel PRO/Wireless BG2200. The driver for the card is ipw2200 and it should come with Debian. Install WPA Supplicant (wpasupplicant package) and the waproamd package to automatically connect to any available access points. Another useful application comes in the gnome-netstatus-applet package and will allow you to easily get network information and change access points. The dhcp-client package will enable DHCP support and allow you to connect without a static IP address.

Debian Etch/Unstable users be wary, the ipw2200 driver loads firmware onto the card at boot time. If your system does not boot with two ethernet interfaces (eth0 and eth1) you may have outdated firmware. The correct firmware files need to be in your /lib/firmware directory and you need to do this manually. Get the latest firmware from the ipw2200 page and extract them in there.

Battery conservation top

Battery conservation on a laptop involves throttling down power to power hungry devices. The foremost among these are the CPU, hard drive, LCD screen, and fans. Fortunately, controlling most of these is done through Laptop Mode Tools. For Debian, the entire thing is contained within the laptop-mode-tools package. Install this and go through the configuration file (/etc/laptop-mode/laptop-mode.conf) carefully.

The CPU speed can also be controlled through Laptop Mode Tools and through the Gnome CPU applet. To enable it however, you will need to enable a few modules on boot. Add the following to your /etc/modules file:

cpufreq_userspace
cpufreq_conservative
cpufreq_ondemand
cpufreq_powersave
# For Centrino processors:
speedstep_centrino
# For Toshiba laptops:
toshiba_acpi

Adjusting the LCD brightness can actually be done automatically through KDE. In the power management settings you can set LCD brightness levels for battery and AC power modes. For Toshiba laptops there is a nice program which enables the use of the Fn keys, install the fnfxd package.

The new Gnome Power Manager project attempts to fill in on many of the functions described here. It may work for your laptop but in my experience the HAL failed to adjust anything other than the CPU governor.

Hibernate and suspend top

Suspend to either disk or ram does not work with the official nVidia drivers as of September 2007. If you're willing to sacrifice 3D acceleration and screen rotation for suspend you can use the nv driver instead which otherwise works perfectly. Install the xserver-xorg-video-nv package. In your xorg.conf, make sure the video card is configured correctly:

Section "Device"
    Identifier     "NVIDIA Corporation ..."
    Driver         "nv"
EndSection

Now to suspend your laptop install the acpitool and uswsusp packages and run the command acpitool -s when you want to suspend to ram and acpitool -S for hibernation. If you don't want to enter your root password every time, run chmod a+s /usr/bin/acpitool to allow regular users to run it.

Wacom tablet top

The latest LinuxWacom driver package in Debian already has support for rotation built in so all you need do is install xserver-xorg-input-wacom. To enable the Wacom device, open /etc/X11/xorg.conf and add the following to the ServerLayout section:

Section "ServerLayout"
    ...
    InputDevice "cursor" "SendCoreEvents"
    InputDevice "stylus" "SendCoreEvents"
    InputDevice "eraser" "SendCoreEvents"
EndSection

For the Portege, the tablet screen is just a regular Wacom tablet connected over through a serial port. We can enable it just like a serial Wacom tablet by adding the following sections:

Section "InputDevice"
    Driver "wacom"
    Identifier "cursor"
    Option "Device" "/dev/ttyS0"
    Option "Type" "cursor"
    Option "ForceDevice" "ISDV4"
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

Test if the driver is working properly by running wacdump -f c100 /dev/ttyS0.

Screen rotation

The following section should be added to the nVidia driver section in /etc/X11/xorg.conf in order to enable screen rotation. If you are using the nv driver, you need to use RandR instead of RandRRotation:

Section "Device"
    Identifier "NVIDIA ..."
    Driver "nvidia"
    Option "RandRRotation" "true"
EndSection

You should now be capable of rotating the screen via the xrandr tool and also of rotating the Wacom tablet coordinates via the xsetwacom tool. The xrandr command will rotate the display via the nVidia driver and xsetwacom will rotate the tablet pointer orientation. Both commands are necessary although apparently only rotating the stylus is sufficient.

I have created a rotate script for each Wacom patch that will do the work for you. To use this script run it with one of the orientation names as an argument (normal, left, right, inverted) like this: ./rotate.sh left. You can create launchers to each of the orientations on your GNOME panel for convenience.

Applications top

Now that your wonderful Tablet PC is running Debian you're probably wondering what Linux has to offer to make full use of your nifty pen:

  • Currently, the only open-source natural handwriting recognition program available for Linux Tablet PCs is my own CellWriter, a grid-entry input panel that learns your handwriting.
  • It takes a bit of getting used to but Dasher is a very novel way of inputting text.
  • Although targeted at mouse gestures and not very user friendly, WayV is another gesture recognition program. From what I could figure out, gestures are configured via text configuration files and can launch applications or scripts.
  • xstroke is (was?) the supposedly most commonly used gesture recognition program for Unix-based systems. There have been no updates to this project for over 3 years. The Debian maintainer has long since abandoned the program and xstroke.org is now defunct. A very detailed description of xstroke and it's 3x3 grid recognizer is here.
  • Chris Debenham's Gournal and the Xournal project aim to replace Windows note taking programs.
  • The GIMP will accept pen pressure data along with providing the perfect solution to all your graphic software needs. The Linux Wacom Guide to Working with the GIMP explains how.

Helpful websites top

Aside from general Linux help websites, here are a few specific to tablet PCs that will help get you up and running:

Linux On Laptops