Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In the most recent version of OSX Lion, how do you wake up the machine from display sleep? This is in response to network activity.

In 10.7.3 this was possible with the following call:

IOPMAssertionID id = 0;
IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
                            kIOPMAssertionLevelOn, reason, &id)

However, this does not work in 10.7.4. What can be done instead?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

I have not yet tested the performance implications nor the interaction with the idle timer itself, but:

io_registry_entry_t regEntry = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler");
if (regEntry != MACH_PORT_NULL) {
        IORegistryEntrySetCFProperty(regEntry, CFSTR("IORequestIdle"), kCFBooleanFalse);
        IOObjectRelease(regEntry);
}

works in 10.7.4 to wake the screen from idle.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...