added debug output to read of I2cComIf

This commit is contained in:
Jakob Meier 2021-06-15 15:36:44 +02:00
parent 3f6d2b6083
commit eb01fc1c7e
2 changed files with 9 additions and 1 deletions

View File

@ -146,10 +146,16 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie,
uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data();
if (read(fd, replyBuffer, requestLen) != static_cast<int>(requestLen)) {
int readLen = read(fd, replyBuffer, requestLen);
if (readLen != static_cast<int>(requestLen)) {
#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C "
<< "device failed with error code " << errno <<". Description"
<< " of error: " << strerror(errno) << std::endl;
sif::error << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from "
<< requestLen << " bytes" << std::endl;
#endif
i2cDeviceMapIter->second.replyLen = 0;
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -12,6 +12,8 @@
* @brief This is the communication interface for i2c devices connected
* to a system running a linux OS.
*
* @note The xilinx linux kernel does not support to read more than 255 bytes at once.
*
* @author J. Meier
*/
class I2cComIF: public DeviceCommunicationIF, public SystemObject {