From 7724fdc389c48fc3c52ba94c7c7d9fe4530f1996 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Mon, 17 May 2021 14:02:27 +0200 Subject: [PATCH 1/2] input gpio regular constructor --- common/gpio/gpioDefinitions.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/common/gpio/gpioDefinitions.h b/common/gpio/gpioDefinitions.h index 66c0b00..7cba1a4 100644 --- a/common/gpio/gpioDefinitions.h +++ b/common/gpio/gpioDefinitions.h @@ -66,13 +66,21 @@ public: class GpiodRegular: public GpioBase { public: - GpiodRegular(): GpioBase(gpio::GpioTypes::GPIOD_REGULAR, std::string(), - gpio::Direction::IN, 0) {}; + GpiodRegular() : + GpioBase(gpio::GpioTypes::GPIOD_REGULAR, std::string(), gpio::Direction::IN, 0) { + } + ; GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, - gpio::Direction direction_, int initValue_): - GpioBase(gpio::GpioTypes::GPIOD_REGULAR, consumer_, direction_, initValue_), - chipname(chipname_), lineNum(lineNum_) {} + gpio::Direction direction_, int initValue_) : + GpioBase(gpio::GpioTypes::GPIOD_REGULAR, consumer_, direction_, initValue_), chipname( + chipname_), lineNum(lineNum_) { + } + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) : + GpioBase(gpio::GpioTypes::GPIOD_REGULAR, consumer_, gpio::Direction::IN, 0), chipname( + chipname_), lineNum(lineNum_) { + } std::string chipname; int lineNum = 0; struct gpiod_line* lineHandle = nullptr; From eb01fc1c7ec09a46a0def6e6f42df10cd8800ae9 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Tue, 15 Jun 2021 15:36:44 +0200 Subject: [PATCH 2/2] 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 {