Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2014 03:23:34 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274733 - head/sys/powerpc/powermac
Message-ID:  <201411200323.sAK3NYR6092533@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411200323.sAK3NYR6092533>