我想通過使用MacOS X函數IOI2CSendRequest的ddc/ci進行顯示。 所有作品,如果我只是發送「設置」命令,如設置亮度。我看到顯示器接收命令,因爲顯示器會改變亮度。Mac OS X上的IOKit中的i2c通信
但是,當我試圖從顯示器收到回覆我收到一些垃圾。用IOI2CSendRequest發送和接收答覆的正確方法是什麼?
這裏是我當前的代碼:
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);
兩個KR和request.result等於kIOReturnSuccess,但沒有buf中的有效數據。 發送命令是「51 82 01 10 AC」,其中AC是校驗和。
OS 10.6.8是(雪豹)
任何想法是錯誤的代碼?
您是如何物理連接設備的? – 2018-01-21 14:48:10
我沒有額外的連接,只有DVI或HDMI電纜。 – johngull 2018-01-22 14:50:44