From owner-freebsd-acpi@FreeBSD.ORG Fri May 23 15:13:42 2008 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 2BC951065675; Fri, 23 May 2008 15:13:42 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from cpanel03.rubas-s03.net (cpanel03.rubas-s03.net [195.182.222.73]) by mx1.freebsd.org (Postfix) with ESMTP id DA4D18FC24; Fri, 23 May 2008 15:13:41 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from [213.142.183.219] (helo=gahrtop.localhost) by cpanel03.rubas-s03.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1JzYSa-0006g7-A3; Fri, 23 May 2008 16:41:32 +0200 Message-ID: <4836D795.6030804@FreeBSD.org> Date: Fri, 23 May 2008 16:41:25 +0200 From: Pietro Cerutti Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org, njl@freebsd.org X-Enigmail-Version: 0.95.6 OpenPGP: id=9571F78E; url=http://gahr.ch/pgp/ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel03.rubas-s03.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - FreeBSD.org X-Source: X-Source-Args: X-Source-Dir: Cc: Martin Wilke Subject: [patch] acpi_battery -- notify critical 'life' via devd(8) 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: Fri, 23 May 2008 15:13:42 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Nate, list, pre-everything: my knowledge of the ACPI subsystem is very limited, as is my understanding of general kernel mechanisms. --> if this patch is crap, please be patient with me :) reason: I want my laptop to notify me when the battery life reaches a certain critical low level (say, 5%). solution: I've implemented a kernel process in acpi_battery which notifies devd(8) when the critical level is reached. For this, I've added the following sysctl OIDs to the hw.acpi.battery tree: polling_rate: in seconds, self explaining... critical_level: in percent, also self explaining... questions: I've chosen a notify of 0x80 for this event. The reason just being that I've seen acpi_thermal starting its own notify values with this number. Is there any guidelines for Notify values? devd: This patch allows for a devd.conf(5) entry such as: notify 10 { match "system" "ACPI"; match "subsystem" "Battery"; match "notify" "0x80"; action "logger -p kern.emerg 'WARNING: low battery!'"; }; the patch: http://gahr.ch/FreeBSD/patches/_pending/acpi_battery.c.diff Any comments, tests, bug-reports, ... welcome! Thanks! P.S. please CC me as I don't follow freebsd-acpi@ (yet).$ - -- Pietro Cerutti gahr@FreeBSD.org PGP Public Key: http://gahr.ch/pgp -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEAREKAAYFAkg215QACgkQwMJqmJVx9451lQCfZuNpsOOvalRvKrlu1VcQtP0M aAoAn2iXdHxrCzeAy+8qj5vMPgO9xCn4 =UIgG -----END PGP SIGNATURE-----