New (25/08/2003), Kernel :
Since the new kernel (2.4.22), this ACPI patch is by default included in it. New (08/11/2003), suspend / hibernate : I finaly successed to install and configure the suspend mode !
What is ACPI ?
ACPI is a quite old technology but it is pretty badly supported by the officiel Kernel. ACPI is developped by a consortium of few corporation like Intel, compaq, IBM ... The aim of the technology is to provide a remplacement for APM.
It is very usefull on laptops (power management, temperature ...).
Unfortunately, specifications are not very well followed by constructors, so, developments are quite difficult.
How install ACPI ?
First, visit the opensource website (http://acpi.sourceforge.net) and download the appropriate version for your kernel.
For example, I have a 2.4.20 kernel. So, I will download this file : acpi-20021212-2.4.20.diff.gz which provides an update for the official kernel (ACPI in the official kernel used to suck).
I suppose that you have the sources of the kernel in the /usr/src/linux directory.
We have to patch the kernel (don't worry, it is very easy) : # cd /usr/src/linux
# wget http://url/acpi-20021212-2.4.20.diff.gz
# gunzip acpi-20021212-2.4.20.diff.gz
# patch -p1 < acpi-20021212-2.4.20.diff
it will patch the kernel.
A new option in the kernel menu will appear in 'General Setup' :
In the menu, you can add these options :
AC Adapter, Battery, Button, Fan, Processor, Thermal Zone.
But sometime, the BIOS doesn't support these options.
Select what you need (as module or as static), recompile your kernel, install it and reboot.
Now, your kernel supports ACPI, but you need to install a program in order to 'manage' ACPI.
Under Debian, apt-get install acpid should be enought.
You should have some files in the /proc/acpi directory like /proc/acpi/info.
If you don't have the file, there is an error (so, check if you made any mistakes). Otherwise, ACPI should work fine on your computer.
For example, cat /proc/acpi/battery/BAT1/state gives me (when my laptop is plugged) (here, it is BAT1 but sometimes it is BAT0) : present: yes
capacity state: ok
charging state: unknown
present rate: 0 mA
remaining capacity: 4192 mAh
present voltage: 16736 mV
It is also possible to get more informations like in /proc/acpi/battery/BAT1/info :
design capacity: 4400 mAh
last full capacity: 4192 mAh
battery technology: rechargeable
design voltage: 14800 mV
design capacity warning: 300 mAh
design capacity low: 200 mAh
capacity granularity 1: 32 mAh
capacity granularity 2: 32 mAh
model number: 00 00 00 00
serial number: 30 00 00 00 00 00 00 00 00
battery type: 00 00 00 00
OEM info: 00 00 00 00
If you want a more friendly user interface than cat or less, you can install acpi (apt-get install acpi) which is a client.
For example, at the moment, on my laptop, acpi provides theses informations :
[11:39:58][sly@reloaded] /proc/acpi$ acpi -V
Battery 1: discharging, 82%, 01:56:53 remaining
Thermal 1: ok, 43.0 degrees C
AC Adapter 1: off-line
It exists a gkrellm plugin called gkacpi. It is quite bugged because of the lack of standardisation with ACPI but the source code (C) is quite easy to understand.
Suspend / Hibernate mode :
Thanks to Jan's Linux Log, I just successed to enable the suspend computer mode !! This means that I can press the power button to stop the computer and press again to restore my session and everything !! Great stuff !!
In order to get that stuff :
You have to patch your kernel with swsup (Software Suspend For Linux) :
patch -p1 < ../swsusp-2.0-rc2-whole
Unselect the SMP option (in Processor type and features), select Software Suspend and Relaxed /proc/swsusp permissions (in General Setup), select Enhanced Real Time Clock Support (in Character devices). Recompile your kernel and install it.
You have to specify also in your Linux Loader (lilo or grub) the name of the swap partition where will be stored the image :
for example, with lilo, it will be :
(change 7 for your configuration).
Download the suspend.sh script on the same website as the patch (This script is called suspend-script) and install it (./suspend.sh --install as root). This script will add some stuff regarding to your linux distribution (it manages at least Suse, Mandrake, Debian, Redhat, Gentoo and Slackware).
Edit the /etc/suspend.conf file and change SWSUSP_FORCE_SUSPEND_MODE="0" to SWSUSP_FORCE_SUSPEND_MODE="acpi"
If you successed to install everything, you should have your laptop suspended by executing /usr/local/sbin/hibernate.
You can make your own "shortcut" : if you press the power button, it will hibernate your computer. Edit the /etc/acpi/events/power file and add in it :