From eb01fc1c7ec09a46a0def6e6f42df10cd8800ae9 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Tue, 15 Jun 2021 15:36:44 +0200 Subject: [PATCH] added debug output to read of I2cComIf --- linux/i2c/I2cComIF.cpp | 8 +++++++- linux/i2c/I2cComIF.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/linux/i2c/I2cComIF.cpp b/linux/i2c/I2cComIF.cpp index 06adf30..ea5cbe6 100644 --- a/linux/i2c/I2cComIF.cpp +++ b/linux/i2c/I2cComIF.cpp @@ -146,10 +146,16 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie, uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data(); - if (read(fd, replyBuffer, requestLen) != static_cast(requestLen)) { + int readLen = read(fd, replyBuffer, requestLen); + + if (readLen != static_cast(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; } diff --git a/linux/i2c/I2cComIF.h b/linux/i2c/I2cComIF.h index 3529bde..17a4167 100644 --- a/linux/i2c/I2cComIF.h +++ b/linux/i2c/I2cComIF.h @@ -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 {