diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-02-17 07:33:41 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-02-17 07:33:41 +0000 |
commit | ae6409d0fe46a0f288f32d91e7e6d8e88def3c53 (patch) | |
tree | 49b0b07de8c87efdb792045ff659ee5897b4bbc0 /sys/dev | |
parent | a19add1fe614e08299a3d455cb46a5b08f97560f (diff) |
Add sensors output. This is for debug only and will be removed later.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpiac.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c index 95877874bef..48b4d5106ef 100644 --- a/sys/dev/acpi/acpiac.c +++ b/sys/dev/acpi/acpiac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiac.c,v 1.4 2006/02/17 00:46:54 jordan Exp $ */ +/* $OpenBSD: acpiac.c,v 1.5 2006/02/17 07:33:40 marco Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -28,6 +28,8 @@ #include <dev/acpi/amltypes.h> #include <dev/acpi/dsdt.h> +#include <sys/sensors.h> + int acpiac_match(struct device *, void *, void *); void acpiac_attach(struct device *, struct device *, void *); @@ -41,8 +43,11 @@ struct acpiac_softc { struct aml_node *sc_devnode; int sc_ac_stat; + + struct sensor sens[1]; /* XXX debug only */ }; +void acpiac_refresh(void *); int acpiac_getsta(struct acpiac_softc *); struct cfattach acpiac_ca = { @@ -89,6 +94,26 @@ acpiac_attach(struct device *parent, struct device *self, void *aux) printf("AC unit in unknown state"); printf("\n"); + + strlcpy(sc->sens[0].device, DEVNAME(sc), sizeof(sc->sens[0].device)); + strlcpy(sc->sens[0].desc, "power supply", sizeof(sc->sens[2].desc)); + sc->sens[0].type = SENSOR_INDICATOR; + sensor_add(&sc->sens[0]); + sc->sens[0].value = sc->sc_ac_stat; + + if (sensor_task_register(sc, acpiac_refresh, 10)) + printf(", unable to register update task\n"); +} + +/* XXX this is for debug only, remove later */ +void +acpiac_refresh(void *arg) +{ + struct acpiac_softc *sc = arg; + + acpiac_getsta(sc); + + sc->sens[0].value = sc->sc_ac_stat; } int |