• Bug#266512: laptop-mode-tools: please use on_ac_power to detect power s

    From Chris Hanson@1:229/2 to All on Wed Aug 18 06:30:08 2004
    From: [email protected]

    Package: laptop-mode-tools
    Version: 0.95-1
    Severity: normal

    Please use /usr/bin/on_ac_power (from the powermgmt-base package) to
    do detection of AC/battery power. This script works not only with
    ACPI, but also with APM and PMU.

    The reason this matters is that laptop-mode works on APM systems --
    such as mine -- and the code in the init script doesn't take this into
    account.

    Another good reason is that it simplifies the init script.

    Here is a patch to /etc/init.d/laptop-mode that fixes this. You will
    also have to add a dependency on powermgmt-base.

    --- laptop-mode.dpkg-dist 2004-08-02 17:58:12.000000000 -0400
    +++ laptop-mode 2004-08-18 00:01:55.000000000 -0400
    @@ -14,18 +14,8 @@

    DO_START=0
    if [ $LAPTOP_MODE_ALWAYS_ON -eq 0 ] ; then
    - ON_AC=0
    - ADAPTERS_FOUND=0
    - if [ -d /proc/acpi/ac_adapter ] ; then
    - for ADAPTER in /proc/acpi/ac_adapter/* ; do
    - ADAPTERS_FOUND=1
    - STATUS=`awk '/^state: / { print $2 }' $ADAPTER/state`
    - if [ "$STATUS" = "on-line" ] ; then
    - ON_AC=1
    - fi
    - done
    - fi
    - if [ $ADAPTERS_FOUND -eq 1 -a $ON_AC -eq 0 ] ; then
    + /usr/bin/on_ac_power
    + if [ $? = 255 ]; then
    DO_START=1
    fi
    else


    -- System Information:
    Debian Release: 3.1
    APT prefers unstable
    APT policy: (990, 'unstable')
    Architecture: i386 (i686)
    Kernel: Linux 2.6.8.1
    Locale: LANG=C, LC_CTYPE=C

    -- no debconf information


    --
    To UNSUBSCRIBE, email to [email protected].o
  • From Bart Samwel@1:229/2 to Chris Hanson on Wed Aug 18 07:00:09 2004
    From: [email protected]

    On Wed, 2004-08-18 at 00:02 -0400, Chris Hanson wrote:
    Please use /usr/bin/on_ac_power (from the powermgmt-base package) to
    do detection of AC/battery power. This script works not only with
    ACPI, but also with APM and PMU.

    Sounds like a good idea. I was thinking of merging the ACPI/APM event
    scripts to use this as well. Expect to see this in a future version.
    BTW, this won't work:

    + /usr/bin/on_ac_power
    + if [ $? = 255 ]; then
    DO_START=1

    255 is "unknown state", which is returned when you have neither APM nor
    ACPI. Lack of power mgmt support almost certainly means we're on AC. It
    should therefore be [ $? -eq 1 ].

    --
    Bart Samwel <[email protected]>


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Chris Hanson@1:229/2 to All on Wed Aug 18 16:40:09 2004
    From: [email protected]

    Date: Wed, 18 Aug 2004 06:37:39 +0200
    From: Bart Samwel <[email protected]>

    BTW, this won't work:

    + /usr/bin/on_ac_power
    + if [ $? = 255 ]; then
    DO_START=1

    255 is "unknown state", which is returned when you have neither APM nor
    ACPI. Lack of power mgmt support almost certainly means we're on AC. It
    should therefore be [ $? -eq 1 ].

    Oops. Right you are.


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Bart Samwel@1:229/2 to Chris Hanson on Wed Aug 18 23:30:11 2004
    From: [email protected]

    On Wed, 2004-08-18 at 00:02 -0400, Chris Hanson wrote:
    Please use /usr/bin/on_ac_power (from the powermgmt-base package) to
    do detection of AC/battery power. This script works not only with
    ACPI, but also with APM and PMU.

    This should be fixed in 0.98+ (pending upload). If you want to try it
    now, you can download the package at the laptop-mode-tools page:

    http://www.xs4all.nl/~bsamwel/laptop_mode/tools

    --
    Bart Samwel <[email protected]>


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)