Reputation: 7050
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 approach 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!
Upvotes: 1
Views: 1071
Reputation: 85105
The pmset command makes it easy to schedule wakeups:
pmset schedule wake "07/04/09 20:00:00"
Upvotes: 1
Reputation: 70775
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
Upvotes: 1