summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpibat.c
diff options
context:
space:
mode:
authorDeanna Phillips <deanna@cvs.openbsd.org>2007-02-17 18:53:29 +0000
committerDeanna Phillips <deanna@cvs.openbsd.org>2007-02-17 18:53:29 +0000
commit1df89a7c776034b93ca57a7c93610d71db1c92bf (patch)
tree3ccfedc9ad819e2f1f3389825c1f57ac746bce67 /sys/dev/acpi/acpibat.c
parenta9096028b7123f371e1599d9fe96751213aa2a33 (diff)
Since a full battery can still have state BST_CHARGE ("charging"),
fullness needs to be checked first. Otherwise, full batteries are always described as "charging." ok marco
Diffstat (limited to 'sys/dev/acpi/acpibat.c')
-rw-r--r--sys/dev/acpi/acpibat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c
index b45598f8d75..8eedca7d31f 100644
--- a/sys/dev/acpi/acpibat.c
+++ b/sys/dev/acpi/acpibat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpibat.c,v 1.38 2007/01/25 07:27:36 marco Exp $ */
+/* $OpenBSD: acpibat.c,v 1.39 2007/02/17 18:53:28 deanna Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -222,7 +222,10 @@ acpibat_refresh(void *arg)
sc->sc_sens[4].flags = SENSOR_FUNKNOWN;
strlcpy(sc->sc_sens[4].desc, "battery unknown",
sizeof(sc->sc_sens[4].desc));
- } else if (sc->sc_bst.bst_state & BST_DISCHARGE)
+ } else if (sc->sc_bst.bst_capacity >= sc->sc_bif.bif_last_capacity)
+ strlcpy(sc->sc_sens[4].desc, "battery full",
+ sizeof(sc->sc_sens[4].desc));
+ else if (sc->sc_bst.bst_state & BST_DISCHARGE)
strlcpy(sc->sc_sens[4].desc, "battery discharging",
sizeof(sc->sc_sens[4].desc));
else if (sc->sc_bst.bst_state & BST_CHARGE)
@@ -232,10 +235,7 @@ acpibat_refresh(void *arg)
strlcpy(sc->sc_sens[4].desc, "battery critical",
sizeof(sc->sc_sens[4].desc));
sc->sc_sens[4].status = SENSOR_S_CRIT;
- } else if (sc->sc_bst.bst_capacity >= sc->sc_bif.bif_last_capacity)
- strlcpy(sc->sc_sens[4].desc, "battery full",
- sizeof(sc->sc_sens[4].desc));
- else
+ } else
strlcpy(sc->sc_sens[4].desc, "battery idle",
sizeof(sc->sc_sens[4].desc));
sc->sc_sens[4].value = sc->sc_bst.bst_state;