Subject: Re: acpi/apm code only uses last battery?
To: Greg Troxel <gdt@ir.bbn.com>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: port-i386
Date: 10/10/2006 23:16:36
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.
>
> Looking at this code, it seems note quite right (how is current
> capacity stored), but I'm not very familiar with either APM or ACPI,
> and the gnome battery applet was showing the % charge of battery 1
> correctly.

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. If we want to keep supporting APM, it  
should really export data via envsys.

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.

Cheers,
Jared