Page MenuHomeFreeBSD

i2c(8): clean up and clarify read operation
ClosedPublic

Authored by avg on Sep 12 2017, 7:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 11:10 AM
Unknown Object (File)
Mar 12 2024, 4:31 AM
Unknown Object (File)
Mar 12 2024, 4:31 AM
Unknown Object (File)
Mar 12 2024, 4:31 AM
Unknown Object (File)
Mar 8 2024, 4:59 AM
Unknown Object (File)
Jan 28 2024, 9:29 AM
Unknown Object (File)
Jan 4 2024, 5:52 AM
Unknown Object (File)
Jan 4 2024, 5:52 AM
Subscribers

Details

Summary

The code went to a lot of trouble to issue either a start+stop condition
or a repeated start condition only to follow it with a stop condition
and a read(2) call that issues a new start condition.
So, fix the read in I2C_MODE_REPEATED_START mode by using I2CREAD ioctl
within the running transaction. This obviously requires that the slave
address has the read bit set which was not required before.

Another problem was with width parameter of zero and
I2C_MODE_REPEATED_START mode. In that case we issued a repeated start
without any preceding start.

While here, remove the redundant (unused) argument to I2CSTOP throughout
the program.
Also, clarify the meaning of -w option, especially "-w 0", in the manual
page.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable