[PATCH v2] ntdll: Check for several common battery and AC adapter names on Linux

Nikolay Sivov nsivov at codeweavers.com
Sun Apr 24 05:52:08 CDT 2022


On 4/24/22 13:30, Austin English wrote:
> On Fri, Apr 22, 2022, 12:32 Alex Henrie <alexhenrie24 at gmail.com> wrote:
>
>> On Fri, Apr 22, 2022 at 2:20 AM Alex Henrie <alexhenrie24 at 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?



More information about the wine-devel mailing list