Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi * Reintroduce a state variable. From njoly@.
details: https://anonhg.NetBSD.org/src/rev/d358a26d7d24
branches: trunk
changeset: 751079:d358a26d7d24
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Jan 24 11:32:13 2010 +0000
description:
* Reintroduce a state variable. From njoly@.
* Always mark the charge state sensor as valid.
diffstat:
sys/dev/acpi/acpi_bat.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diffs (76 lines):
diff -r b015d829b950 -r d358a26d7d24 sys/dev/acpi/acpi_bat.c
--- a/sys/dev/acpi/acpi_bat.c Sun Jan 24 11:14:04 2010 +0000
+++ b/sys/dev/acpi/acpi_bat.c Sun Jan 24 11:32:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_bat.c,v 1.77 2010/01/23 15:06:47 jruoho Exp $ */
+/* $NetBSD: acpi_bat.c,v 1.78 2010/01/24 11:32:13 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.77 2010/01/23 15:06:47 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.78 2010/01/24 11:32:13 jruoho Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -152,6 +152,7 @@
envsys_data_t sc_sensor[ACPIBAT_COUNT];
kmutex_t sc_mutex;
kcondvar_t sc_condvar;
+ int sc_present;
};
static const char * const bat_hid[] = {
@@ -233,6 +234,7 @@
aprint_normal(": ACPI Battery\n");
sc->sc_node = aa->aa_node;
+ sc->sc_present = 0;
mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_NONE);
cv_init(&sc->sc_condvar, device_xname(self));
@@ -498,6 +500,7 @@
sc->sc_sensor[ACPIBAT_VOLTAGE].value_cur = val;
sc->sc_sensor[ACPIBAT_VOLTAGE].state = ACPIBAT_VAL_ISVALID(val);
+ sc->sc_sensor[ACPIBAT_CHARGE_STATE].state = ENVSYS_SVALID;
sc->sc_sensor[ACPIBAT_CHARGE_STATE].value_cur =
ENVSYS_BATTERY_CAPACITY_NORMAL;
@@ -552,6 +555,8 @@
}
}
+ sc->sc_present = rv;
+
mutex_exit(&sc->sc_mutex);
}
@@ -566,9 +571,13 @@
rv = acpibat_get_sta(dv);
- if (rv > 0)
+ if (rv > 0) {
+
+ if (sc->sc_present == 0)
+ acpibat_get_info(dv);
+
acpibat_get_status(dv);
- else {
+ } else {
i = (rv < 0) ? 0 : ACPIBAT_DCAPACITY;
while (i < ACPIBAT_COUNT) {
@@ -577,6 +586,8 @@
}
}
+ sc->sc_present = rv;
+
microtime(&sc->sc_lastupdate);
cv_broadcast(&sc->sc_condvar);
mutex_exit(&sc->sc_mutex);
Home |
Main Index |
Thread Index |
Old Index