diff --git a/common/gpio/gpioDefinitions.h b/common/gpio/gpioDefinitions.h index b56a476..710b2e2 100644 --- a/common/gpio/gpioDefinitions.h +++ b/common/gpio/gpioDefinitions.h @@ -61,7 +61,7 @@ public: virtual~ GpioBase() {}; - /* Can be used to cast GpioBase to a concrete child implementation */ + // Can be used to cast GpioBase to a concrete child implementation gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; std::string consumer; gpio::Direction direction = gpio::Direction::IN; @@ -70,13 +70,21 @@ public: class GpiodRegular: public GpioBase { public: - GpiodRegular(): GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), - gpio::Direction::IN, 0) {}; + GpiodRegular() : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), gpio::Direction::IN, 0) { + } + ; GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, - gpio::Direction direction_, int initValue_): + gpio::Direction direction_, int initValue_) : GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), - chipname(chipname_), lineNum(lineNum_) {} + chipname(chipname_), lineNum(lineNum_) { + } + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0), + chipname(chipname_), lineNum(lineNum_) { + } std::string chipname; int lineNum = 0; struct gpiod_line* lineHandle = nullptr; 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 {