Correct i2c access semantics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello. I am writing a small program to read "DDC" data from a monitor on
the i2c bus. My application is custom so I need to properly init and
program an FPGA before I can access the monitor.

What I am seeing is that if I open() the correct i2c bus, then I ioctl
with I2C_SLAVE to select the right slave, then read(fd, buffer, 0x100) I
can consistently access the correct data.

However, if I only read(fd, buffer, 0x80) (in fact I do not need the
DDC/EDID data above 0x80 for my application), next time I run the
program, it will start reading from offset 0x80 from that device. In
fact, it seems like there is a static index on the i2c reads, that is
not reset when I perform close(), open(), or the program exits.

However, if I do one i2c_smbus_read_byte_data() it will always reset the
offset read to the first byte.

i2c_smbus_read_byte_data(fd, 0);
i = read(fd, data + 1, 0xff);

The code above ALWAYS read the same bytes from the i2c device.

Is this the expected behaviour, or am I missing something? I am using an
older Linux 3.5 in this application.

Thank you
as


--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux