Package: laptop-mode-tools
Version: 1.23-1
Severity: normal
Tags: patch

Hello,

The new "deactivate data-loss-sensitive features when battery is low"
feature always deactivates data-loss-sensitive features when the
present rate of battery drain is available from /proc/acpi, because
ENOUGH_CHARGE is set to 0 rather than 1 when there is enough battery
power.  The following patch fixes this problem.  It also removes some
spurious output from invoking grep.

Thanks,
        Ken

--- /usr/sbin/laptop_mode.orig  2006-02-04 15:23:41.000000000 -0500
+++ /usr/sbin/laptop_mode       2006-02-15 12:17:02.000000000 -0500
@@ -593,16 +593,16 @@
                        fi
                        IN_MAH=0
                        IN_MWH=0
-                       if ( cat $BATT_INFO | grep mWh ) ; then
+                       if ( cat $BATT_INFO | grep mWh >/dev/null ) ; then
                                IN_MWH=1
-                       elif ( cat $BATT_INFO | grep mAh ) ; then
+                       elif ( cat $BATT_INFO | grep mAh >/dev/null ) ; then
                                IN_MAH=1
                        fi
                        if [ "$ACTION" == "discharging" ] ; then
                                PRESENT_RATE=`cat $BATT_INFO | grep "present 
rate:" | sed  "s/.* \([0-9][0-9]* \).*/\1/" `
                                if [[ $PRESENT_RATE -ne 0 ]] ; then
                                        if (($REMAINING * 60 / $PRESENT_RATE >= 
$MINIMUM_BATTERY_MINUTES)) ; then
-                                               ENOUGH_CHARGE=0
+                                               ENOUGH_CHARGE=1
                                        fi
                                        if (($REMAINING * 60 / $PRESENT_RATE >= 
$AUTO_HIBERNATION_BATTERY_MINUTES)) ; then
                                                
ENOUGH_CHARGE_TO_PREVENT_HIBERNATION=1

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15
Locale: LANG=zh_TW.UTF-8, LC_CTYPE=zh_TW.UTF-8 (charmap=UTF-8)

laptop-mode-tools depends on no packages.

Versions of packages laptop-mode-tools recommends:
ii  acpid                         1.0.4-5    Utilities for using ACPI power man
ii  apmd                          3.2.2-5    Utilities for Advanced Power Manag
ii  hdparm                        6.3-3      tune hard disk parameters for high
ii  sdparm                        0.96-1     Output and modify SCSI device para

-- no debconf information

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
If I had a nickel for every time I've written "for (i = 0; i < N; i++)"
in C I'd be a millionaire.

Attachment: signature.asc
Description: Digital signature

Reply via email to