Invoke desktopMode from kext
Invoke desktopMode from kext
- Subject: Invoke desktopMode from kext
- From: Benjamin Burke <email@hidden>
- Date: Mon, 27 Jul 2009 10:14:54 -0400
Hi,
I wasn't sure if I should post this to this list or darwin-drivers.
I'm trying to write a program that will invoke desktopMode on a
macbook without having to sleep the machine. More specifically, I
want to be able to plug in an external display to my machine, then run
a program to have the system disable the internal display without
closing the lid or putting the system to sleep. Ideally I'd also like
to be able to reenable the internal display on demand.
My guess is that I'll need to write a kernel extension to enable a
userland program to do this. Because this is being used in a
controlled environment I'm ok with using unpublished APIs, such as
those in the IOFramebufferPrivate header. Even so, I'm having trouble
getting the job done from my kext. I've tried calling the
IOFramebuffer::clamshellEnable( -1 ) static method but it has no
apparent effect. I've also tried sending the IOPMrootDomain power
notifications such as kIOPMEnableClamshell | kIOPMSetDesktopMode |
kIOPMSetValue but that also had no apparent effect.
I have also tried directly addressing services in the IORegistry. For
example, this seems to disable ALL displays attached to the system
even though according to output from IOLog it's only being called on
the internal display.
displayList =
getMatchingServices(serviceMatching("IOBacklightDisplay"));
if (displayList) {
IOService *obj = NULL;
while( (obj = (IOService *) displayList->getNextObject()) ) {
display = OSDynamicCast(IOBacklightDisplay, obj);
if(display && (display->getProperty("IODisplayGUID") != 0)) {
display->stop(this);
}
}
displayList->release();
displayList = NULL;
}
This next approach seems to work as it turns off the internal display,
but it stays available and can be seen in the "Arrangement" section of
the displays system preference pane.
bufferList = getMatchingServices(serviceMatching("IOFramebuffer"));
if (bufferList) {
IOService *obj = NULL;
while( (obj = (IOService *) bufferList->getNextObject()) ) {
buffer = OSDynamicCast(IOFramebuffer, obj);
if(buffer && (buffer->getProperty("AAPL,boot-display") != 0)) {
buffer->setPowerState(0, this); // kinda worked
}
}
displayList->release();
displayList = NULL;
}
Any suggestions on how to do this? I'm obviously a bit lost.
Regards,
Ben Burke
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden