From adbece25aa14521e25b0a78f4024624a7ac0a7bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Oct 2022 19:18:25 +0200 Subject: [PATCH] add code to get frame, parity and overrun errors --- linux/devices/ScexUartReader.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 2af26781..b2138999 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -68,6 +68,18 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { dleParser.confirmBytesRead(bytesRead); } } + // TODO: Move this to some FSFW helper function + /* + serial_icounter_struct uartErrors{}; + int ioctlres = ioctl(serialPort, TIOCGICOUNT, &uartErrors); + if (uartErrors.parity > 0) { + sif::warning << "Parity error. Current count: " << uartErrors.parity << std::endl; + } + if (uartErrors.overrun > 0) { + sif::warning << "Overrun error. Current count: " << uartErrors.overrun << std::endl; + } + */ + TaskFactory::delayTask(400); } else if (bytesRead < 0) { sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno @@ -132,7 +144,6 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl; } //#endif - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl;