Subject: Re: acpi/apm code only uses last battery?
To: Jared D. McNeill <jmcneill@invisible.ca>
From: Greg Troxel <gdt@ir.bbn.com>
List: port-i386
Date: 10/11/2006 08:22:02
--=-=-=
Content-Transfer-Encoding: quoted-printable


"Jared D. McNeill" <jmcneill@invisible.ca> writes:

> On 10-Oct-06, at 9:53 PM, Greg Troxel wrote:
>> This is clearly wrong, and it's because the loop in
>> src/sys/dev/acpi/acpi_apm.c:acpiapm_get_powstat overwrites the battery
>> info as it finds each battery while looping over the data.
>>
>> One fix would be to aggregate the 'design cap' and 'charge' levels, to
>> give the impression of a single battery with the sum of the charges.
>> Another would be to represent each battery as an apm battery.

> The GNOME battery applet should really be fixed to use data exported
> by envsys; /dev/apm has been deprecated and will be removed in a yet-
> undetermined future release.

Sure.  I see that gnome-applets has Linux, FreeBSD, and OpenBSD
support, and that pkgsrc patches the OpenBSD apm support to work on
NetBSD too.

> If we want to keep supporting APM, it
> should really export data via envsys.

I think we should keep apm support for quite a while, at least as long
as people have working boxes with apm and no acpi.

> If /dev/apm can't accurately represent multiple batteries present in a
> system, this is a problem with that specific interface, not the  ACPI
> /dev/apm implementation in general.

Well perhaps, but in my view if there's a single "% charged" variable
in an interface, then one should fill that in with "100 * \sum current
/ \sum lastchargedcap", rather than pretending that the
highest-numbered battery is the only battery.  Whether that work is
worth doing is another question.

=2D-=20

    Greg Troxel <gdt@ir.bbn.com>

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFFLOHu+vesoDJhHiURAqy4AJ9utDbAVFusEEas9Hns019PtOk7egCfbu4E
dZvYlWOAdZ7NDQbVRsa9joM=
=Yc9f
-----END PGP SIGNATURE-----
--=-=-=--