Installing Linux on the TC4200


This is a how-to essay on installing Gentoo on an HP TC4200 tablet PC, including a diary of my experience.

Note that I don't really go into details about installing Gentoo. That is done better elsewhere. This essay covers only the topics specific to getting various hardware on the laptop working under Linux.

Update 2007-09-10

While there's a config file for HP tablets, the hotkey-setup script that loads it doesn't recognize the TC4200 without some help. To fix this, you can edit the /etc/init.d/hotkey-setup init script and add the following in the Hewlett-Packard section:

  . /usr/share/hotkey-setup/

This will enable the scroll wheel, but you'll still have to bind it to something.

Update 2007-08-10

If you want to save yourself a lot of pain, install Kubuntu instead.

Mind you, Gentoo still holds a special place in my heart, and I'm not yet sure how Kubuntu will hold out in the long run — I haven't worked with a binary-based packaging system that didn't eventually crush itself under the weight of bad dependency handling — however, so far Kubuntu Just Works™.

I never, ever, did get suspend-to-RAM working under Gentoo, and I was always a bit worried that one day the hard drive would crap out and I'd have to re-install it. I religiously backed up /etc for fear of losing all of my careful tweaks to enable various features of the tablet. And then, one day, while installing and playing with a bunch of different, interesting OSes onto an external USB drive (Sabayon, Kubuntu, NixOS, Minix3), I discovered that, under Kubuntu, everything worked. Without tweaking. From the live CD. And, I mean everything. Suspend-to-RAM. Hibernate. The stylus. Rotation¹. The MMC/SD slot. Wireless. Accelerated 3D. Beryl.

Everything worked.

So, I installed Kubuntu on a spare partition I keep around for mucking about, and played with it for a couple of days. I learned the joys of KNetworkManager, and of the Power Manager. I even liked being able to avoid the compile time of installing new apps, although to be honest, it isn't that much better. So, after those couple of days, I wiped Gentoo and installed Kubuntu on the main partition. The bizarre thing is that the laptop, so far, feels more stable, too. ACPI seems to be behaving better.

So, my advice to you is: for this laptop, at least, install Kubuntu and save yourself hours of tweaking and configuration, and maintenance, because everything works out of the box.

¹ The wacom stylus isn't yet rotated when krandrtray is used. Rumor has it that OpenSUSE has patched krandrtray to rotate the wacom device when the screen is rotated, but Ubuntu hasn't merged this patch yet. Which means that the stylus still has to be rotated separately when the screen is rotated. It isn't difficult (there's a link to a script for doing this below), but it would be nice if Ubuntu made the trivial effort of pulling and using the patches from OpenSUSE.

Machine choice

I spent a long time choosing this machine. It is my fifth Linux laptop, and if there's one thing I've learned about Linux on laptops, it is that it is much more difficult to get everything working than it is on a desktop. That is to say, Linux installs and runs fine on every laptop I've had, but most of the time, there is some hardware that isn't supported.

In addition, my previous two laptops have been monsters. The one currently functioning as my desktop is a Sager NP4750 (TuxMobil): 17”, 2.2GHz 64-bit AMD CPU, etc, etc. It weighs 10# and has, if I don't push it, about an hour and a half of battery life. It is portable only in the most liberal sense of the word.

So I was looking for something that I could actually take with me and work on. My priorities were (not in this order):

