Package: longrun
Version: 0.9-19
Severity: wishlist

It would be really nice/useful if you could provide ACPI integration in
the same manner that APM is currently integrated with longrun.  The
attached files provide just this sort of integration.  Just put the
longrun.event file into /etc/acpi/events (possibly renaming it to just
longrun for consistency) and the longrun.sh file into /etc/acpi/actions
(also renamed to longrun).

The longrun.sh script is based off of the currently provided
/etc/apm/events.d/longrun script, with the change that the ACPI version
gets its information from /proc/acpi/battery/* instead of /proc/apm.
The events file provided will run the script in response to any
ac_adapter or battery ACPI event, which should be generated whenever the
power source changes or the battery changes its power state.  The ACPI
script takes the same actions as the original APM script.

With ACPI it would also be possible for the battery information to allow
users to select preferences based on the amount of time remaining (with
a simple calculation in the script) or on the current state of the
battery ('ok','warning','low').  However, these are left unimplemented
for the moment because they seemed rather redundant.  If you think they
would be worthwhile, they should not be hard to work out...

The only problem with the ACPI integration is that there is no guarantee
that an ACPI event will be generated when the battery enters the
'warning' or 'low' state.  It seems to be implementation-dependent for
whether or not state-change causes an event (correct me if I am wrong
about this point).  Even if an event is generated it does not appear to
be configurable at what level a battery enters either state.  This makes
the settings based on battery power level somewhat less useful for ACPI.
Unfortunately, I could not figure out a way around this problem without
involving some sort of polling mechanism, which seems rather excessive.

Hope you find it useful,
Kevin

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

Versions of packages longrun depends on:
ii  libc6                         2.3.5-13   GNU C Library: Shared libraries an

longrun recommends no packages.

-- no debconf information
# /etc/acpi/events/longrun
# ACPI event configuration file for longrun

# Whenever the power conditions of the computer change
# (either battery or ac_adapter changes) we call the
# longrun actions script to change the longrun settings
# appropriately based on the configuration in
# /etc/default/longrun

event=(ac_adapter|battery)
action=/etc/acpi/actions/longrun %e

Attachment: longrun.sh
Description: Bourne shell script

Reply via email to