Author: jhibbits
Date: Thu Nov 20 03:23:33 2014
New Revision: 274733
URL: https://svnweb.freebsd.org/changeset/base/274733

Log:
  Add support for Power Button PMU events on non-ADB macs, such as aluminum
  PowerBooks.
  
  MFC after:    2 weeks
  Relnotes:     yes

Modified:
  head/sys/powerpc/powermac/pmu.c
  head/sys/powerpc/powermac/pmuvar.h

Modified: head/sys/powerpc/powermac/pmu.c
==============================================================================
--- head/sys/powerpc/powermac/pmu.c     Thu Nov 20 01:55:12 2014        
(r274732)
+++ head/sys/powerpc/powermac/pmu.c     Thu Nov 20 03:23:33 2014        
(r274733)
@@ -734,15 +734,15 @@ pmu_intr(void *arg)
                /* 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);
+                       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;
+                       devctl_notify("PMU", "lid", "open", NULL);
                }
+               if (resp[2] & PMU_ENV_POWER)
+                       devctl_notify("PMU", "Button", "pressed", NULL);
        }
 }
 

Modified: head/sys/powerpc/powermac/pmuvar.h
==============================================================================
--- head/sys/powerpc/powermac/pmuvar.h  Thu Nov 20 01:55:12 2014        
(r274732)
+++ head/sys/powerpc/powermac/pmuvar.h  Thu Nov 20 03:23:33 2014        
(r274733)
@@ -99,6 +99,7 @@
 
 /* Bits from PMU_GET_LID_STATE or PMU_INT_ENVIRONMENT on core99 */
 #define PMU_ENV_LID_CLOSED     0x01    /* The lid is closed */
+#define PMU_ENV_POWER          0x08    /* Power Button pressed */
 
 /* PMU PMU_POWER_EVENTS commands */
 enum {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to