On 4/24/22 05:52, Nikolay Sivov wrote:
On 4/24/22 13:30, Austin English wrote:
On Fri, Apr 22, 2022, 12:32 Alex Henrie alexhenrie24@gmail.com wrote:
On Fri, Apr 22, 2022 at 2:20 AM Alex Henrie alexhenrie24@gmail.com wrote:
- static const char* ac_names[] =
- {
"AC",
"ACAD",
"ADP0",
"ADP1",
NULL
- };
- static const char* bat_names[] =
- {
"BAT0",
"BAT1",
NULL
- };
Sorry, I kind of jumped the gun on this. I looked through the Google search results more thoroughly this morning and discovered that AC0, AC1, and BAT are also common names.
If any of you would like to help, could you look in /sys/class/power_supply on your computer and let me know if your devices have other names that I missed?
-Alex
This matches my amd64 hardware.
My armv7l chromebook reports the battery as: "sbs-20-000b" (alongside "gpio-charger") My aarch64 pinebook reports the battery as: "battery" (alongside "ac" and "usb")
On my system /sys/class/power_supply/*/type file contains either "Mains" for AC device, or "Battery" for BAT0.
I haven't checked kernel sources to see if it makes sense to rely on these values, hopefully it doesn't depend on the driver. If it's relatively stable, maybe we could look for type instead of the device name?
It's part of the "testing" ABI, like everything else in power_supply [1], which apparently means that "the interface can be changed to add new features, but the current interface will not break by doing this, unless grave errors or security problems are found in them."
FWIW, there are other values there than just "Mains" and "Battery".
I also will note that my desktop has nothing in power_supply at all. I don't know if this is typical for desktops.
https://www.kernel.org/doc/html/latest/admin-guide/abi-testing.html#abi-sys-...