2

I'm trying to communicate with display over ddc/ci using MacOS X function IOI2CSendRequest. All works if i just send "set" command, like set brightness. I see that display receive command, because display change brightness.

But when i'm trying to receive reply from display i receive some garbage. What is correct way for send and receive reply with IOI2CSendRequest?

Here is my current code:

memset(&request, 0, sizeof (request));
request.commFlags = 0;
request.sendAddress = addr << 1;
request.sendTransactionType =  kIOI2CSimpleTransactionType;
request.sendBuffer = (vm_address_t) package;
request.sendBytes = i;
request.replyAddress = (addr << 1) + 1;

request.replyTransactionType = kIOI2CNoTransactionType;
request.replyBuffer = NULL;
request.replyBytes = 0;

kr = IOI2CSendRequest(Display_, kNilOptions, &request);



mysleep(1000);
memset(&request, 0, sizeof (request));
request.commFlags = 0;
request.sendAddress = addr << 1;
request.sendTransactionType =  kIOI2CNoTransactionType;
request.sendBuffer = (vm_address_t)package;
request.sendBytes = 0;
request.replyAddress =  (addr << 1) + 1;
request.replyTransactionType = kIOI2CSimpleTransactionType;
request.replyBuffer = (vm_address_t) buf;
request.replyBytes = 127;   

memset(buf, 0, request.replyBytes);

kr = IOI2CSendRequest(Display_, kNilOptions, &request);

Both kr and request.result equal to kIOReturnSuccess, but no valid data in buf. Sent command is "51 82 01 10 AC", where is AC is checksum.

OS is 10.6.8 (Snow Leopard)

Any idea what is wrong in this code?

4
  • Be careful with Mac OS updates. This code works fine on Mac OS 10.8.3 and 10.7.4, but not works on 10.7.5 and 10.8.2.
    – ramzes2
    Mar 20, 2013 at 13:32
  • This would be more appropriate as a comment. You will earn commenting privileges when you achieve 50 reputation.
    – Ren
    Mar 20, 2013 at 13:52
  • How did you physically connect the device? Jan 21, 2018 at 14:48
  • I have no additional connection, just DVI or HDMI cable.
    – johngull
    Jan 22, 2018 at 14:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.