This document is © by Dominic Finke. Permission is granted to publish, copy, distribute and/or modify this document as long as it remains free and open! Linux is a registered trademark of Linus Torvalds.
Debian GNU/Linux (testing) with ACPI on an Thinkpad X40
Howto written by Dominic Finke (madn3ss [at] realbig [dot] de)
Release for Debian (unstable) [10.09.2006]
Complete rewrite for Debian (testing) [30.09.2007]
Debian-Install
I installed my current Debian (testing) by booting the official XFCE-Debian-4.0-CD1 inserted to my external USB-DVD-Drive (ASUS SDRW-0804P-D) and using the internet mirrors. The CD can be obtained through the common ways (download an iso, buy the CD, get one with a magazine).
OK, lets begin! Check if you're connected to the internet, it will become handy later (but it's no must-be if you got the official Debian-3DVD-Set). After that, plug in the external CD/DVD-Driver, boot the X40 an press F12 (One-Time-Boot-Device-List) about 2 seconds after the IBM Logo appeared. You will then be asked to choose between several possible ways to install Debian on your X40.
All of you who installed a pre 4.0 Debian version won't need any help at all. Feel free to choose between the new graphical installation or the good old text-based version. You won't run into any kind of problems! All of you who have never installed a Debian before, choose the graphical installation. The Debian developers did a great job with this peace of software. It's easy to use and guides you through the hole installation process. Just follow the instructions, read the given help texts carefully... it's soooo easy ;)
After booting in your newly installed Debian (stable) system (with your internet cable still connected) you first need to edit the sources.list file with a text-editor of your choice. I'm using vim, which isn't installed by default (well, a strange version called "vim-tiny" is installed... but this version sucks... it doesn't even support syntax highlighting :/ ). A simple
    [root@x40] apt-get remove --purge vim-tiny
    [root@x40] apt-get install vim
solves this problem :D. After that open the /etc/apt/sources.list file and change all entrys called etch or stable to testing. You may want to add the contrib and non-free repositories and some other, unofficial mirrors. My current sources.list is part of my x40_debian_package besides many other scripts and config files. These scripts and settings are written to fit most of your desires and to get almost all hardware of the X40 to work. If not, feel free to use them as examples for your own scripts and settings (and also feel free to mail them to me ;P). OK, now lets move on with the install. After editing the sources.list, all you need to do is
    [root@x40] apt-get update
    [root@x40] apt-get dist-upgrade
These commands will upgrade your Debian (stable) installation to an up-to-date Debian (testing). When everything is done, reboot your X40, since the upgrade will most likely bring you a new kernel. And that's all there is...

Result: Install Done!
Todo: Nothing!
Kernel
I'm very happy using the linux-image-2.6.xx package shipped with Debian (testing). It works well and fits my primary desire: NOT COMPILING ANYTHING (after using Gentoo for several years I just became sick of compiling :P). As part of the upgrade to Debian (testing), the current pre-compiled kernel is installed besides the pre-compiled kernel used in Debian (stable). Find out which kernel versions are installed by typing
    [root@x40] dpkg -l | grep linux-image
After that remove the OLDER version:
    [root@x40]apt-get remove --purge "insert_full_name_of_the_older_linux-image-version_here"
That's all you have to/should do.
As for those of you who want to use a selfcompiled Kernel, have a look at the kernel section found in my x40 gentoo howto (ATTENTION: the howto is written in german!). You'll also find a section about setting up Suspend to Disk with a self-compiled kernel there. This howto here is based on using the pre-compiled kernel shipped with Debian (testing).

Result: Working Kernel for the X40
Todo: Nothing!
ACPI
The basic steps to get ACPI, Suspend To Ram and Fn+Fxx combinations to work are:
    [root@x40] apt-get install acpi acpid
Again, apt does the rest for you. From now on, typing acpi on a console gives you informations about the battery status. Further detailed information can be received by reading /proc/acpi.

Result: ACPI is running.
Todo: Nothing!
Fn+Fxx Hotkeys and lid action
The Hotkeys Fn + Pos1, Fn + End and Fn + Pic-Up worked out of the box. Lucky for us, Debian loads the ibm_acpi modules automatically. All you need to do is use it the right way. In the past you needed to do two echo commands everytime you boot. This issue seems to be gone or Debian is handling it for you. I don't really know... but after moving my acpi scripts (found in the x40_debian_package) to /etc/acpi and restarting acpi by typing
    [root@x40] /etc/init.d/acpid restart
EVERYTHING worked flawlessly! If you want Fn+F3 to lock your computer, open /etc/acpi/screen.sh and put your every day user where it says YOUR_USER_HERE. After that you need to install xlockmore an restart acpid (a restart needs to be done everytime you change things in /etc/acpi):
    [root@x40] apt-get install xlockmore
    [root@x40] /etc/init.d/acpid restart
That's all! :D

Result:
Fn + F3 => lock screen using xlockmore
Fn + F4 => Suspend To Ram
Fn + F5 => Bluetooth on/off
Fn + F7 => Switch Screens (needs to be pushed twice...sometimes)
Fn + F12 => Suspend To Disk
close lid => turn off screen and lock it using xlockmore
Todo: Fn + F9 (untested) and Fn + Space (no idea what i should do with that :) )
Suspend To Disk
Suspend To Disk works out of the Box. The Hotkey for Fn + F12 is set in my "/etc/acpi/"-files.

Result: Suspend To Disk when hitting Fn + F12
Todo: Getting automatic STD to work again...
Powernowd
Since I'm a bit lazy and don't want to spend to much time configuring every demon, I decided to use powernowd, cause it almost works out of the box. To have your Dothan speed up when needed and down to the minimal MHz after that, you just have to
    [root@x40] apt-get install powernowd
    [root@x40] echo "OPTIONS="-q -m 2" > /etc/default/powernowd
The demon works out of the box with the option set to -q ("quiet mode"), the additional given option -m 2 tells the demon to speed down instantly when no cpu power is requiered.

Result: The Dothan speeds up and down between 600MHz and 1400MHz depending on CPU usage.
Todo: Nothing
Atheros WLAN
I'm calling myself lucky to have an Atheros built in my X40. And suprisingly, since "Idon'tknowwhen", Debian has the madwifi driver source in the official "testing" repositories. Just do an
    [root@x40] apt-get install madwifi-source madwifi-tools wireless-tools linux-headers-2.6-686
    [root@x40] cd /usr/src
    [root@x40] tar xfj madwifi.tar.bz2
    [root@x40] cd madwifi
    [root@x40] make
    [root@x40] make install
The driver module is called ath_pci, so a simple
    [root@x40] modprobe ath_pci
will bring up two new devices ath0 and wifi0 (type iwconfig to see them). This will be done automatically everytime you boot once you installed the module. The atheros chip can do IEEE802.11abg, Monitor-Mode, WEP and WPA. It is also possible to create more than one athx device using the same wifix device (for example to create a WLAN-HotSpot). Read the manual for how this is done...

Result: Working Wireless LAN
Todo: Nothing!
Kismet
How to get this tool cooperate with the Atheros? Just like this:
    [root@x40] apt-get install kismet
Now compare your /etc/kismet.conf with /path/to/unpacked/x40_debian_package/kismet.conf. Do not just copy it, (because my config could be outdated!! Also remember to set the "suiduser" in the config to your normal username. After that do a
    [root@x40] modprobe ath_pci autocreate=monitor [root@x40] kismet
The autocreate=monitor option starts the device in Monitor-Mode. It can also be used to bring the device up in rather Ad-Hoc (autocreate=adhoc) or Managed mode (modprobe ath_pci without the autocreate parameter).

Result: Kismet running over the Atheros with Channel-Hopping
Todo: Nothing!
X.org
With Debian 4.0 "etch", after a long period of time, Debian finally switched from the outdated XFree-Server to the newer X.org-Server. The installation is just as it was with XFree. Because I used the XFCE-Debian-CD, I did not need to install the X.org-Server by hand. If you use any other CD/DVD just type:
    [root@x40] apt-get install x-window-system [root@x40] apt-get install windowmanager_of_your_choice
Now add your wm to your ~/.xinitrc or ~/.Xsession (with for example echo "exec fvwm" >> ~/.xinitrc) and compare your etc/X11/xorg.conf with /path/to/unpacked/x40_debian_package/xorg.conf (again, my xorg.conf could be outdated!!).

Result: Working X.org-Server.
Todo: Nothing
USB
Both USB 2.0 ports (and the special "IBM Powered Port" I guess) are supported by the ehci-hcd kernel module. Those are loaded automatically. Nothing to do here :D

Result: USB 2.0 without problems
Todo: Nothing!
PCMCIA
The PCMCIA-Slot is a Ricoh product, which is suported by the kernel. I guess it works with the pre-compiled kernel, but I don't have a card here to test it. Well, it worked a year ago and the pcmcia-cs and pcmciautils packages are installed... so I think it still works ;)

Result: A working PCMCIA-Slot, waiting for Cards...
Todo: Nothing!
ALSA
ALSA should work too. If there is no sound out of the tiny, itzibitzi speaker, check if all libs and tools are installed by typing:
    [root@x40] apt-get install libasound2 alsa-base alsa-utils alsa-oss
If apt tells you everything is already installed, then type in
    [root@x40] alsaconf
to config alsa (the tool will search for available sound-hardware and let you choose the right one). So in the following dialog, choose intel8x0 as your soundcard and press ok/yes until the tool is done. Now to start alsa during the boot, do:
    [root@x40] update-rc.d alsa-utils defaults
Result: Boombastic sound
Todo: Nothing!
Bluetooth
The Hotkey Fn+F5 works, if you followed my howto, and runs a script, which enables/disables bluetooth. The following packages have to be installed:
    [root@x40] apt-get install libbluetooth1 libbluetooth2 bluez-utils fuse openobex-apps obexftp
And since we want to have some fun with the bluetooth device, further do an
    [root@x40] apt-get install bluez-hcidump
Result: Working bluetooth through the installed device...
Todo: Nothing!
SD-Card Slot
No problem at all. The pre-compiled kernel autoloads the modules needed. All you have to do is insert the card, check if a block deivce mmcblk is found (dmesg shows you all you need to know) and use it like you would use a harddisk or CD.

Result: Working SD-Card slot
Todo: Nothing!
IRDA
There is a module since kernel 2.6.12 for the installed IRDA-Interface called nsc-ircc. This module should be loaded automatically when IRDA is turned on via BIOS and give you a device called irda0. Since I turned IRDA off, I can't tell you, if this is the case.

Result: The device irda0 should be found...
Todo: Someday test it :P
Modem
It's a Winmodem. Some Intel AC'97 Modem crap. In times of DSL, who needs this anyway? :P I heard rumours, this thing works with the linuxant driver... since this cost money... no thanks :)

Result: Not working???
Todo: Again... who needs this thing?