Round 2: Ubuntu

These are my notes on getting Debian running on the IBM x40, but in the end I took the easy solution: I installed Ubuntu.

I got most of the the features of my laptop to work with Debian, sortof - it was never as polished as I would wan't it and every now and then something would break. Debian is great and flexible but it has a low point of entry when it comes to Laptop features.

To be specific, my biggest annoyance was software suspend - I never got this to work quite as well as I would like to, which in turn gave me all sorts fun with kernel versions.

No suspend w. Debian kernels

I was unable to get suspend/resume to work with the stock Debian kernels. The features included in the kernel simply didn't do anything, and the software suspend 2 patch blew up on my laptop as well. Without a patched, polished kernel from Debian I went with the vanilla kernels which is troublesome to say the least - bearing in mind that not a lot of time goes into making the 2.6 series stable.

I was lucky to get 2.6.11.4 flying for some time, but not perfectly:

Installing Debian Linux on IBM x40, kerel 2.6.11.4

In the following are my notes on installing a Debian Linux on an IBM x40, for the most part it is distribution independent. I used the new Debian Sarge installer (RC2) which takes care of resizing the NTFS Windows partition.

What I tried: Buttons, Bluetooth, Wireless LAN, Ethernet, Audio, X11, Audio What I din't try: IrDa, Modem, SD card reader, FireWire, Framebuffer

I would like to write that installing Debian on the X40 was a breeze and that everyting is working just dandy. Unfortunately I can't. It has taken me some headakes and I'm still not sattisfied.

Ranting about the X40

While this is not suppose to be a review, I'm going to use the chance to say a few words about what I think about the X40. I'll start with what I like about the X40. I got three batteries the small built-in, the big built-in and the external life extenender. With these three I get extremely good lifetime. The screen is very clear and the formfactor/weight is very good.

Now for the bad.

I believe that for most laptops today relying ACPI for suspend/sleep the problems are more or less the same. What I din't expect was the how annoying the keyboard and the noise of the laptop really is.

Installing drivers

I want'ed suspend to disk to work propperly, which was caused the most headakes. Furthermore getting the extra IBM-features to work was troublesome.

Kernel

At the time of writing the newest Debian kernel is 2.6.10, which locked up when suspending in mysterious ways for me. I installed the latest available kernel from kernel org at the time of writing 2.6.11.4 which seems to work nicely. My config can be found here. I've left out most of the unnecessary drivers, but probably not all. Getting suspend to disk requires either that the compile parameter CONFIG_PM_STD_PARTITION is set to a swap formatted partition. Alternatively the swap partition can be given as a boot-parameter:
resume=/dev/xxx
Furthermore the screen is messed up unless the following boot parameter is passed to the kernel,
 acpi_sleep=s3_bios

IBM ACPI extras

The 2.6.11.4 kernel contains version 0.8 of the ibm_acpi module for controlling all the IBM extra features, however 0.8 lacks support for thermal sensors, fan control and more, so I got the latest one from the main site. Furthermore the ibm-acpi package contains a set of example configuration files for acpid that makes the IBM-buttons work the way you expect.
tar zxfv ibm-acpi-0.11.tar.gz
cd ibm-acpi-0.11
make
su
make install
echo "ibm_acpi experimental=1" >> /etc/modules
cp -R config/etc/acpi/* /etc/acpi/
rm /etc/acpi/events/ac # laptop-mode has a better one
The "/etc/acpi/action/radio" is setup for the ipw2100 driver, open the file and change it to ipw2200. Ret laptop-mode, fjern den event og brug debian laptop-mode battery.sh

CPU freq scaling g1overner

/etc/init.d/ibm-hotkey-enable

Volume and Brightnesscontroll

The ibm_acpi has very limited (and experimental) support for volume, brightnes and the Access IBM butten. This is handled elegantly by the tpb package.
apt-get install tpb

Wireless Drivers

At the time of writing the ipw2200 is not part of the Linux kernel, so you need to get the driver and firmware package from the main site. Allso you need to install the hotplug package
apt-get install hotplug
tar zxfv ipw2200-1.0.1.tgz
cd ipw2200-1.0.1
make
make install
cd 

XFree86

I install the Debian packages and everything worked out of the box. I din't set any sync frequency for the screen and I entered the following display section:
        SubSection "Display"
                Depth           24
                Modes           "Native panel mode"
        EndSubSection

Display shifts after susped

For some reasons the display is messed up if the status of the screen is changed. Remember to pass the acpi_sleep=s3_bios parameter to the kernel at boot time otherwise the screen will be in even worse state after suspend. For the lid I used the following trick - change to text mode and back by inserting the following in /etc/actions/lm_lid.sh:
chvt 1; chvt 7

External VGA output

For the external VGA plug that not enough - I used i855crt which seems to do the trick. For example the external screen is turned on and back off with the following commands:
./i855crt on 1024x768@85
./i855crt off

Configure ACPI

Most of the IBM extra features are controlled by ACPI which makes them quite easy to control. Some scripts come with the laptopmode and ibm_acpi packages, but most of them don't do what I don't exactly what I want. In the following are my modifications and additions to these examples.

ibm_acpi comes with the following examples: battery.sh, blank.sh, dock.sh, eject.sh, radio.sh, rescan.sh, undock.sh, video.sh

laptop-mode-tools comes with: lm_ac_adapter.sh, lm_battery.sh, lm_lid.sh

Battery

The battery seems to generate a few events while discharging. If you look at the battery info file /proc/acpi/battery/BAT0/info there are a few limits set up. For me they are 3086 mWh and 619 mWh.

In any case, what I wan't is for the laptop to enter hibernation rather than die when close to the limit. The script that comes with the laptop mode package doesn't do that - it simply disables laptop mode when close to the limit which makes a little, but not at lot of sense.

IBM function keys

The X40 has a number of keys that are controlled by ACPI, while some are controlled by the TPB demon. The ACPI controlled by supported by the ibm_acpi module are:
Key Supposed action
Blank key (Fn-F3) Blank the screen
Sleep key (Fn-F4)
Radio key (Fn-F5)
External-video key (Fn-F7)
Dock key (Fn-F9)
Hibernate key (Fn-F12)

Suspend to mem on lid-close

I find resonable to suspend to memory when the lid is closed.

ACPI event codes

For refference here are the codes that I've deduced:
Action Event
Blank key (Fn-F3)ibm/hotkey HKEY 00000080 00001003
Sleep key (Fn-F4)ibm/hotkey HKEY 00000080 00001004
Radio key (Fn-F5)ibm/hotkey HKEY 00000080 00001005
External-video key (Fn-F7)ibm/hotkey HKEY 00000080 00001007
Dock key (Fn-F9)ibm/hotkey HKEY 00000080 00001008
Hibernate key (Fn-F12)ibm/hotkey HKEY 00000080 0000100c
Action Event
Resume from suspend to disk
Lid open/closeThe x40 seems to generate an event for open/close and one that counts the numver of open or close operations!?
ibm/hotkey HKEY 00000080 00005001
button/lid LID 00000080 00000006
Lid open ibm/hotkey HKEY 00000080 00005002
button/lid LID 00000080 00000007
AC adaptor removedac_adapter AC 00000080 00000000
battery BAT0 00000080 00000001
AC adaptor attachedac_adapter AC 00000080 00000001
battery BAT0 00000080 00000001