summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-08-05 17:00:58 +0000
committernjl <njl@FreeBSD.org>2005-08-05 17:00:58 +0000
commit0037d26e49b3f01d1ab949f474eb08d62d78cfc8 (patch)
tree569bcc1bdd7b0cd7f69d25c7f22319201b4e7f58
parent7fb7d7aef135e13549b0393980600fb9f16937e3 (diff)
downloadFreeBSD-src-0037d26e49b3f01d1ab949f474eb08d62d78cfc8.zip
FreeBSD-src-0037d26e49b3f01d1ab949f474eb08d62d78cfc8.tar.gz
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
-rw-r--r--sys/dev/acpica/acpi_battery.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c
index 4204656..4099468 100644
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -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;
}
OpenPOWER on IntegriCloud