How to identify the primary battery (for Wine)
alexhenrie24 at gmail.com
Tue Jun 14 10:17:31 CDT 2022
On Tue, Jun 14, 2022 at 8:17 AM Sebastian Reichel
<sebastian.reichel at collabora.com> wrote:
> 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.
Thanks Sebastian, that helps a lot! We would really need to test this
API on Windows on a laptop with two batteries to see whether Windows
aggregates the batteries or just reports the charge of the first one.
For now, I hope that not doing any aggregation in Wine is acceptable
(and I hope someone will tell me if I'm mistaken).
> On Tue, Jun 14, 2022 at 2:05 AM Benjamin Berg <benjamin at sipsolutions.net> wrote:
> > 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.
I also don't know if D-Bus would be a good choice here. It would
certainly be a bigger change than the patch that I've proposed. What
are the advantages and disadvantages of querying the battery through
D-Bus, besides it doing battery aggregation for us?
More information about the wine-devel