diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2007-01-25 21:31:39 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2007-01-25 21:31:39 +0000 |
commit | 899123f9ce3e4b9aff707e547d29af67ad6bef2b (patch) | |
tree | 5b7c32fa3b0b2b18e004f621650cee5c3aa69863 /sys/dev/acpi | |
parent | 9a7efb7e6f5c479319cc442aba8dbb69ad560406 (diff) |
Install an indicator sensor to show if we're docked or not.
Note that right now status appears to not be detected correctly on all
machines, but let's expose what we think we know.
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpidock.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpidock.c b/sys/dev/acpi/acpidock.c index be2fe26f3ed..f2bab7debc9 100644 --- a/sys/dev/acpi/acpidock.c +++ b/sys/dev/acpi/acpidock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidock.c,v 1.4 2007/01/25 21:26:06 mk Exp $ */ +/* $OpenBSD: acpidock.c,v 1.5 2007/01/25 21:31:38 mk Exp $ */ /* * Copyright (c) 2006,2007 Michael Knudsen <mk@openbsd.org> * @@ -19,6 +19,7 @@ #include <sys/systm.h> #include <sys/device.h> #include <sys/malloc.h> +#include <sys/sensors.h> #include <machine/bus.h> @@ -92,6 +93,15 @@ acpidock_attach(struct device *parent, struct device *self, void *aux) acpidock_docklock(sc, 0); } + strlcpy(sc->sc_sensdev.xname, DEVNAME(sc), + sizeof(sc->sc_sensdev.xname)); + strlcpy(sc->sc_sens[0].desc, "docked", + sizeof(sc->sc_sens[0].desc)); + sc->sc_sens[0].type = SENSOR_INDICATOR; + sensor_attach(&sc->sc_sensdev, &sc->sc_sens[0]); + sensordev_install(&sc->sc_sensdev); + sc->sc_sens[0].value = sc->sc_docked; + aml_register_notify(sc->sc_devnode->parent, aa->aaa_dev, acpidock_notify, sc, ACPIDEV_NOPOLL); @@ -241,6 +251,7 @@ acpidock_notify(struct aml_node *node, int notify_type, void *arg) } acpidock_status(sc); + sc->sc_sens[0].value = sc->sc_docked; dnprintf(5, "acpidock_notify: status %s\n", sc->sc_docked == ACPIDOCK_STATUS_DOCKED ? "docked" : "undocked"); |