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.
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:
*tc4200*) . /usr/share/hotkey-setup/hp-tablet.hk ;;
This will enable the scroll wheel, but you'll still have to bind it to something.
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.
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.
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):
Light weight. 5# was my upper limit. I wanted something I could take with me on the plane and work on, and still have room for other carry on luggage.
Long battery life. 3 hours, minimum. A cross-US flight is 6 hours, more or less, and I wanted something that I'd get tired of using before it got tired of running.
Something with a touch screen. There are some things which are just better with a pen – touching up digital photos, sketching, etc. I am not impressed by external tablets. However, I also wanted:
Something that I could code on. This ruled out pure slates, as I needed a keyboard.
As much of the hardware supported by Linux as possible. This meant rotation, suspend, sleep, media slots, special buttons – all of the stuff that Linux is traditionally bad at. Linux's ACPI support, in particular, is weak. This isn't a dig at the kernel developers. They're handicapped by a plethora of undocumented, proprietary crap.
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.
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
On the fly, xrandr
Calibration is difficult
Soft scroll, tap-to-mouse, etc.
All four mouse buttons work
Needs a seperate driver, from here.
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
Requires some non-trivial configuration
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.
Emerge linuxwacom and setserial
Play with setserial until you find
the right values to setserial. On my machine, the command is
/dev/ttyS0 port 0x0200 autoconfig
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:
-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
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).
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:
For initng, create a file called
and add it to the boot state. For standard sysinit, add this
/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:
I put this in a file called
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
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
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
stop, but there must be a better use for an extra
Map the power
button to hibernate. Edit
and comment out the case statement – it overrides all of the event
drivers. Then create or edit
to map the power button to hibernate, and create or modify
I got the SD slot working, with help from an
source driver. The package built
without error, and I've added the appropriate modules to my
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.
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:
to have Wine installed
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):
Clear it out, because you're not actually using anything in it.
Make sure Wine is set up to find the floppy device:
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.
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:
Burn the image to a CD:
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.
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.
Got the machine. Whoa. Half the size, less than half the weight of Ender. Going to call it Bean.
Plugged in the trusty HP DVD writer.
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.
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.
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.
Burned a new CD on Ender with the HP, just to be safe.
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.
the drive (wiping out Windows in the process) a few times. Finally
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.
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.
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.
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.
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:
Gentoo doesn't install links with the stage3, and
I'm using the ethernet cable for the TC4200, so I can't look it up on Ender
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.
Make a list of top-priority software:
Xorg 6.8 7.0
Suspend to RAM
Suspend to disk
Bluetooth (needs the optional hardware module)
Palm. Dispense with the fucking worthless kpalm, and use a proper event-driven pilot-xfer.
Special laptop keys
Try gobo again
Gobo was a failure.
According to the live CD instructions, there should be an Install script, which there wasn't.
Tried the InstallStage Full command, which seemed to work, except for wanting to write to a read-only /tmp directory
Mounted /tmp (chroot) via tmpfs. After that, it seemed to go OK.
Altered the fstab
Looked for the promised Options boot file, which didn't exist.
Set up grub; rebooted
Gobo complained about not finding an init script
Wiped Gobo and copied the Gentoo over
Got the kernel, ieee80211, and ipw2200 upgraded, and network came up.
Emerged acpitool and cpufreqtools, and powernowd. Overnight, emerged xorg, kde, ruby and dcron.
Perceptions at this point:
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.
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.
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
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.
The wireless is working beautifully. None of the crashes that I see on Ender.
Reconfigured kernel, enabling the i915 (graphics chip) support. After the compile finishes, a reboot and I'll try to get X running.
Emerged the sources-suspend2 kernel sources and rebuilt.
Got the X config from geekcamp.
Got the wacom tablet stuff running
emerged linuxwacom and setserial
The info on geekcamp didn't work for me
Played with setserial until I discovered that, on my machine, the values for setserial are /dev/ttyS0 port 0x0200 autoconfig
Then wacdump -f c100 /dev/ttyS0 worked
X didn't come up immediately, complaining of not being able to find the synaptics driver.
Installed the (hidden) x11-driver/synaptics
Got X up by using the vesa driver.
The I810 driver doesn't work.
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:
These could probably be tweaked, but they're close enough for now. The pen works.
The scroll zone on the synaptics works.
Hibernate does work! (emerged the hibernate package)
Installed the other I810 module; can't tell if it is better than vesa – direct rendering is still offline.
Discovered that the default screen brightness is less than max. The brightness, while still less than Ender, is much better now.
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.
Copied /home/ser over
Audio works well.
xstroke works well.
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.
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.
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.
The special keys can be enabled by various configuration steps:
In KDE, set the keyboard to an HP Pavilion ZT11xx. This will automagically enable the sound keys – muting and volume control.
laptop boot sequence somewhere, make sure that this gets
194 e006 220 e007 143 e009 178
I do it in a file I called
but then, I use initng. For standard sysinit, you'll need it to go
somewhere; say, create a mapkeys.sh script.
following to a file, and call xmodmap on it:
196 = 0xff52This
will map the scroll wheel to the Up/Down arrow keys.
keycode 227 = 0xff54
I also like
to map CTRL-ALT-DEL (sysreq) to
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.
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.
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.
power button to hibernate. Edit /etc/acpi/default.sh
and comment out the case statement – it overrides all of the event
drivers. Then add /etc/acpi/events/lm_power:
logger "Power button was pressed. Hibernating."
I wish I could get those soft buttons working!!!
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.
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
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).
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).