I’m trying to communicate with an I2C chip which returns the length of the bytes to be read in the first byte of the transaction. This is fairly straightforward on most primitive microcontrollers.
But for the life of me, I cannot figure out how to do this on Linux. A “read” always wants to put a stop bit after the transaction. I see “I2C_M_NOSTART” which is probably what I need for the data bytes, but I don’t see a corresponding I2C_M_NOSTOP which is what I need for the first byte.
Sounds like another goofy TI I2C (USB-C part?) slave interface.
Two thoughts …
Is the part smart enough to send a “STOP” after it has transferred the (variable) length read? Or does it just keep going?
If the part is smart enough to send a stop when it is done, wrap an error handler around a [equal to maximum} byte read transfer, and let it exit gracefully on the error condition when the part sends a “premature” stop.
Then process what it gave you.
Worst case, you always read the full maximum length buffer and process according to the initial byte length given.
The Linux SMBus drivers do not include the bytle length in the read function call.
The SMBus spec does describe a block read transaction byte length.
Have you tried to use the Linux drivers to see if they handle the length byte internal to the function call?
Or …
Otherwise try a maximum length read, and see what happens.