* Correct i2c access semantics
@ 2015-05-13 23:01 Alessio Sangalli
0 siblings, 0 replies; only message in thread
From: Alessio Sangalli @ 2015-05-13 23:01 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-05-13 23:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 23:01 Correct i2c access semantics Alessio Sangalli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).