When summing capacities, skip info from batteries that weren't present.

Previously, we used all info (including -1 or "not present") which would
keep the system from reaching 100% when charging.

Reported by:	Eric Anderson
MFC after:	2 days
This commit is contained in:
Nate Lawson 2005-08-05 17:00:58 +00:00
parent 5a4d78a1f6
commit 9396c1b2d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148742

View File

@ -225,6 +225,10 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
else
bi[i].min = 0;
total_min += bi[i].min;
/* If this battery is not present, don't use its capacity. */
if (bi[i].cap == -1)
bi[i].cap = 0;
total_cap += bi[i].cap;
}