Update FSFW #13

Merged
meierj merged 26 commits from mueller/update-fsfw into eive/develop 2021-09-17 07:55:59 +02:00
Showing only changes of commit afd375a7f8 - Show all commits

View File

@ -1,6 +1,7 @@
#include "fsfw_hal/linux/uart/UartComIF.h" #include "UartComIF.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw_hal/linux/utility.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include <cstring> #include <cstring>
@ -353,12 +354,13 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
size_t maxReplySize = uartCookie.getMaxReplyLen(); size_t maxReplySize = uartCookie.getMaxReplyLen();
int fd = iter->second.fileDescriptor; int fd = iter->second.fileDescriptor;
auto bufferPtr = iter->second.replyBuffer.data(); auto bufferPtr = iter->second.replyBuffer.data();
iter->second.replyLen = 0;
do { do {
size_t allowedReadSize = 0; size_t allowedReadSize = 0;
if(currentBytesRead >= maxReplySize) { if(currentBytesRead >= maxReplySize) {
// Overflow risk. Emit warning, trigger event and break. If this happens, // Overflow risk. Emit warning, trigger event and break. If this happens,
// the reception buffer is not large enough or data is not polled often enough. // the reception buffer is not large enough or data is not polled often enough.
#if OBSW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!"
<< std::endl; << std::endl;
@ -376,8 +378,21 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
bytesRead = read(fd, bufferPtr, allowedReadSize); bytesRead = read(fd, bufferPtr, allowedReadSize);
if (bytesRead < 0) { if (bytesRead < 0) {
// EAGAIN: No data available in non-blocking mode
if(errno != EAGAIN) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::handleCanonicalRead: read failed with code" <<
errno << ": " << strerror(errno) << std::endl;
#else
sif::printWarning("UartComIF::handleCanonicalRead: read failed with code %d: %s\n",
errno, strerror(errno));
#endif
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
}
else if(bytesRead > 0) { else if(bytesRead > 0) {
iter->second.replyLen += bytesRead; iter->second.replyLen += bytesRead;
bufferPtr += bytesRead; bufferPtr += bytesRead;