Comment 0 for bug 74394

Roy Badami (roy-gnomon) wrote :

Binary package hint: acpi-support

In 6.06.1 LTS, /usr/acpi/power.sh explicitly calls

    laptop_mode start

and

    laptop_mode stop

This means that the preferences specified in /etc/laptop-mode/laptop-mode.conf are not honoured.

Instead, power.sh should simply call

    laptop_mode auto

in both cases. That way the user's preferences as to when laptop mode will be used will be honoured.

The specific bug that was hitting me was that laptop mode was being disabled when AC power was reconnected, despite having set ENABLE_LAPTOP_MODE_ON_AC to 1 in laptop-mode.conf.

Also, power.sh is explicitly changing the hard drive spindown and power management behaviour by calling hdparm (with fixed, uncofigurable values). It should leave this to laptop_mode, which already has completely configurable functionality to do this.

Patch against 6.06.1 LTS:

--- power.sh.orig 2006-12-04 14:54:44.000000000 +0000
+++ power.sh 2006-12-04 15:33:17.000000000 +0000
@@ -3,36 +3,6 @@
 . /etc/default/acpi-support
 . /usr/share/acpi-support/power-funcs

-function laptop_mode_enable {
- $LAPTOP_MODE start
-
- for x in /sys/bus/ide/devices/*/block; do
- drive=$(basename $(readlink $x));
- $HDPARM -S 12 /dev/$drive 2>/dev/null
- $HDPARM -B 1 /dev/$drive 2>/dev/null
- done
-
- for x in /sys/bus/scsi/devices/*/block; do
- drive=$(basename $(readlink $x));
- $HDPARM -S 12 /dev/$drive 2>/dev/null
- $HDPARM -B 1 /dev/$drive 2>/dev/null
- done
-}
-
-function laptop_mode_disable {
- for x in /sys/bus/ide/devices/*/block; do
- drive=$(basename $(readlink $x));
- $HDPARM -S 0 /dev/$drive 2>/dev/null
- $HDPARM -B 255 /dev/$drive 2>/dev/null
- done
- for x in /sys/bus/scsi/devices/*/block; do
- drive=$(basename $(readlink $x));
- $HDPARM -S 0 /dev/$drive 2>/dev/null
- $HDPARM -B 255 /dev/$drive 2>/dev/null
- done
- $LAPTOP_MODE stop
-}
-
 getState;

 checkStateChanged;
@@ -46,15 +16,12 @@
        for SCRIPT in /etc/acpi/battery.d/*.sh; do
            . $SCRIPT
        done
- if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
- (sleep 5 && laptop_mode_enable)&
- fi
     else
        for SCRIPT in /etc/acpi/ac.d/*.sh; do
            . $SCRIPT
        done
- if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
- (sleep 5 && laptop_mode_disable)&
- fi
     fi
-done
\ No newline at end of file
+ if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
+ (sleep 5 && $LAPTOP_MODE auto)&
+ fi
+done