From owner-freebsd-current@FreeBSD.ORG Fri Jul 20 05:31:11 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 53983106566C for ; Fri, 20 Jul 2012 05:31:11 +0000 (UTC) (envelope-from lars@e-new.0x20.net) Received: from mail.0x20.net (mail.0x20.net [IPv6:2001:aa8:fffb:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id D23EC8FC0A for ; Fri, 20 Jul 2012 05:31:10 +0000 (UTC) Received: from mail.0x20.net (mail.0x20.net [217.69.76.211]) by mail.0x20.net (Postfix) with ESMTP id 77E936A6007; Fri, 20 Jul 2012 07:31:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.0x20.net Received: from mail.0x20.net ([217.69.76.211]) by mail.0x20.net (mail.0x20.net [217.69.76.211]) (amavisd-new, port 10024) with ESMTP id V6fNZtK5JIPR; Fri, 20 Jul 2012 07:31:09 +0200 (CEST) Received: from e-new.0x20.net (mail.0x20.net [IPv6:2001:aa8:fffb:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.0x20.net (Postfix) with ESMTPS id 2994B6A6006; Fri, 20 Jul 2012 07:31:09 +0200 (CEST) Received: from e-new.0x20.net (localhost [127.0.0.1]) by e-new.0x20.net (8.14.5/8.14.5) with ESMTP id q6K5V83E038879; Fri, 20 Jul 2012 07:31:08 +0200 (CEST) (envelope-from lars@e-new.0x20.net) Received: (from lars@localhost) by e-new.0x20.net (8.14.5/8.14.5/Submit) id q6K5V8eP037617; Fri, 20 Jul 2012 07:31:08 +0200 (CEST) (envelope-from lars) Date: Fri, 20 Jul 2012 07:31:08 +0200 From: Lars Engels To: Erich Dollansky Message-ID: <20120720053108.GD70259@e-new.0x20.net> References: <201207201004.59451.erichfreebsdlist@ovitrap.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="afaOoWBOIwPZGAW2" Content-Disposition: inline In-Reply-To: <201207201004.59451.erichfreebsdlist@ovitrap.com> X-Editor: VIM - Vi IMproved 7.3 X-Operation-System: FreeBSD 8.3-RELEASE-p2 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-current@freebsd.org Subject: Re: Script to monitor battery status on X220 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 05:31:11 -0000 --afaOoWBOIwPZGAW2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 20, 2012 at 10:04:59AM +0700, Erich Dollansky wrote: > Hi, >=20 > I forget yesterday to share these two scripts: >=20 > http://www.alogreentechnologies.com/freebsd/checkbattery >=20 > checks the battery status of an X220 and shuts the machine down when the = battery falls to 2% or below. >=20 > The status is checked every minute. >=20 > It calls the following script to shut the machine down: >=20 > http://www.alogreentechnologies.com/freebsd/poweroff >=20 > You must run the first script as root to enable it to power the machine o= ff at the end. >=20 > I found that the battery life of my machine was higher using a simple win= dow manager like blackbox compared to things like GNOME or KDE. This might = depend on the usage pattern. >=20 > 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. --afaOoWBOIwPZGAW2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlAI7RwACgkQKc512sD3afipaACfUOnOt7kxYKArxvwpepPUebHD x+oAn0Fi+VWgHjuvGiBYBzaz3X9NXiWP =hxJF -----END PGP SIGNATURE----- --afaOoWBOIwPZGAW2--