When no estimate of battery minutes_left can be made, apm should

return a value of 0.
This commit is contained in:
plunky 2007-10-27 19:51:29 +00:00
parent eff8fdc9d1
commit 60822ed9d3
2 changed files with 8 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_apm.c,v 1.10 2007/07/05 13:53:21 xtraeme Exp $ */
/* $NetBSD: acpi_apm.c,v 1.11 2007/10/27 19:51:29 plunky Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_apm.c,v 1.10 2007/07/05 13:53:21 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_apm.c,v 1.11 2007/10/27 19:51:29 plunky Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -289,7 +289,7 @@ acpiapm_get_powstat(void *opaque, u_int batteryid,
(void)memset(pinfo, 0, sizeof(*pinfo));
pinfo->ac_state = APM_AC_UNKNOWN;
pinfo->minutes_valid = 0;
pinfo->minutes_left = 0xffff; /* unknown */
pinfo->minutes_left = 0;
pinfo->batteryid = 0;
pinfo->nbattery = 0; /* to be incremented as batteries are found */
pinfo->battery_flags = 0;

View File

@ -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)