[plug] ACPI events and low battery

W.Kenworthy billk at iinet.net.au
Mon Jul 10 14:41:20 WST 2006


The gentoo acpi scripts call laptop_mode, where I have set it to call
the suspend2 hibernate at 2% (!). It automagicly should do everything
for you ... 

Have not tested it as the battery lasts so long that I am never that far
from charging it ...

Gotta luv the little vaio !!!

BillK

bunyip ~ # cat /etc/acpi/actions/lm_battery.sh
#! /bin/bash

test -f /usr/sbin/laptop_mode || exit 0

# Automatically disable laptop mode when the battery almost runs out,
# and re-enable it when it

/usr/sbin/laptop_mode auto
bunyip ~ # cat /etc/acpi/events/lm_battery
event=battery.*
action=/etc/acpi/actions/lm_battery.sh %e
bunyip ~ #


cat /etc/laptop_mode/laptop_mode.conf
...
###############################################################################
# Auto-hibernation settings
# -------------------------
#
# Using these settings, you can make laptop mode tools automatically put
your
# computer into hibernation when the battery level goes critically low.
#
# This feature only works on ACPI, and only works on computers whose
batteries
# give off battery events often enough.
###############################################################################

# Should laptop mode tools perform auto-hibernation?
ENABLE_AUTO_HIBERNATION=1

# The hibernation command that is to be executed when auto-hibernation
# is triggered.
HIBERNATE_COMMAND=/usr/sbin/hibernate

# Auto-hibernation battery level threshold, in percentage of the
battery's
# total capacity.
AUTO_HIBERNATION_BATTERY_CHARGE_PERCENT=2

# Enable this to auto-hibernate if the battery reports that its level is
# "critical".
AUTO_HIBERNATION_ON_CRITICAL_BATTERY_LEVEL=1

...




On Mon, 2006-07-10 at 10:08 +0400, Brad Campbell wrote:
> G'day all,
> 
> I'm running s self compiled 2.6.17.3 kernel and Ubuntu 6.06 as a base system.
> 
> gnome-power-manager has a groovy option to do something on a critical battery event. I have mine set 
> to hibernate. The problem is with this lovely laptop, the critical level is either on or about the 
> point where it really is critical, and the laptop powers down before the even seems to even fire.
> 
> On my old machine I had a script that started on boot and ran full time that polled acpid every 30 
> seconds and hibernated the machine when the battery reached 4% (which was about the death knock for 
> that old clunker). I'd like to have something that hibernates this one at about 2% (which is 9 mins 
> remaining on this machine with the small battery).
> 
> Does anyone have any experience playing with acpi and what events it might generate before I go and 
> spend a whole heap of time figuring out the best way to do this?
> 
> Brad



More information about the plug mailing list