ACPI battery states

Takanori Watanabe takawata at init-main.com
Thu Oct 24 02:32:25 UTC 2019


On Thu, Oct 24, 2019 at 01:31:01AM +0000, Namkhai Bourquin via freebsd-acpi wrote:
> Hi all! I'm writing a script to get battery status and capacity, and I'm using hw.acpi.battery for that. But I can't find a reference as to which states hw.acpi.battery.state supports. Not in DuckDuckGo, nor google, nor the mailing lists archive, nothing. I only managed to discover this by discharging the battery and monitoring:
> state: 0 = unknow?
> state: 1 = discharging
> state: 2 = charging
> state: 5 = discharging critical (life < 6)
> state: 4 = same as 0, but with critical charge?
> state: 6 = charging critical

This is originally raw value of _BST which is specific ACPI method for
control method battery, but smart battery device also simulate it.
 
The bit macro is in /usr/include/dev/acpica/acpiio.h .

#define ACPI_BATT_STAT_DISCHARG         0x0001
#define ACPI_BATT_STAT_CHARGING         0x0002
#define ACPI_BATT_STAT_CRITICAL         0x0004


> I can't find anything on the man pages either.
> Should this be documented, either on a man page or the sysctl's tunable description?

It will be good.





More information about the freebsd-acpi mailing list