problem in i2c communication
problem in i2c communication
- Subject: problem in i2c communication
- From: "amber maheshwari" <email@hidden>
- Date: Tue, 17 Oct 2006 09:37:55 +0530
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
*/
- Ignored:
#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 device id :27a2), 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.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden