]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Families/IONDRVSupport/IONDRVFramebuffer.cpp
xnu-124.7.tar.gz
[apple/xnu.git] / iokit / Families / IONDRVSupport / IONDRVFramebuffer.cpp
index 472e54d9ec7efd66872f422a4c09423cd8e3c332..18119f96df432e8c8d68e106d87f75b6d202387a 100644 (file)
@@ -46,6 +46,8 @@
 
 #include <string.h>
 
+#define kAppleAudioVideoJackStateKey   "AppleAudioVideoJackState"
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 class IOATINDRV : public IONDRVFramebuffer
@@ -242,6 +244,12 @@ IOReturn IONDRVFramebuffer::enableController( void )
 
     if( kIOReturnSuccess == err) do {
 
+        // find out about onboard audio/video jack state
+        // OSObject * notify =
+        addNotification( gIOPublishNotification,
+                         resourceMatching(kAppleAudioVideoJackStateKey), 
+                         _videoJackStateChangeHandler, this, 0 );
+
         ignore_zero_fault( true );
        err = checkDriver();
         ignore_zero_fault( false );
@@ -273,6 +281,25 @@ IOReturn IONDRVFramebuffer::enableController( void )
     return( err);
 }
 
+bool IONDRVFramebuffer::_videoJackStateChangeHandler( void * target, void * ref,
+                                                        IOService * resourceService )
+{
+    IONDRVFramebuffer * self = (IONDRVFramebuffer *) target;
+    IOReturn           err;
+    UInt32             jackData;
+
+    OSObject * jackValue = resourceService->getProperty(kAppleAudioVideoJackStateKey);
+    if( !jackValue)
+        return( true );
+
+    jackData = (jackValue == kOSBooleanTrue);
+
+    self->nub->setProperty( kAppleAudioVideoJackStateKey, &jackData, sizeof(jackData) );
+    resourceService->removeProperty(kAppleAudioVideoJackStateKey);
+
+    return( true );
+}
+
 IODeviceMemory * IONDRVFramebuffer::getVRAMRange( void )
 {
     if( vramMemory)