From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2575C43334 for ; Fri, 17 Jun 2022 11:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381463AbiFQLbY (ORCPT ); Fri, 17 Jun 2022 07:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbiFQLbY (ORCPT ); Fri, 17 Jun 2022 07:31:24 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F225D6CAB2 for ; Fri, 17 Jun 2022 04:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Type:References: In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Content-Transfer-Encoding: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-To:Resent-Cc:Resent-Message-ID; bh=jefMjbgczLCC5ZgjzWRovraHzwRQY6Wrol6OOhFMrGg=; t=1655465483; x=1656675083; b=R1uQIsdKmxSUQ7WeAN8N5oY89+GBo1lj5c5jo94fBr+8QQcdAAsOO9cjgD6dQBwi/UDHAQyxWzk OrtzNbNMq3XV9lPJBGlApdecLL8/qJq39UwL32OCFBA9hCbR4MRmrifOn7AB6DJ7GsA5Ta4wfPFsS kyskQSD7eNVnUaKiCedPSoWS5NjChFqKCRDjG2Km0ltrtiMgn9jHD+TisTtqjCXSW/Odgkeh71xvW +tlJ3Kf3Q+cPv0kGYO3bIhD7wV7+bYEiZ1jVLbw8AVKqWQu64LybM/Mn2BMAE8tXGitltp4U5ybex DwCQvPUHus3SFnvziLDxqWSYLB4OvUk1M+Yg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1o2AC6-008QBa-S0; Fri, 17 Jun 2022 13:31:19 +0200 Message-ID: Subject: Re: How to identify the primary battery (for Wine) From: Benjamin Berg To: Alex Henrie , Sebastian Reichel Cc: Huw Davies , linux-pm@vger.kernel.org, Wine Devel Date: Fri, 17 Jun 2022 13:31:13 +0200 In-Reply-To: References: <20220614141742.j7lrj2q5b3suebb2@mercury.elektranox.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-5wajEyz9QuFVuGgvIWQj" User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-malware-bazaar-2: OK Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org --=-5wajEyz9QuFVuGgvIWQj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2022-06-14 at 09:17 -0600, Alex Henrie wrote: > On Tue, Jun 14, 2022 at 8:17 AM Sebastian Reichel > wrote: > > On Tue, Jun 14, 2022 at 2:05 AM Benjamin Berg wrote: > >=20 > > > Wouldn't it make sense for Wine to use the UPower provided > > > DisplayDevice that can be queried through DBus? > >=20 > > 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. >=20 > 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? Well, depends on what you need, it will: 1. Calculate a energy/power values if the HW reports charge/current 2. Try to generate a proper state (charging/discharging, etc.) if the hardware does not provide it 3. Aggregate multiple batteries Actually, I think using UPower likely fixes bugs: * You are currently not supporting modern hardware that reports energy/power values (rather than charge/current). * You are only reading one battery * You are not estimating a rate if the HW does not provide one (and not smoothing it which might be desirable). And, well, it should be easy. You can just query properties on a fixed DBus path. And if it fails, just assume you don't have a battery. Benjamin --=-5wajEyz9QuFVuGgvIWQj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEED2NO4vMS33W8E4AFq6ZWhpmFY3AFAmKsZgIACgkQq6ZWhpmF Y3B98Q//c6DPf+GwS5QsjcgbZ6tC3z1emZTB5adhgfPwXjBrczBv66SfgBaitASz 3gtGIuQAF+Q7lhe5PVqufBHpbNHaxs1rwDYa6QvfYO3SIBUGf34A1mN+FnjXT0cv Dmd6vXGHawK3/bM5i0rqSXa1Uezzkuj8Y4JHh+fdRxgfYyLA3V7LzR9OZP1EmR18 x6pxFPrSBcXXWq6amgGnMz7Pcxbn5nXR0QE1c6zfxQI/QO18Wu29zyozQx0iqseC V6hf3P2JN2NFrL+gkptTcLMzEK3wzCJfst/HKH1HD8ZT8zPSsAuEJoY5j3IsXfCK 4DFCpgsaoyaDFypvd9Oa1Ous46aJOSXc4+leTsY9vaGYB8m23n5GjdwJRxVTu72l U0QKclv5kN8daq7rzqJclDchgyNbbGg0YMnwbbQsuewfqPgJZL+WeXQ/OHFRtENx ZAFnD0amRcfoDX/6RXIiGvntFjO5SJn+bhhk+JSEmkBafWrqS+0na2nONYgdvxnN INK4m14caPTRcV+Gq49eInIwZ0ejInqtyqmqJfXy+cQNRHZTLD5xo54DzomClMTW aihXdUWoj2XD2eifPdCPl1ZpH1UoJHi5/jAzqQwuWUzYMcWlEbphvbHw9Is+jxdQ atqgfOUPYVv9x24zZix5fU6goGCmUJOZy9JRljFpd31CM1VbYZ4= =QQox -----END PGP SIGNATURE----- --=-5wajEyz9QuFVuGgvIWQj--