ACPI_BATTERY(4)
๐ ACPI_BATTERY(4) ๐
Okay so picture this: you're on your laptop, vibing, and you need to know what's up with your battery. That's literally where acpi_battery comes in โ it's the ACPI battery management subsystem, and it's here to serve cunt and keep you informed. Periodt. ๐โจ
โจ SYNOPSIS โจ
device acpi
๐ธ DESCRIPTION ๐ธ
So acpi_battery is literally the driver for battery management features of the ACPI module, bestie. It's giving main character energy in your kernel. ๐
An ACPI-compatible battery device supports either a Control Method Battery interface or a Smart Battery subsystem interface โ like, it's one or the other, no cap. The Control Method Battery one is accessed by the AML (ACPI Machine Language) code control methods. The Smart Battery one? That's controlled directly through the ACPI EC (Embedded Controller), typically via an SMBus interface. Iykyk. ๐
This driver is literally so versatile โ it supports the sysctl(8) and ioctl(2) interfaces as well as the devd(8) event notification interface. Obsessed. ๐
๐ IOCTLS ๐
Okay so every single 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. That's just how it is. ๐โโ๏ธ
And here's the tea: there's a special unit number ACPI_BATTERY_ALL_UNITS that literally specifies ALL of the attached units and reports accumulated information. It's giving "we're all in this together" energy. ๐ซถ
ACPIIO_BATT_GET_UNITSint โ Returns the number of battery units in the system. The unit number argument will be ignored. Like, it literally doesn't care what you pass. ๐ACPIIO_BATT_GET_BATTINFOstruct acpi_battinfo โ Returns the following, bestie:capโ Battery capacity in percent. Giving you the numbers. ๐minโ Remaining battery life in minutes. Like, how long until you need to find a charger. ๐ญstateโ Current status of the battery encoded in the following:ACPI_BATT_STAT_DISCHARG(0x0001) โ Battery is discharging. You're on your own, bestie. ๐ACPI_BATT_STAT_CHARGING(0x0002) โ Battery is being charged. Slay, plug that in. ๐ACPI_BATT_STAT_CRITICAL(0x0004) โ Remaining battery life is critically low. Like, panic mode. ๐จ
Note that the status bits of each battery will be consolidated when ACPI_BATTERY_ALL_UNITS is specified. So it's like a group chat for all your batteries. ๐ฌ
rateโ Current battery discharging rate in mW.-1means not discharging right now. So if it's-1, you're 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. It's giving "here's the permanent record" vibes. ๐
In the case of a Smart Battery attached to SMBus or a Control Method Battery with a _BIF object, this ioctl will build a struct acpi_bix structure based on the obtained information and return it. It's adaptable, it's iconic. โจ
revโ Revision number of the object. There are the following well-known values:ACPI_BIX_REV_0(0x0000) โ A_BIXobject in ACPI 4.0. Vintage, but make it fashion. ๐ฐ๏ธACPI_BIX_REV_1(0x0001) โ A_BIXobject in ACPI 6.0. The newer model. ๐ACPI_BIX_REV_BIF(0xffff) โ A_BIXobject built from the_BIFobject found on the system. Like, we made it work. ๐ช
Note that this field should be checked by using ACPI_BIX_REV_MIN_CHECK(var, rev) macro when checking the minimum revision number. That's the move, bestie. ๐ฏ
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). It's giving watts but milli. โกACPI_BIX_UNITS_MA(0x00000001) โ in mA (current). Current affairs, literally. ๐
Note that capacity is expressed in mWh or mAh, and rate is expressed in mW or mA, respectively. Just so you know. ๐ง
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. Like, what it was born with. ๐ถlfcapโ Predicted battery capacity when fully charged. Typically this will decrease every charging cycle. Aging like fine wine, but in reverse. ๐ทbtechโ Battery technology:0x00000000โ Primary cell (non-rechargeable). One and done. ๐0x00000001โ Secondary cell (rechargeable). The sustainable queen. ๐ฑ
dvolโ Design voltage in mV, which is the nominal voltage of a new battery. Voltage, but make it design. โกwcapโ Design capacity of warning. When a discharging battery device reaches this capacity, notification is sent to the system. It's giving "hey bestie, heads up." ๐ขlcapโ Design capacity of low. Like, lower than warning. The stakes are higher. ๐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. It's like a battery's step count. ๐accuracyโ (rev 0 or newer) The accuracy of the battery capacity measurement, in thousandth of a percent. Precision, honey. ๐ฏ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. Like, it's giving inconsistent. ๐stminโ (rev 0 or newer) The Minimum Sampling Time of the battery in milliseconds. The floor, the minimum, the "at least this often." โฑ๏ธ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. It's giving data science, honestly. ๐aiminโ (rev 0 or newer) The Minimum Average Interval of the battery in milliseconds. The lower bound, bestie. ๐gra1โ Battery capacity granularity between low and warning. This is expressed as power or current depending on the value ofunits. Granular, like your fave eyeshadow palette. ๐gra2โ Battery capacity granularity between warning and full. This is expressed as power or current depending on the value ofunits. More granularity, more power. ๐modelโ Model number of the battery as a string. It's giving identity. ๐ท๏ธserialโ Serial number of the battery as a string. Unique, like you. ๐typeโ Type identifier of the battery as a string. Categorization, honey. ๐oeminfoโ OEM-specific information of the battery as a string. The manufacturer's little secret. ๐คซscapโ (rev 1 or newer) Battery swapping capability encoded in the following:ACPI_BIX_SCAP_NO(0x00000000) โ Non-swappable. You're stuck with it. ๐ACPI_BIX_SCAP_COLD(0x00000001) โ Cold-swappable. Swap it while it's off. ๐งACPI_BIX_SCAP_HOT(0x00000010) โ Hot-swappable. Swap it while it's running, living dangerously. ๐ฅ
ACPIIO_BATT_GET_BIFstruct acpi_bif โ (deprecated) Returns battery information given by the ACPI_BIF(Battery Information) object, which was deprecated in ACPI 4.0 specification. It's giving vintage, but not in a cute way. The data structure is a subset ofstruct acpi_bix. So it's like the little sibling. ๐ถ
Note that this ioctl will built a struct acpi_bif structure based on the obtained information even if this object is not available and a _BIX object is found. It's resourceful, okay? ๐โโ๏ธ
ACPIIO_BATT_GET_BSTstruct acpi_bst โ Returns battery information given by the ACPI_BST(Battery Status) object, which is the present battery status. Like, what's happening right now. ๐
In the case of a Smart Battery attached to SMBus, this ioctl will build a struct acpi_bst structure based on the obtained information and return it. It's adaptable. โจ
stateโ Battery state. The value is encoded in the same way asstateofstruct acpi_battinfo. Same vibes, different struct. ๐ซrateโ Battery present rate of charging or discharging. The unit of the value depends on unit ofstruct acpi_bif. So like, check the units, bestie. ๐capโ Battery remaining capacity. The unit of this value depends on unit ofstruct acpi_bif. Again, units matter. ๐งฎvoltโ Battery present voltage. The juice, the power, the voltage. โก
๐ฆ SYSCTL VARIABLES ๐ฆ
Okay so the following sysctl(8) variables export battery status. Note that they are accumulated status of all of the connected batteries โ it's giving collective energy. ๐
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. It's giving "remember this for later." ๐งhw.acpi.battery.unitsโ Number of battery units in the system. Count 'em. ๐ขhw.acpi.battery.stateโ Current battery charging status. This is same asstateofstruct acpi_battinfo. Same energy, different variable. ๐hw.acpi.battery.rateโ Current battery discharging rate in mW. The speed at which you're losing power. ๐hw.acpi.battery.timeโ Remaining battery life in minutes. If the battery is not discharging, the value shows-1. So-1means you're chillin'. ๐hw.acpi.battery.lifeโ Battery capacity in percent. The big number, the one you check when you're anxious. ๐
๐ 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. It's giving communication, it's giving connection. ๐ก
Note that notifications are supported only by the Control Method Battery. Like, only that one. Don't @ me. ๐ โโ๏ธ
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. Something's different. ๐0x81โ Battery information was changed. New info dropped. ๐ฌ
๐ 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>. Legends, all of them. ๐
This manual page was written by Takanori Watanabe <takawata@FreeBSD.org> and Hiroki Sato <hrs@FreeBSD.org>. Icons. โจ
This slay page is brought to you by Debian, from the Kernel Interfaces Manual, dated February 16, 2020. Periodt. ๐ ๐
๐ฆ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2019 Takanori Watanabe
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms