aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2004-12-20 05:03:41 +0000
committerNate Lawson <njl@FreeBSD.org>2004-12-20 05:03:41 +0000
commit54640fac34586377620bfcb314c170a586f096f7 (patch)
tree877f3ca81537b8b210638fdffa93c88b940fe646 /sys
parent87c9e3704f5e13cbe361cf192a7b5231366afbc5 (diff)
downloadsrc-54640fac34586377620bfcb314c170a586f096f7.tar.gz
src-54640fac34586377620bfcb314c170a586f096f7.zip
Only report a critical battery level once until it's gone non-critical.
An improvement would be to check all batteries for critical state before printing a message. Reported by: Kevin Oberman (oberman at es net)
Notes
Notes: svn path=/head/; revision=139057
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpica/acpi_cmbat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index f48fdc6b08a7..54e498225060 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -66,6 +66,7 @@ struct acpi_cmbat_softc {
struct timespec bif_lastupdated;
struct timespec bst_lastupdated;
+ int flags;
int present;
int cap;
int min;
@@ -189,9 +190,14 @@ acpi_cmbat_get_bst(void *context)
goto end;
acpi_cmbat_info_updated(&sc->bst_lastupdated);
- /* XXX Should we shut down here? */
- if (sc->bst.state & ACPI_BATT_STAT_CRITICAL)
- device_printf(dev, "critically low charge!\n");
+ /* XXX If all batteries are critical, perhaps we should suspend. */
+ if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) {
+ if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) {
+ sc->flags |= ACPI_BATT_STAT_CRITICAL;
+ device_printf(dev, "critically low charge!\n");
+ }
+ } else
+ sc->flags &= ~ACPI_BATT_STAT_CRITICAL;
end:
if (bst_buffer.Pointer != NULL)