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

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

macos - How do I wake from display sleep in OSX 10.7.4?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...