Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PROBLEM IN I2C COMMUNICATION



hi ,


There is one example which demonstrates the use of IOI2CSendRequest for retrieving the EDID information of the Monitor (Display Device). http://darwinsource.opendarwin.org/10.3/IOGraphics-123/tools/itvview.c I have modified this example, so as to set one VCP (Virtual control Panel) feature. This VCP feature is contrast (0x12), as specified by VESA DDC standards. This example will change the contrast of the monitor. /* cc -o /tmp/itvview itvview.c -framework IOKit -framework ApplicationServices -Wall -g */ #include <IOKit/IOKitLib.h> #include <ApplicationServices/ApplicationServices.h> #include <IOKit/i2c/IOI2CInterface.h> #include <assert.h> #include <stdio.h> /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void ContrastTest( IOI2CConnectRef connect ) { kern_return_t kr; IOI2CRequest request; UInt8 data[128]; int i; bzero( &request, sizeof(request) ); request.commFlags = 0; request.sendAddress = 0x6E; request.sendTransactionType = kIOI2CSimpleTransactionType; request.sendBuffer = (vm_address_t) &data[0]; request.sendBytes = 7; data[0] = 0x51; data[1] = 0x84; data[2] = 0x03; data[3] = 0x12; data[4] = 0x64 ; data[5] = 0xF ; data[6] = 0x6E ^ data[0] ^ data[1] ^ data[2] ^ data[3]^ data[4]^ data[5]; request.replyTransactionType = kIOI2CNoTransactionType; request.replyBytes = 0;//128; kr = IOI2CSendRequest( connect, kNilOptions, &request ); printf("/n/n/nKr : %d request : %d",kr, request.result); assert( kIOReturnSuccess == kr ); if( kIOReturnSuccess != request.result) return; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int main( int argc, char * argv[] ) { kern_return_t kr; io_service_t framebuffer, interface; IOOptionBits bus; IOItemCount busCount; framebuffer = CGDisplayIOServicePort(CGMainDisplayID()); { io_string_t path; kr = IORegistryEntryGetPath(framebuffer, kIOServicePlane, path); assert( KERN_SUCCESS == kr ); printf("\nUsing device: %s\n", path); kr = IOFBGetI2CInterfaceCount( framebuffer, &busCount ); assert( kIOReturnSuccess == kr ); for( bus = 0; bus < busCount; bus++ ) { IOI2CConnectRef connect; kr = IOFBCopyI2CInterfaceForBus(framebuffer, bus, &interface); if( kIOReturnSuccess != kr) continue; kr = IOI2CInterfaceOpen( interface, kNilOptions, &connect ); IOObjectRelease(interface); assert( kIOReturnSuccess == kr ); if( kIOReturnSuccess != kr) continue; ContrastTest(connect); IOI2CInterfaceClose( connect, kNilOptions ); } } exit(0); return(0); } If you run this code on any Mac machine other than Intel based, it is working fine. But with my Intel Mac mini (Intel GMA 950 graphics card), the IOI2CSendRequest is returning kIOReturnNotResponding error in the IOI2CRequest structure. Follwing code also works on the intel machines with nvidia graphics card... only the problemis with intel GMA 950 graphic card..plz suggest me why this is happening thank you AMBER MAHESHWARI 09312015674 _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-drivers mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.