Power Management API for auto-wake in OSX?
Hey, I need to write a program for OSX that will cause my macbook pro to wake up after a certain amount of time of sleeping. SleepX is almost perfect for me, but I want it to only go back to sleep if noone is moving the mouse/hitting the keyboard, etc.... I tried using the approac开发者_StackOverflow社区h in the "wakeFromSleep" example in the Mac power management DDK, but it was unable to find the "Power Management Unit" in my computer, so obviously SleepX is using a different method than the DDK.
Does anyone have any ideas on where I can look to find this API that SleepX is using? Does anyone have suggestions on what software I could use to achieve the end result?
Thank you!
One place to start looking is
nm /Developer/Applications/Utilities/SleepX.app/Contents/MacOS/SleepX
the following lines look relevant
U _IOAllowPowerChange
U _IONotificationPortGetRunLoopSource
U _IOPMSchedulePowerEvent
U _IORegisterForSystemPower
which in turn come from IOPMLib.h
The pmset command makes it easy to schedule wakeups:
pmset schedule wake "07/04/09 20:00:00"
You want IOPMSchedulePowerEvent.
精彩评论