summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac/pmu.c
diff options
context:
space:
mode:
authorjhibbits <jhibbits@FreeBSD.org>2011-12-05 00:12:10 +0000
committerjhibbits <jhibbits@FreeBSD.org>2011-12-05 00:12:10 +0000
commit97bfac165ba69eaa279bfa7edc34b55e4cd7840c (patch)
tree70724e611b0160989332cf75f7f006563c76cf2a /sys/powerpc/powermac/pmu.c
parent1a47fa14a87281d147badfb8deb4eaa0d58bbf18 (diff)
downloadFreeBSD-src-97bfac165ba69eaa279bfa7edc34b55e4cd7840c.zip
FreeBSD-src-97bfac165ba69eaa279bfa7edc34b55e4cd7840c.tar.gz
Add a devd notification for closing/opening the lid on PowerBooks and iBooks.
Approved by: nwhitehorn (mentor)
Diffstat (limited to 'sys/powerpc/powermac/pmu.c')
-rw-r--r--sys/powerpc/powermac/pmu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c
index c478179..ebadbef 100644
--- a/sys/powerpc/powermac/pmu.c
+++ b/sys/powerpc/powermac/pmu.c
@@ -701,6 +701,20 @@ pmu_intr(void *arg)
adb_receive_raw_packet(sc->adb_bus,resp[1],resp[2],
len - 3,&resp[3]);
}
+ if (resp[1] & PMU_INT_ENVIRONMENT) {
+ // if the lid was just closed, notify devd.
+ if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) {
+ sc->lid_closed = 1;
+ if (devctl_process_running())
+ devctl_notify("PMU", "lid", "close", NULL);
+ }
+ else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) {
+ // if the lid was just opened, notify devd.
+ if (devctl_process_running())
+ devctl_notify("PMU", "lid", "open", NULL);
+ sc->lid_closed = 0;
+ }
+ }
}
static u_int
OpenPOWER on IntegriCloud