From owner-freebsd-acpi@FreeBSD.ORG Sat Nov 25 23:08:54 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 63BF716A403 for ; Sat, 25 Nov 2006 23:08:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id B319843D7C for ; Sat, 25 Nov 2006 23:08:03 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kAPN8VIn098360; Sat, 25 Nov 2006 16:08:31 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 25 Nov 2006 16:09:17 -0700 (MST) Message-Id: <20061125.160917.1628359610.imp@bsdimp.com> To: nate@root.org From: "M. Warner Losh" In-Reply-To: <4568AA2F.4050602@root.org> References: <20061124.201214.1656128345.imp@bsdimp.com> <4568AA2F.4050602@root.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Sat, 25 Nov 2006 16:08:31 -0700 (MST) 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: Sat, 25 Nov 2006 23:08:54 -0000 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