kern/124223: [acpi] [patch] acpi_battery.c -- Notify user-defined critical level via devd(8)

Pietro Cerutti gahr at
Mon Sep 8 21:44:00 UTC 2008

Hash: SHA512

Nate Lawson wrote:
| There are a few problems with your approach.
| Critical status is already reported with a flag when usermode polls for
| the battery status:
|> 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");
|>     }
|> }

I agree. Critical level is already checked for in the cmbat module.
However, reporting is not done in a "standardized" way. My patch would
just like to add notification through devd.

| Since usermode utilities already poll, they can handle that flag or
| implement their own notion of critical battery level.  Why introduce a
| new kernel thread to do that same polling?
Because you can't configure the notion of "critical level" via cmbat.

| Don't common battery status tools that poll (say, xbatt) have their own
| way to set a critical level?
xbatt uses APM and ioctl to get the status of the battery.

I agree that userlevel utilities can e.g., retrieve the remaining
percent and set the critical level arbitrarily, but I anyway think that
a configurable level to be seen as critical by the OS could be a useful

I'm open to discussions about the best way to implement it (cmbat,
battery, ...?), if we get to an agreement that this could be a useful
feature :) Otherwise feel free to close the PR, as I can accept your

| -Nate
| Pietro Cerutti wrote:
|> POKE!
|> Anybody interested in reviewing it?

- --
Pietro Cerutti
gahr at

PGP Public Key:

Version: GnuPG v2.0.9 (FreeBSD)


More information about the freebsd-acpi mailing list