From owner-freebsd-acpi@FreeBSD.ORG Sun Nov 26 03:32:15 2006 Return-Path: X-Original-To: freebsd-acpi@freebsd.org Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E096716A40F for ; Sun, 26 Nov 2006 03:32:15 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE57643D60 for ; Sun, 26 Nov 2006 03:31:22 +0000 (GMT) (envelope-from smithi@nimnet.asn.au) Received: from localhost (smithi@localhost) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.4) with SMTP id OAA02120; Sun, 26 Nov 2006 14:31:59 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sun, 26 Nov 2006 14:31:59 +1100 (EST) From: Ian Smith To: "M. Warner Losh" In-Reply-To: <20061125.160917.1628359610.imp@bsdimp.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-acpi@freebsd.org Subject: Re: How do I... X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Nov 2006 03:32:16 -0000 On Sat, 25 Nov 2006, M. Warner Losh wrote: > In message: <4568AA2F.4050602@root.org> > Nate Lawson writes: > : M. Warner Losh wrote: > : > ... run a command when there's < 1% battery life left? > : > > : > Warner > : > : You add support here in acpi_cmbat.c: > : /* XXX If all batteries are critical, perhaps we should suspend. */ > : if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) { > : if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) { > : sc->flags |= ACPI_BATT_STAT_CRITICAL; > : device_printf(dev, "critically low charge!\n"); > : } > : } > : > : Use the acpi_NotifyMumble function to send a value to devd. You > : probably want to make sure you're off AC power also since you may still > : have that crit state when plugged in. So read the value of AC status > : (see kern_power.c for how to do this) before sending the notify. > > I was thinking of sending the critical message as well as for each % > of battery life that changed. I just wanted to make sure that it > wasn't being done already and i was captain clueless. > > Warner I suspect what you're after is basically the functionality previously provided by apmd for APM battery % {dis,}charging (and other) power related events, where you could define in apmd.conf, eg from mine: apm_battery 20% discharging { exec "logger -p user.notice battery status low [20%]"; exec "echo T250L8CE-GE-C >>/dev/speaker"; } Me too .. and here's where Nate says 'well write it then!' :) Cheers, Ian