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)
This commit is contained in:
parent
87c9e3704f
commit
54640fac34
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=139057
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user