How to identify the primary battery (for Wine)

Sebastian Reichel sebastian.reichel at collabora.com
Tue Jun 14 09:17:42 CDT 2022


Hi Alex,

On Mon, Jun 13, 2022 at 07:54:49PM -0600, Alex Henrie wrote:
> I've been working to improve battery status reporting for applications
> running on Wine on Linux. However, we Wine developers are not sure
> what the best way is to determine which battery is the computer's
> primary battery. Could you take a look at
> https://gitlab.winehq.org/wine/wine/-/merge_requests/134 and leave a
> comment there or on the wine-devel mailing list?

/sys/class/power_supply/*/scope is set to 'Device' for all
batteries, that are not powering the main system. There can still
be multiple batteries; for example Thinkpads in the 2014-2018 era
used to have an internal and a removable battery. For a single
"X %/hours left" info the data from all 'System' level batteries
must be aggregated.

> Wouldn't it make sense for Wine to use the UPower provided
> DisplayDevice that can be queried through DBus?

UPower does the required data aggregation for the 'DisplayDevice'.
I don't know enough about the Wine codebase to recommend for or
against using UPower.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220614/6794b7ae/attachment.sig>


More information about the wine-devel mailing list