Folks,
I am looking at various implementation of reading edid code.
In one implementation, I see the following:
err = ioctl(fd, I2C_SLAVE, 0x50);
if (err == 0) {
// ok to read.
for(int i=0;i<128;i++) {
buf[i] = i2c_smbus_read_byte_data(fd); // use ioctl to read 1 byte at a time
}
}
In another implementation, I see:
err = ioctl(fd, I2C_SLAVE, 0x50);
if (err == 0) {
usleep(TIMEOUT); // sleep for a brief interval
write(fd, &command, 1); // here, command[0] is 0
usleep(TIMEOUT); // sleep for a brief interval
read(fd, buf, 128);
}
The first implementation is from http://www.polypux.org/projects/read-edid/ and the second one is from libXcm implementation.
I have used the first implementation. I am wondering if the second implementation is acceptable.
Thank you in advance for your help.
Regards,
Peter