From owner-freebsd-acpi@FreeBSD.ORG Thu Jan 14 07:56:46 2010 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 356D41065670 for ; Thu, 14 Jan 2010 07:56:46 +0000 (UTC) (envelope-from guido@gvr.org) Received: from gvr.gvr.org (gvr-gw.gvr.org [82.95.154.195]) by mx1.freebsd.org (Postfix) with ESMTP id E9C0C8FC16 for ; Thu, 14 Jan 2010 07:56:45 +0000 (UTC) Received: by gvr.gvr.org (Postfix, from userid 657) id CE33E42D818; Thu, 14 Jan 2010 08:56:44 +0100 (CET) Date: Thu, 14 Jan 2010 08:56:44 +0100 From: Guido van Rooij To: Nate Lawson Message-ID: <20100114075644.GA18572@gvr.gvr.org> References: <20100113204228.GA8768@gvr.gvr.org> <4B4E799E.2030405@root.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B4E799E.2030405@root.org> Cc: freebsd-acpi@freebsd.org Subject: Re: ACPI CMBAT notify's never reach devd? 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: Thu, 14 Jan 2010 07:56:46 -0000 On Wed, Jan 13, 2010 at 05:55:42PM -0800, Nate Lawson wrote: > Guido van Rooij wrote: > > I am trying to have a script shutdown a system on low battery levels and > > I'm using this script: > > http://www.chruetertee.ch/files/download/battery > > > > What I see is that the script is only called when the state changes > > (e.g. when the bateries start charging). > > Reading the script, it seems to imply that notify's should be sent > > regularly when the level (hw.acpi.battery.life) changes. > > However that does not happen. > > > > Also, when batteries run out, the state does not change to LOW (I waited > > to: > > hw.acpi.battery.life: 4 > > hw.acpi.battery.time: 3 > > hw.acpi.battery.state: 1 > > > > I am not sure if this is a bug in the acpi implementation or in my laptop's > > bios (the dumped DSDT indeed only seems to send SB.BAT noities in the PWRE > > method). I read on http://www.columbia.edu/~ariel/acpi/acpi_howto.txt: > > If your battery doesn't support alarms, the ACPI specification requires the > > OS to poll the battery to check its remaining capacity. It appears that > > Linux does not yet do this. In this case, it's best to run a user > > application that can check your battery status and take appropriate action. > > > > Can anyone tell me what I need to do to use the script succesfully? > > My system: Dell D820 running 8.0-release. > > Most battery systems don't generate the notifies on level changes. So > our ACPI battery implementation itself is polled. You should probably > just run a cron job that checks the level. That can be done of course, but devd seems a better place. > > Perhaps we could add a low and high mark to the kernel code, > configurable by the user. It would be checked by the cmbat polling code > and generate an artificial notify to devd if there was a match. > Can you tell me which function in acpi_cmbat is used for polling, as it seems to me thee is no regular polling. There is a define CMBAT_POLLRATE but it is never used. -Guido