Package: acpid
Version: 1:2.0.0-1
Severity: normal
Real problem was that my laptop's battery is almost dead, at least for the
acpi subsystem. When AC is switched off, I don't get a battery event because
there is no battery as per the OS.
But there is still like 3 minutes of battery remaining.
So the events I get is only ac_adapter. My requirement was to trap events and
fire up "shutdown in 1 minute". And abort the shutdown if returned to AC within
a minute
I have done that with the attached scripts. Maybe we can put than in the
examples.
Regards,
Ritesh
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-trunk-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages acpid depends on:
ii libc6 2.10.2-2 GNU C Library: Shared libraries
ii lsb-base 3.2-23 Linux Standard Base 3.2 init scrip
ii module-init-tools 3.11-1 tools for managing Linux kernel mo
Versions of packages acpid recommends:
ii acpi-support-base 0.130-1 scripts for handling base ACPI eve
acpid suggests no packages.
-- no debconf information
event=ac_adapter.*
action=/etc/acpi/actions/acpi-power-mgmt.sh
#!/bin/sh
POWER_STATE=`acpi -V | grep "Adapter" | awk '{print $3}'`
if [ $POWER_STATE = "on-line" ]; then
pkill -09 shutdown
elif [ $POWER_STATE = "off-line" ]; then
/sbin/shutdown -h 1 &
else
echo -en "Incorrect power state\n"
echo -en "Exit with error\n"
exit 1;
fi