summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2003-09-17 08:47:39 +0000
committeriwasaki <iwasaki@FreeBSD.org>2003-09-17 08:47:39 +0000
commite7572e5a6fef77f3e5f01bddf60f2fabfe682aff (patch)
treef2e64aad9d48ed7c56889eed795298452c2ab6a4
parent9fac14e51fbda70a693d9001fd1ab05d3560cc98 (diff)
downloadFreeBSD-src-e7572e5a6fef77f3e5f01bddf60f2fabfe682aff.zip
FreeBSD-src-e7572e5a6fef77f3e5f01bddf60f2fabfe682aff.tar.gz
Add final adjustment code of battery status based on the battery capacity
rather than returning unknown status.
-rw-r--r--sys/i386/acpica/acpi_machdep.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c
index 5021866..09e095a 100644
--- a/sys/i386/acpica/acpi_machdep.c
+++ b/sys/i386/acpica/acpi_machdep.c
@@ -98,6 +98,15 @@ acpi_capm_convert_battstate(struct acpi_battinfo *battp)
if (battp->state & ACPI_BATT_STAT_CHARGING)
state = 3; /* charging */
+ /* If still unknown, determine it based on the battery capacity. */
+ if (state == 0xff) {
+ if (battp->cap >= 50) {
+ state = 0; /* high */
+ } else {
+ state = 1; /* low */
+ }
+ }
+
return (state);
}
OpenPOWER on IntegriCloud