From 899123f9ce3e4b9aff707e547d29af67ad6bef2b Mon Sep 17 00:00:00 2001 From: Michael Knudsen Date: Thu, 25 Jan 2007 21:31:39 +0000 Subject: 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. --- sys/dev/acpi/acpidock.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys') 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 * @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -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"); -- cgit v1.2.3