summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-07-25 17:44:10 +0000
committernjl <njl@FreeBSD.org>2005-07-25 17:44:10 +0000
commit7238cb10db18f9a1f6fd105e8cec1762b8a12149 (patch)
tree42723e121f3b230ededb756b9638c104ee2a6f00 /sys
parent7d261b1b3845c5a1b9cc05b5d638c71de80e0bd8 (diff)
downloadFreeBSD-src-7238cb10db18f9a1f6fd105e8cec1762b8a12149.zip
FreeBSD-src-7238cb10db18f9a1f6fd105e8cec1762b8a12149.tar.gz
Correct minor output bug. When the battery being queried is charging or
the overall discharge rate is 0, mark the battery remaining time as "unknown", not 0. Reported by: Eric Kjeldergaard MFC after: 4 days
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpica/acpi_battery.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c
index 06fd60d..995b380 100644
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -244,6 +244,13 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
battinfo->state = bi[dev_idx].state;
battinfo->rate = bst[dev_idx].rate;
}
+
+ /*
+ * If the queried battery has no discharge rate or is charging,
+ * report that we don't know the remaining time.
+ */
+ if (valid_rate == 0 || (battinfo->state & ACPI_BATT_STAT_CHARGING))
+ battinfo->min = -1;
} else
acpi_reset_battinfo(battinfo);
OpenPOWER on IntegriCloud