summaryrefslogtreecommitdiff
path: root/usr.sbin/apm
diff options
context:
space:
mode:
authorplunky <plunky@NetBSD.org>2007-10-27 19:51:29 +0000
committerplunky <plunky@NetBSD.org>2007-10-27 19:51:29 +0000
commit60822ed9d3edc08ea9c992a1caa5691eb906bcf5 (patch)
treee483dd163f50a0eacd8b25787543100f0be08313 /usr.sbin/apm
parenteff8fdc9d11b0f86e4273893c02b6cb463329bd4 (diff)
When no estimate of battery minutes_left can be made, apm should
return a value of 0.
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r--usr.sbin/apm/apm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index ad16f199a21..1bfd67d39d0 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: apm.c,v 1.17 2006/09/23 22:06:42 elad Exp $ */
+/* $NetBSD: apm.c,v 1.18 2007/10/27 19:51:30 plunky Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -279,17 +279,14 @@ main(int argc, char *argv[])
switch (action) {
case GETSTATUS:
printval:
- /*
- * default unknown value for minutes_left, from
- * sys/dev/acpi/acpi_apm.c
- */
- if (api->minutes_left == 0xffff)
- domin = FALSE;
-
if (verbose) {
if (dobstate)
printf("Battery charge state: %s\n",
battstate(api->battery_state));
+
+ if (dopct && domin && api->minutes_left == 0)
+ domin = FALSE;
+
if (dopct || domin) {
printf("Battery remaining: ");
if (dopct)