[ltp] Does APM still work on 2.6?

Christoph Singer linux-thinkpad@linux-thinkpad.org
Sat, 15 May 2004 15:55:07 +0200


On 16.05.2004 04:24, Johannes Rieken wrote:
> Am Fri, 14 May 2004 02:36 schrieb Christoph Singer:
>>APM Suspend to Ram works fine in SuSE 9.1! But only when I disable the
>>powersave deamon (rcpowersaved stop) and manually unload the ndiswrapper
>>module (modprobe -r ndiswrapper).
> 
> 
> Hi Christoph, 
> 
> I have the same problems. I added ndiswrapper 
> to /etc/sysconfig/powersave/common so it is automatically unload before 
> suspend. 
> But if I stop rcpowersaved the cpufreq scaling stops. Do you stop and start it 
> always when you suspend your laptop or disable it at all?
> 
> Cheers, Johannes

powersaved combines the functions of apmd, acpid, cpufreqd and 
laptop_mode. If you disable powersaved you will have to install cpufreqd 
alone (it is still available as a package in YaST).

I have now the following working configuration on my R40 2722 (with SuSE 
9.1 and the latest kernel update):

1. Boot with "acpi=off apm=on"
2. powersaved uninstalled
3. apmd installed and activated (insserv apmd)
4. cpufreqd installed (starts automatically)
5. copied the laptop_mode shellscript from 
/usr/src/linux/Documentation/laptop-mode.txt to /etc/init.d/laptop_mode 
(only available in /usr/src/linux if you installed the "kernel sources" 
package)
6. Then I noticed that "apm --suspend" resp. Alt+F4 worked fine if apmd 
was NOT running (and if I unloaded the ndiswrapper module manually 
before this), but errors occured if apmd was running. I guessed that 
there must be something wrong in SuSE's /usr/sbin/apmd_proxy script. 
That's why I wrote my own minimalistic apmd_proxy script what only does 
exactly what I need (mainly stop network and unload ndiswrapper), and 
with this it works fine now. Here is my working apmd_proxy:

#!/bin/bash
# save this script as /usr/sbin/apmd_proxy

case "$1" in
   "standby")
         ;;
   "suspend")
         rcmysql stop
         rcnetwork stop
         modprobe -r ndiswrapper
         sync
       ;;
   "resume")
         modprobe ndiswrapper
         rcnetwork start
         rcmysql start
         $0 change power
       ;;
   "start")
       $0 change power
       ;;
   "stop")
       ;;
   "change")
       case $2 in
         "power")
                 if [ `/usr/bin/on_ac_power` = "OFFLINE" ] ; then
                   hdparm -B 70 -a 16384 /dev/hda
                   /etc/init.d/laptop_mode start
                 else
                   hdparm -B 254 -a 256 /dev/hda
                   /etc/init.d/laptop_mode stop
                 fi
             ;;
         "battery")
             ;;
         "capability")
             ;;
       esac
       ;;
esac
exit 0


This script works perfectly for me, but you may have to specify other 
modules to unload (e.g., I didn't test any usb modules because I usually 
don't have any USB devices connected to my Thinkpad)
hdparm -B 70 causes my drive (Travelstar IC25N040ATMR04) to spin down 
very few seconds after a disk access (even though no -S value is 
specified.) Lower values cause the drive to spin down immediately after 
a disk access, values higher than 127 make the drive not spin down at 
all unless you specify an -S option.
	
Christoph