Author: jhibbits Date: Mon Jan 30 22:32:54 2012 New Revision: 230788 URL: http://svn.freebsd.org/changeset/base/230788
Log: MFC r228270,228277: Add a devd notification for closing/opening the lid on PowerBooks and iBooks. Approved by: nwhitehorn (mentor) Modified: stable/9/etc/devd/apple.conf stable/9/sys/powerpc/powermac/pmu.c stable/9/sys/powerpc/powermac/pmuvar.h Directory Properties: stable/9/etc/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/etc/devd/apple.conf ============================================================================== --- stable/9/etc/devd/apple.conf Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/etc/devd/apple.conf Mon Jan 30 22:32:54 2012 (r230788) @@ -11,6 +11,16 @@ notify 0 { }; +# PowerBook and iBook lid close. +notify 0 { + match "system" "PMU"; + match "subsystem" "lid"; + match "type" "close"; + match "notify" "0x0"; + action "shutdown -p now"; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match "system" "PMU"; Modified: stable/9/sys/powerpc/powermac/pmu.c ============================================================================== --- stable/9/sys/powerpc/powermac/pmu.c Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/sys/powerpc/powermac/pmu.c Mon Jan 30 22:32:54 2012 (r230788) @@ -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 Modified: stable/9/sys/powerpc/powermac/pmuvar.h ============================================================================== --- stable/9/sys/powerpc/powermac/pmuvar.h Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/sys/powerpc/powermac/pmuvar.h Mon Jan 30 22:32:54 2012 (r230788) @@ -160,6 +160,7 @@ struct pmu_softc { volatile int sc_autopoll; int sc_batteries; struct cdev *sc_leddev; + int lid_closed; }; struct pmu_battstate { _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"