Merge pull request 'UART: fixes for canonical mode' (#12) from mueller/master into master

Reviewed-on: #12
This commit is contained in:
Jakob Meier 2021-06-24 10:41:23 +02:00
commit cd41b6a1f2
1 changed files with 5 additions and 9 deletions

View File

@ -305,10 +305,6 @@ ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie, size_t requestL
std::string deviceFile;
UartDeviceMapIter uartDeviceMapIter;
if(requestLen == 0) {
return RETURN_OK;
}
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
if(uartCookie == nullptr) {
sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl;
@ -318,6 +314,11 @@ ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie, size_t requestL
UartModes uartMode = uartCookie->getUartMode();
deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
if(uartMode == UartModes::NON_CANONICAL and requestLen == 0) {
return RETURN_OK;
}
if (uartDeviceMapIter == uartDeviceMap.end()) {
sif::debug << "UartComIF::requestReceiveMessage: Device file " << deviceFile
<< " not in uart map" << std::endl;
@ -370,11 +371,6 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
if (bytesRead < 0) {
return RETURN_FAILED;
}
else if (bytesRead != static_cast<int>(requestLen)) {
sif::debug << "UartComIF::requestReceiveMessage: Only read " << bytesRead <<
" of " << requestLen << " bytes" << std::endl;
return RETURN_FAILED;
}
else if(bytesRead > 0) {
iter->second.replyLen += bytesRead;
bufferPtr += bytesRead;