10.3.09

Debian Lenny: new configuration of WLAN and ACPI

Hello everyone,

recently I have discovered two unpleasant issues:

1) my WLAN radio is always on (even if the interface it not up) - which is
bad for my battery;
2) my laptop started to do "double resume" - when waking up from sleep
mode, it starts very shortly, and then goes to sleep again. So, I have to
press FN+F4 or close and open the lid again in order to wake th laptop up.

So, I decided to resolve those two issues:

(1) WLAN
In order to switch the radio off, one should issue a command

echo 1 > /sys/bus/pci/drivers/ipw2200/*/rf_kill

This command must be issued after the ipw2200 module is loaded. In order to
avoid manual execution everytime I boot my laptop, I decided to create a
kind of "autostart" for this command. Following a hint of good people in
one forum, I did the following:
(1) created in /etc/init.d/ file named myAutostart_AG.sh
(2) put there command
#!/bin/sh

echo 1 > /sys/bus/pci/drivers/ipw2200/0000\:0b\:02.0/rf_kill

Please, notice the PCI address of the WLAN card in the command (instead of
"*" - somehow I couldn't use "*" in a script).
(3) created a link from /etc/init.d/myAutostart_AG.sh into
/etc/rcS.d/99myAutostart_AG.sh
(4) made all scripts executable

That's all. Now this command is executed everytime when my laptop boots.
More details for the procedure can be found in this post:

http://forums.debian.net/viewtopic.php?p=212925#212925

Additionally I created a file called ipw2200_options in the folder
/etc/modprobe.d. This file contains following options of the driver
options ipw2200 hwcrypto=0
options ipw2200 associate=0

hwcrypto helps to avoid problems with encryption of the channel (WPA/WEP)
and associate disables autoconnect to the first available network. When you
are on a battery, it saves you a lot of power.


(2) "Double resume"
The issue is described in this post very well:
http://forum.thinkpads.com/viewtopic.php?f=9&t=64884&start=0&hilit=X21%2C+resume

So, I tried the solution proposed by GomJabbbar. It didn't work - Debian
has no "suspend-s2ram" package. But short analysis of the /etc/acpi/events
folder delivered following results: I have (had) two events - "lid" and
"sleep", - which were processed by one single script sleep.sh AND several
events stating with "lm_" - like "lm_lid", "lm_ac_adapter" and others. Many
of those scripts where calling - via their corresponding event scripts -
the same programm /usr/sbin/laptop-mode with a parameter "auto". I asked
Google about those files. It looks like they were installed by
"laptop-mode" package. The first two events - "lid" and "sleep"- I created
manually in July 2007 (see my posts in this blog from that time). For me
the issue is caused by these custom scripts. I think, the following
happens: when I generate either "sleep" or "lid" event, first "sleep.sh"
event is fired. It puts my laptop to sleep - on old-fashioned manner. When
it wakes up, the event is processed second time by "lm_lid", which brings
the laptop into second sleep state.

The resolution for me is to rename my custom events "sleep" and "lid". In
this way I pass the precssing to the "laptop-mode" utility. I tested the
result briefly - it looks good, the laptop wakes up properly.

Cheers,
Andrey.

No comments: