Affected file:
sys/dev/acpica/acpi_cmbat.c
Short description:
Get notified if your battery reaches a user-defined percentage.
Long description:
There is no need to run a daemon that regularly checks the battery level.
Just tell the battery controller your desired warning level via the optional acpi method _BTP.
Your battery supports this if the command "acpidump -dt |grep _BTP" returns something (an acpi method).
Currently the FreeBSD cmbat driver only supports mandatory methods (bif, bix, ..), but no optional ones.
If supported by the battery, a new sysctl is created, dev.battery.0.Warning_Level
You can set the warning level with this sysctl (values between 0-100).
Once the battery reaches that level, devd will be notified via system "ACPI" subsystem "CMBAT" events.
A /etc/devd.conf entry might look like this:
notify 10 {
match "system" "ACPI";
match "subsystem" "CMBAT";
action "/home/myuser/myscript.sh $notify";
};
Personal note: Please write me if I need to look at this again.
For example, if it no longer compiles. Thanks. :-)