After much web research (I wasn't in a rush, and spent about four months looking) I settled on the TC4200. It has a 4 hour battery life, weighs about 4#, has a rotating screen (providing both slate mode and regular laptop mode), and other people had good results getting various bits of it working under Linux. Best of all, it has both a nub and a touch pad. I prefer touch pads, but it is nice to have both.

After having had it for six months, I'd recommend it to anyone. I really, really love this machine. In fact, when this one dies, I'm strongly inclined to buy the next model, whatever it is. HP is currently selling the TC4400, which is faster and accepts more memory, but whatever it is, I'm there.

The HowTo

While there is a lot of manual tweaking that needs to be done, none of it is overly oenerous, and most of it deals with the “special” features of a tablet PC. I'm going to break it down into sections.

Here's the compatability matrix:






3D acceleration or rotation, not both

X rotation


On the fly, xrandr



Calibration is difficult





Soft scroll, tap-to-mouse, etc.

Track button


All four mouse buttons work

SD slot


Needs a seperate driver, from here.



Haven't tried.





Hard button auto controls work



Prior to 2.6.16, needs the ipw2200 project drivers. After, the kernel modules work (with the ipw2200 firmware).



Thermal, fans, CPU scaling, battery.


Does not work

Fails to fully resume



Suspend2: Beautifully, repeatedly

Screen brightness buttons


Special buttons

Mostly work

Requires some non-trivial configuration

Soft buttons

Do not work

No events generated


Use the installation instructions for whatever distribution you're using. You'll need an external USB CD/DVD drive, or an install CD burned onto a USB flash card. If you're installing from a CD drive, don't let the drive spin down while waiting for input – I did once, and Gentoo lost contact with the drive (probably because it couldn't spin up fast enough).

The Gentoo LiveCD ipw2200 support leaves a lot to be desired, so if you can connect the machine to the internet with an ethernet cable, do so.

Otherwise, the basic install is straightforward.


Here's my kernel config, in case it helps.


I'm started out using the external IPW2200 code; the recent (2.6.17) in-kernel modules seem to work just fine. You still need the IPW2200 firmware. Install wireless-tools and the 802.11g comes up just fine. I didn't have to configure anything special; just the /etc/init.d/net.eth0 & net.eth1 links to net.lo.


X works out of the box. Here is my xorg config. If you have xorg 7.x or greater, rotation on-the-fly works as well. Here are some generic instructions for Fedora Core 5. and here is a thread specific to the TC4200 if you have any trouble. With 7.x, there shouldn't be any problem.

I have modular Xorg installed, as well as the synaptics driver (for the touch pad).


This is a wacom device, and is supported by the linuxwacom project. It is interesting to note that the values for setserial seem to vary from machine to machine, so getting it may require some experimentation.

  1. Emerge linuxwacom and setserial

  2. Play with setserial until you find the right values to setserial. On my machine, the command is
    setserial /dev/ttyS0 port 0x0200 autoconfig

  3. Test the options with wacdump. If it works, wacdump will respond to the pen and show you the X and Y offsets, which will be big numbers -- these touch screens have a much higher resolution than the LCD, so their magnitude will be 10^4. The command for wacdump (given the serial device from setserial) would be:
    wacdump -f c100 /dev/ttyS0

At this point, you'll want to write down the offsets you get from wacdump, because you'll need them later. Make sure you right down min and max values for both X and Y. This is set up at boot time by setting the correct values in serial.conf.

The rest of the configuration is in xorg.conf.

I've discovered that, during rotation, it is best to rotate only the Cursor and the Eraser, and not the Stylus.


With XOrg 7.x, this works out of the box. You'll need the xrandr and linuxwacom packages. Here is a script I use to rotate the screen and cursors; it isn't strictly necessary, but it is handy. Then I map this to the projection key.

I've also discovered that things work a lot better if you apply this patch to the linux-wacom package before compiling it. Even though the patch says that it is for 0.7.0, it applies cleanly to (at least) 0.7.4-3.


I'm using ALSA and the Intel ICH6 audio controller. It works without special configuration.


Almost everything works. S3 does not work. The laptop suspends, but on resume the power comes back, the fans kick in (full blast), but nothing works. The screen remains blank, but I know it is locked up because key caps and num lock don't toggle the keyboard LEDs, and CTRL-ALT-DEL has no effect. The only way to get out of this is to hard-power down the laptop, and reboot.

The in-kernel suspend-to-disk is worthless, and doesn't work. It has never worked, on any of my laptops. If I may digress for a moment, I'm frankly baffled as to why an obviously broken chunk of code is in the kernel, while a perfectly good, functional piece of code (suspend2) isn't. With all of the talk about how kernel inclusions aren't based on politics, a glaring example such as this seems to prove otherwise. Suspend2 works. Swsusp doesn't. It doesn't get much clearer than that. In any case, emerge the suspend2 kernel, point it at your swap space, and emerge the hibernate tool, and your golden. Here's my /etc/hibernate/ configs, for you to diff against yours.

The fans are visible, and the kernel does seem to be controlling them, but I've not found a way to manually control them. There are occasional problems after a resume; ACPI thinks the fan is on when it isn't. If the temp gets high, the BIOS(?) starts sending panic messages to kacpid, telling it to turn on the fan... kacpid responds with “the fan is already on” (which it isn't), and this causes a busy loop and consumes 99% of the CPU. Eventually, the temperature gets too high and the machine shuts down.

It is easy to tell if this is happening – use acpitool to check the fan status, and if it says the fan is on when it isn't, then this bug is occurring. If caught soon enough, hibernating and resuming again will often fix this. The real problem is remembering to always check the fan status after a resume, and the fact that this is tedious.

This issue was recognized and reported by somebody else, but I don't see that anybody is bothering to fix it.

The ACPI/kacpid thermal issue seems to be fixed by upgrading the BIOS to F.0C. I was running F.08 before, so it is possible that some BIOS upgrade in between fixed the issue.

Upgrading the BIOS was a PITA. I've included instructions before the diary, but after the HOWTO.

Aside from S3 not working and the aforementioned fan issue, ACPI seems pretty well supported, from CPU control, to fans, to thermal zones, to buttons (power and lid).

Special Keys

Some keys just to work, like the wireless button; I imagine things like that bypass the OS entirely. After setting the keyboard in the KDE control panel to “HP Pavilion ZT11xx”, the media keys (volume control, mute) started working automatically too. Other keys have to be mapped to events and handled by something like lineakd.

In your laptop boot sequence somewhere, make sure that this gets run:

/usr/bin/setkeycodes e008 194 e006 220 e007 143 e009 178 e00a 129

For initng, create a file called /etc/initng/system/mapkeys.i and add it to the boot state. For standard sysinit, add this file to /etc/init.d/ and add it to the boot state. That last key, e00a, is FN-F6, which doesn't have a FN marker, but generates a keycode nonetheless.

To map the tablet scroll wheel (a little lever on the side for use in tablet mode) to something usefull, add the following to a file, and call xmodmap on it:

keycode 196 = 0xff52
keycode 227 = 0xff54

I put this in a file called ~/.xmodmap_laptop and then have KDE run xmodmap via AutoStart when I log in. The end result is that the scroll wheel will be mapped to the Up/Down arrow keys.

I also like to map CTRL-ALT-DEL (sysreq) to /usr/sbin/hibernate, rather than reset. This is because the 4200 has a single button that maps to CTRL-ALT-DEL just above the scroll wheel, and it is way too easy to hit on accident. You could also map it to something that locks the screen.

Install lineakd to do further magic key functions. In particular, I've mapped the “projection” button (next to the mute button) to a command that rotates my screen, and the FN-F3 (the moon) to lock my screen. Here are my lineakd.conf and lineakkb.def files (which should go into ~/.lineak). I start lineak with another KDE AutoStart file.

Incidentally, that little USB button on the side next to the power button generates keycode e059, but I haven't thought of a use for it yet. The most logical would be /etc/init.d/usbd stop, but there must be a better use for an extra button.

Map the power button to hibernate. Edit /etc/acpi/ and comment out the case statement – it overrides all of the event drivers. Then create or edit /etc/acpi/events/lm_power to map the power button to hibernate, and create or modify /etc/acpi/actions/

The SD Slot

I got the SD slot working, with help from an open source driver. The package built without error, and I've added the appropriate modules to my /etc/modules.autoload.d/kernel-2.6 file. The SD slot works well now, responding to card insertions and removals, and (thanks to HAL) the cards show up on my KDE desktop.

Upgrading the BIOS

This process is not for the weak of heart. That said, my upgrade went smoothly. I am not responsible if you utterly fry your laptop while doing this. If you still have Windows installed on some partition, do it from there; it will be easier.

First, I didn't try this from a USB key, but I don't see any reason why it wouldn't work. I used an external CD-ROM. If you use an external floppy, it may be easier, but I don't have one. The basic instructions are here, but they don't work with HP's upgrades, because all of HP's BIOS upgrades assume you're running Windows. You'll need:

  1. to have Wine installed

  2. A CD-ROM

Download the BIOS upgrade from HP. They don't make it particularly easy to find; the most current as of this writing is F.0C.

You can either download a bootable floppy image with FreeDOS on it, or make an image yourself. I had an image handy, but you can get one online. Mind you, you could probably 'dd' an empty .img more easily, but in the course of hacking around trying to get an upgrade image, this is the way I got it to work, so I'm not going to deviate from that in the instructions.

Unpack the image, and mount it at /mnt/floppy (as root, of course):

mount -o loop,uid=$USER fdboot.img /mnt/floppy

Clear it out, because you're not actually using anything in it.

rm -rf /mnt/floppy/*

Make sure Wine is set up to find the floppy device:

ln -s /mnt/floppy ~/.wine/dosdevices/a:

The location of your Wine setup may be different. If you're using an old Wine, you may need to manually insert a device entry into a .cfg file. Run Wine on the BIOS upgrade you downloaded, and click through the prompts. At the end, it should have "created" a floppy bood disk.

ls -l /mnt/floppy

I don't know how one would verify the validity of the image, so this is where you should be getting nervous. Do whatever you have to ensure that the CD image is complete. Burn a couple of them -- remember, if the CD is somehow corrupt, you could bork the BIOS upgrade and turn your laptop into a doorstop. Unmount the floppy:

umount /mnt/floppy

Burn the image to a CD:

mkdir -p cdrom/boot
mv fdboot.img cdrom/boot/boot.img
mkisofs -r -b boot/boot.img -c boot/boot.catalog -o bootcd.iso cdrom/
cdrecord -dao -eject -v bootcd.iso dev=0,0,0

The particular arguments -- especially your CD device ID -- may vary. Put your CDROM on an uninterruptable power supply. If the power goes off in the middle of the upgrade, your laptop will stay on, but your CDROM will turn off, and you'll be SOL.

Reboot. If you haven't already, go into the BIOS (F10) and tell it to allow booting from USB devices. If everything goes right, you will be prompted to choose a device to boot from; select the CDROM. It should boot and go immediately into the upgrade app... follow the instructions from here. That's it.

Expect to be REALLY nervous during the actual upgrade, as the upgrade takes a couple tens of seconds, and at any moment, you could get a CD read error, or the power could go off, or... I'm just glad it is over.

The Diary

That's the end of the how-to. What follows is my running diary about configuration changes I make to the laptop. There may or may not be useful information in here. Note that this is chronological, and while I make the attempt to go back and strike-through observations which no longer hold (like the SD slot not working), I may not be thorough. Consequently, some of the early entries may no longer be true.

My goal is to run GoboLinux on this, and see how it goes. If it doesn't work out, I'll install Gentoo over it.

  1. Got the machine. Whoa. Half the size, less than half the weight of Ender. Going to call it Bean.

  1. Plugged in the trusty HP DVD writer.

  2. Tried to boot Gobo live CD. No-go. The Gobo 012 initrd doesn't include the USB modules, so the DVD drive isn't visible upon boot.

  3. New plan: install a basic Gentoo system on one small (3G) partition. This will be an emergency backup system. I'll boot that, and then install Gobo on another, main partition. If Gobo doesn't work out, I'll have the Gentoo partition to work off of, and I'll replace Gobo with it. If it does work out, I'll have a 3G partition that I can play with.

  4. Burned a Gentoo live CD. When the machine booted into Windows, discovered that Ender has a problem writing CDs at 24x. Desclined the Windows NDA. The Windows installer plays music. How embarrassing.

  5. Burned a new CD on Ender with the HP, just to be safe.

  6. Booted the live CD, which also failed to find the CD. This time, it was because I wasn't paying attention and the DVD drive spun down while waiting for my input on a keyboard layout choice; when it came time to mount the root partition, the drive wasn't ready. Rebooted, answered the questions promptly, and this time it booted no problem.

  7. Repartitioned the drive (wiping out Windows in the process) a few times. Finally settled on:
    This is going to be temporary HD, anyway, since it is only 40G. Everything is XFS; normally, I go for ReiserFS, but the mount times bother me.

  8. Got through to compiling the kernel when I discovered that I had allocated 15G for the swap space (2000 blocks, not 2000M). Repartitioned and started over again.

  9. Bean is much slower than Ender, but I was expecting that. Bean is supposed to be light, portable, and have a lot of battery life, so speed has to be sacrificed. Still, this is taking forever. Mistakes are more expensive on Bean.

  10. Discovered that the Gentoo live CD 2005.1 is fucked, with a totally screwed up ipw2200 release. Had to steal an ethernet cable in the hopes that the Gentoo retards didn't also screw up the ethernet code, too.

  11. Ethernet worked. Got the Gobo CD (and the squash image) mounted, but don't know where to go from here -- there's no easily found readme on the Gobo CD. Can't look online, because:

    1. Gentoo doesn't install links with the stage3, and

    2. I'm using the ethernet cable for the TC4200, so I can't look it up on Ender

  12. I'm now upgrading enough of Bean to get the ipw2200 working, so I can reclaim the ethernet cable and continue with the Gobo install.

  13. Make a list of top-priority software:

    1. Gobo

    2. Sound

    3. Speedstep

    4. Xorg 6.8 7.0

      1. rotation

      2. on-the-fly rotation

      3. pen

    5. KDE 3.5

    6. Suspend to RAM

    7. Suspend to disk

    8. Bluetooth (needs the optional hardware module)

    9. Wireless

    10. inkscape

    11. OpenOffice

    12. Bibble

    13. /home

    14. Gimp

    15. Languages

      1. Ruby

      2. Java

      3. Qu

      4. Q

      5. GHC

    16. Subversion

    17. vim

    18. darcs

    19. screen

    20. IR

    21. Palm. Dispense with the fucking worthless kpalm, and use a proper event-driven pilot-xfer.

    22. Special laptop keys

    23. Try gobo again

  14. Gobo was a failure.

    1. According to the live CD instructions, there should be an Install script, which there wasn't.

    2. Tried the InstallStage Full command, which seemed to work, except for wanting to write to a read-only /tmp directory

    3. Mounted /tmp (chroot) via tmpfs. After that, it seemed to go OK.

    4. Altered the fstab

    5. Looked for the promised Options boot file, which didn't exist.

    6. Set up grub; rebooted

    7. Gobo complained about not finding an init script

    8. Wiped Gobo and copied the Gentoo over

  15. Got the kernel, ieee80211, and ipw2200 upgraded, and network came up.

  16. Emerged acpitool and cpufreqtools, and powernowd. Overnight, emerged xorg, kde, ruby and dcron.

  17. Perceptions at this point:

    1. At this point, suspend-to-RAM doesn't work; haven't tried suspend-to disk. acpitool works well; ACPI, in general, is working well. Speedstep works, thermal zones work, fan info is there, CPU info is there. powernowd is controlling the CPU quite well. The machine is quiet -- even on max CPU freq, the fan only comes on occasionally, and this while compiling gcc, glibc, Xorg, and KDE.

    2. Machine isn't as slow as I thought. One major difference is that I usually keep Ender ratcheted down to 800MHz, because anything higher and the fans start blowing like crazy -- at which point, Ender is louder than Haselmaus, which is an old tower with 4 SCSI drives, an old power supply, a 400MHz CPU (with a fan, of course) and an extra PCI fan (for a total of three fans in the machine). Bean has a slower CPU, but I can crank it up to max freq without it sounding like an industrial power plant, so it is compiling at over twice the speed of Ender. All of KDE and Xorg, and Ruby, compiled in about 10 hours; on Ender, it usually takes over 24.

    3. Screen is way less bright than Ender. And, of course, much smaller, but the dimness is really noticable. ALso dimmer than my wife's laptop. I was expecting this from the various things I've read online, but it still surprised me a little. It is usable, and -- again -- I'm willing to take that hit for the 4.5 hr run time

    4. Haven't done any empirical tests, but runtime seems to be pretty much what HP claims -- 4.5. At least, that's what acpitool tells me when I take it on battery and have the frequency down to 800MHz.

    5. The wireless is working beautifully. None of the crashes that I see on Ender.

  18. Reconfigured kernel, enabling the i915 (graphics chip) support. After the compile finishes, a reboot and I'll try to get X running.

  19. Emerged the sources-suspend2 kernel sources and rebuilt.

  20. Got the X config from geekcamp.

  21. Got the wacom tablet stuff running

    1. emerged linuxwacom and setserial

    2. The info on geekcamp didn't work for me

    3. Played with setserial until I discovered that, on my machine, the values for setserial are /dev/ttyS0 port 0x0200 autoconfig

    4. Then wacdump -f c100 /dev/ttyS0 worked

  22. X didn't come up immediately, complaining of not being able to find the synaptics driver.

  23. Installed the (hidden) x11-driver/synaptics

  24. Got X up by using the vesa driver. The I810 driver doesn't work.

  25. After dicking around with the wacom for a while, finally figured out that the BottomX and BottomY values needed to be adjusted to get the pointer to actually follow the mouse. The values I'm using are:

    1. BottomX 24700

    2. BottomY 18500

    3. These could probably be tweaked, but they're close enough for now. The pen works.

  26. The scroll zone on the synaptics works.

  27. Hibernate does work! (emerged the hibernate package)

  28. Installed the other I810 module; can't tell if it is better than vesa – direct rendering is still offline.

  29. Discovered that the default screen brightness is less than max. The brightness, while still less than Ender, is much better now.

  30. On the fly rotation works with Xorg 7.x. Mapped the “presentation key” to rotate. Getting those Top/Bottom X/Y values is a real bitch, and from what I can tell, varies from machine to machine.

  31. Copied /home/ser over

  32. Audio works well.

  33. xstroke works well.

  34. Hibernate is working really well. Hibernated and restored twice while working on this document and installing koffice. Need to try hibernate-ram. Hibernate-ram still does not work.

  35. I got rotation set up. It isn't on-the-fly, but it is pretty decent for basic document reading and such, and web browsing with xstroke for URLs. Getting those Top/BottomX/Y values is a real bitch, and from what I can tell, entirely non-standard.

  36. Got Gobo installed. It has problems with running the fan at 100%. I need to upgrade the kernel. I haven't messed with this any further.

  37. The special keys can be enabled by various configuration steps:

    1. In KDE, set the keyboard to an HP Pavilion ZT11xx. This will automagically enable the sound keys – muting and volume control.

  38. In your laptop boot sequence somewhere, make sure that this gets run:
    /usr/bin/setkeycodes e008 194 e006 220 e007 143 e009 178
    I do it in a file I called
    /etc/initng/system/mapkeys.i, but then, I use initng. For standard sysinit, you'll need it to go in /etc/init.d/ somewhere; say, create a script.

    1. Add the following to a file, and call xmodmap on it:
      keycode 196 = 0xff52
      keycode 227 = 0xff54
      This will map the scroll wheel to the Up/Down arrow keys.

    2. I also like to map CTRL-ALT-DEL (sysreq) to /usr/sbin/hibernate, rather than reset. This is because the 4200 has a single button that maps to CTRL-ALT-DEL just above the scroll wheel, and it is way too easy to hit on accident. You could also map it to something that locks the screen.

    3. I also run lineakd to do further magic key functions. In particular, I've mapped the “projection” button (next to the mute button) to a command that rotates my screen.

    4. Incidentally, that little USB button on the side next to the power button generates keycode e059, but I haven't thought of a use for it yet. The most logical would be /etc/init.d/usbd stop, but there must be a better use for an extra button.

  39. Mapped the power button to hibernate. Edit /etc/acpi/ and comment out the case statement – it overrides all of the event drivers. Then add /etc/acpi/events/lm_power:
    event=button[ /]power.*

    and /etc/acpi/actions/

    logger "Power button was pressed. Hibernating."

  40. I wish I could get those soft buttons working!!!

  41. Setting up ivman to run as myself helped with the Treo connection problems. I made a script that, when called, figures out the device and runs kpilotDaemon, and made ivman run this script when the Palm device is connected. Also made it shut kpilotDaemon down when the device is disconnected. It works well.

  42. I got the SD slot working, with help from an open source driver. The package built without error, and I've added the following to my /etc/modules.autoload.d/kernel-2.6 file:

    tifm_core and tifm_7xx1 are auto-loaded. When that's done, I can insert SD cards and they pop up on the desktop (thanks to HAL).

  43. Updated the BIOS to F.0C, and the kacpid problems went away. Also got control of the fan through the ACPI API (not just read, but full control).