Script to monitor battery status on X220

Lars Engels lars.engels at 0x20.net
Fri Jul 20 05:31:11 UTC 2012


On Fri, Jul 20, 2012 at 10:04:59AM +0700, Erich Dollansky wrote:
> Hi,
> 
> I forget yesterday to share these two scripts:
> 
> http://www.alogreentechnologies.com/freebsd/checkbattery
> 
> checks the battery status of an X220 and shuts the machine down when the battery falls to 2% or below.
> 
> The status is checked every minute.
> 
> It calls the following script to shut the machine down:
> 
> http://www.alogreentechnologies.com/freebsd/poweroff
> 
> You must run the first script as root to enable it to power the machine off at the end.
> 
> I found that the battery life of my machine was higher using a simple window manager like blackbox compared to things like GNOME or KDE. This might depend on the usage pattern.
> 
> Erich

Is it necessary to poll? Usually devd generates an event when the
battery status and/or percentage changes. Just read the events from
/var/run/devd.pipe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20120720/76ac7b60/attachment.pgp


More information about the freebsd-current mailing list