ACPI_BATTERY(4)
πΈ NAME πΈ
acpi_battery β the ACPI battery management subsystem, aka the thing that tells you why your laptop is about to die at the worst possible moment π
β¨ SYNOPSIS β¨
device acpi
π¦ DESCRIPTION π¦
okay so acpi_battery is a driver for the battery management features of the ACPI module. it's giving "your battery, but make it kernel-level" π
An ACPI-compatible battery device supports either a Control Method Battery interface or a Smart Battery subsystem interface. the first one gets accessed by the AML (ACPI Machine Language) code control methods, and the second one is controlled directly through the ACPI EC (Embedded Controller), typically via an SMBus interface. two whole flavors, both iconic π
This driver supports the sysctl(8) and ioctl(2) interfaces as well as the devd(8) event notification interface. yeah bestie, it does it all. main character energy fr fr β¨
π IOCTLS π
Every ioctl for the acpi_battery driver takes a single integer value for the battery unit number as an argument, and returns a specific structure for each request. and there's a special unit number, ACPI_BATTERY_ALL_UNITS, that specifies all of the attached units and reports accumulated information. group project but make it battery data π«Ά
ACPIIO_BATT_GET_UNITSintβ Returns the number of battery units in the system. the unit number argument gets straight-up ignored here, she said "no thoughts, head empty" πACPIIO_BATT_GET_BATTINFOstruct acpi_battinfoβ Returns the following:capβ Battery capacity in percent,minβ Remaining battery life in minutes,stateβ Current status of the battery, encoded in the following:ACPI_BATT_STAT_DISCHARG(0x0001) β Battery is discharging,ACPI_BATT_STAT_CHARGING(0x0002) β Battery is being charged, orACPI_BATT_STAT_CRITICAL(0x0004) β Remaining battery life is critically low.
Note that the status bits of each battery will be consolidated when ACPI_BATTERY_ALL_UNITS is specified. so all the drama gets merged into one report π
rateβ Current battery discharging rate in mW.-1means not discharging right now. she's just chillin π
ACPIIO_BATT_GET_BIXstruct acpi_bixβ Returns battery information given by the ACPI_BIX(Battery Information) object, which is the static portion of the Control Method Battery information. In the case of a Smart Battery attached to SMBus, or a Control Method Battery with a_BIFobject, this ioctl will build astruct acpi_bixstructure based on the obtained information and return it. slay, it adapts β¨revβ Revision number of the object. There are the following well-known values:ACPI_BIX_REV_0(0x0000) β A_BIXobject in ACPI 4.0.ACPI_BIX_REV_1(0x0001) β A_BIXobject in ACPI 6.0.ACPI_BIX_REV_BIF(0xffff) β A_BIXobject built from the_BIFobject found on the system.
Note that this field should be checked by using the ACPI_BIX_REV_MIN_CHECK(var, rev) macro when checking the minimum revision number. don't eyeball it bestie, use the macro π
unitsβ Indicates the units used by the battery to report its capacity and charge rate, encoded in the following:ACPI_BIX_UNITS_MW(0x00000000) β in mW (power)ACPI_BIX_UNITS_MA(0x00000001) β in mA (current)
Note that capacity is expressed in mWh or mAh, and rate is expressed in mW or mA, respectively. units, but make it consistent π
dcapβ The Battery's design capacity, which is the nominal capacity of a new battery. This is expressed as power or current depending on the value ofunits.lfcapβ Predicted battery capacity when fully charged. Typically this will decrease every charging cycle. it's giving "aging gracefully" πbtechβ Battery technology:0x00000000β Primary cell (non-rechargable)0x00000001β Secondary cell (rechargable)
dvolβ Design voltage in mV, which is the nominal voltage of a new battery.wcapβ Design capacity of warning. When a discharging battery device reaches this capacity, notification is sent to the system. πlcapβ Design capacity of low.cyclesβ (rev 0 or newer) The number of cycles the battery has experienced. A cycle means an amount of discharge occurred which was approximately equal to the value of Design Capacity. she's got lore now πaccuracyβ (rev 0 or newer) The accuracy of the battery capacity measurement, in thousandth of a percent.stmaxβ (rev 0 or newer) The Maximum Sampling Time of the battery in milliseconds. This is the maximum duration between two consecutive measurements of the battery's capacities specified in_BST. If two succeeding readings of_BSTbeyond this duration occur, two different results can be returned. so yeah, timing matters β±οΈstminβ (rev 0 or newer) The Minimum Sampling Time of the battery in milliseconds.aimaxβ (rev 0 or newer) The Maximum Average Interval of the battery in milliseconds. This is the length of time within which the battery averages the capacity measurements specified in_BST. The Sampling Time specifies the frequency of measurements, and the Average Interval specifies the width of the time window of every measurement. window, frequency, width β it's a whole vibe πͺaiminβ (rev 0 or newer) The Minimum Average Interval of the battery in milliseconds.gra1β Battery capacity granularity between low and warning. This is expressed as power or current depending on the value ofunits.gra2β Battery capacity granularity between warning and full. This is expressed as power or current depending on the value ofunits.modelβ Model number of the battery as a string.serialβ Serial number of the battery as a string.typeβ Type identifier of the battery as a string.oeminfoβ OEM-specific information of the battery as a string.scapβ (rev 1 or newer) Battery swapping capability, encoded in the following:ACPI_BIX_SCAP_NO(0x00000000) β Non-swappableACPI_BIX_SCAP_COLD(0x00000001) β Cold-swappableACPI_BIX_SCAP_HOT(0x00000010) β Hot-swappable π₯
ACPIIO_BATT_GET_BIFstruct acpi_bifβ (deprecated) Returns battery information given by the ACPI_BIF(Battery Information) object, which was deprecated in the ACPI 4.0 specification. The data structure is a subset ofstruct acpi_bix.
Note that this ioctl will built astruct acpi_bifstructure based on the obtained information even if this object is not available and a_BIXobject is found. yeah she's deprecated but she still shows up π
ACPIIO_BATT_GET_BSTstruct acpi_bstβ Returns battery information given by the ACPI_BST(Battery Status) object, which is the present battery status. In the case of a Smart Battery attached to SMBus, this ioctl will build astruct acpi_bststructure based on the obtained information and return it. right now, live, no filter πΈstateβ Battery state. The value is encoded in the same way asstateofstruct acpi_battinfo.rateβ Battery present rate of charging or discharging. The unit of the value depends on unit ofstruct acpi_bif.capβ Battery remaining capacity. The unit of this value depends on unit ofstruct acpi_bif.voltβ Battery present voltage. β‘
π SYSCTL VARIABLES π
The following sysctl(8) variables export battery status. note that they are accumulated status of all of the connected batteries β so yeah, it's the group chat summary, not the individual DMs π¬
hw.acpi.battery.info_expireβ Information cache expiration time in seconds. The battery information obtained by_BIXor_BIFobject will be stored and reused for successive read access to this MIB within the specified period. caching era β¨hw.acpi.battery.unitsβ Number of battery units in the system.hw.acpi.battery.stateβ Current battery charging status. This is same asstateofstruct acpi_battinfo.hw.acpi.battery.rateβ Current battery discharging rate in mW.hw.acpi.battery.timeβ Remaining battery life in minutes. If the battery is not discharging, the value shows-1.hw.acpi.battery.lifeβ Battery capacity in percent. π
π EVENT NOTIFICATIONS π
Battery-related event notifications are sent to the userland via the devd(8) interface. See /etc/devd.conf and devd.conf(5) for more details.
Note that notifications are supported only by the Control Method Battery. so if you're on the other flavor, no notifs for you bestie π
The acpi_battery driver sends events with the following attributes:
systemβACPIsubsystemβCMBATtypeβ The fully qualified battery object path as in the ASL.notifyβ An integer designating the event:0x80β Battery status was changed.0x81β Battery information was changed.
π SEE ALSO π
π AUTHORS π
Nate Lawson <njl@FreeBSD.org>, Munehiro Matsuda, Takanori Watanabe <takawata@FreeBSD.org>, Mitsuru IWASAKI <iwasaki@FreeBSD.org>, Hans Petter Selasky <hselasky@FreeBSD.org>, and Hiroki Sato <hrs@FreeBSD.org>.
This manual page was written by Takanori Watanabe <takawata@FreeBSD.org> and Hiroki Sato <hrs@FreeBSD.org>. absolute legends, we stan π«Άβ¨
and that's the whole page bestie, no cap π this one came out of the Debian corner of the world, dated February 16, 2020, and yeah it lives under the name ACPI_BATTERY(4). go forth and read your battery stats, you icon πΈπ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2019 Takanori Watanabe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms