Module Name:    src
Committed By:   jruoho
Date:           Sat Apr  3 16:29:22 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_bat.c

Log Message:
Update the limits when a change from absent to present is detected.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/acpi/acpi_bat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.97 src/sys/dev/acpi/acpi_bat.c:1.98
--- src/sys/dev/acpi/acpi_bat.c:1.97	Fri Mar 26 15:51:55 2010
+++ src/sys/dev/acpi/acpi_bat.c	Sat Apr  3 16:29:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.97 2010/03/26 15:51:55 pooka Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.98 2010/04/03 16:29:22 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.97 2010/03/26 15:51:55 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.98 2010/04/03 16:29:22 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -590,9 +590,17 @@
 
 	rv = acpibat_get_sta(dv);
 
-	if (rv > 0)
+	if (rv > 0) {
 		acpibat_get_info(dv);
-	else {
+
+		/*
+		 * If the status changed, update the limits.
+		 */
+		if (sc->sc_present == 0 &&
+		    sc->sc_sensor[ACPIBAT_CAPACITY].value_max > 0)
+			sysmon_envsys_update_limits(sc->sc_sme,
+			    &sc->sc_sensor[ACPIBAT_CAPACITY]);
+	} else {
 		i = (rv < 0) ? 0 : ACPIBAT_DVOLTAGE;
 
 		while (i < ACPIBAT_COUNT) {

Reply via email to