Date: Fri, 23 May 2008 16:41:25 +0200 From: Pietro Cerutti <gahr@FreeBSD.org> To: freebsd-acpi@freebsd.org, njl@freebsd.org Cc: Martin Wilke <miwi@FreeBSD.org> Subject: [patch] acpi_battery -- notify critical 'life' via devd(8) Message-ID: <4836D795.6030804@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
-----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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4836D795.6030804>