Add support for Power Button PMU events on non-ADB macs, such as aluminum

PowerBooks.

MFC after:	2 weeks
Relnotes:	yes
This commit is contained in:
jhibbits 2014-11-20 03:23:33 +00:00
parent d92ed3c4d8
commit a8f71d6bc2
2 changed files with 5 additions and 4 deletions

View File

@ -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);
}
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);
}
}

View File

@ -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 {