From owner-freebsd-current@FreeBSD.ORG Fri Jul 20 08:43:08 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 3D9F1106564A for ; Fri, 20 Jul 2012 08:43:08 +0000 (UTC) (envelope-from erichfreebsdlist@ovitrap.com) Received: from alogreentechnologies.com (alogreentechnologies.com [67.212.224.110]) by mx1.freebsd.org (Postfix) with ESMTP id E1F6D8FC14 for ; Fri, 20 Jul 2012 08:43:07 +0000 (UTC) Received: from amd620.ovitrap.com ([49.128.188.2]) (authenticated bits=0) by alogreentechnologies.com (8.13.1/8.13.1) with ESMTP id q6K8h1IG004598; Fri, 20 Jul 2012 02:43:03 -0600 From: Erich Dollansky To: Lars Engels Date: Fri, 20 Jul 2012 15:45:23 +0700 User-Agent: KMail/1.13.7 (FreeBSD/8.3-STABLE; KDE/4.7.4; amd64; ; ) References: <201207201004.59451.erichfreebsdlist@ovitrap.com> <20120720053108.GD70259@e-new.0x20.net> In-Reply-To: <20120720053108.GD70259@e-new.0x20.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Message-Id: <201207201545.23915.erichfreebsdlist@ovitrap.com> 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 08:43:08 -0000 Hi, On Friday 20 July 2012 12:31:08 Lars Engels wrote: > 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. > this is a good idea. I did not like this solution either but did not get a better idea when I did it. Erich