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

Nate Lawson nate at
Fri Sep 5 17:10:43 UTC 2008

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");
>     }
> }

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?

Don't common battery status tools that poll (say, xbatt) have their own
way to set a critical level?


Pietro Cerutti wrote:
> Anybody interested in reviewing it?


More information about the freebsd-acpi mailing list