Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.0
-
None
Description
QSerialPort::waitForReadyRead always returns false even if bytes are available to be read.
Additional weird fact is that if you call QIODevice::readAll to retrieve the bytes you get nothing, while if you call QSerialPort::waitForReadyRead ignoring the return code followed by QIODevice::readAll you actually get the bytes.
To clarify, the following code DOES NOT WORK because execution never enters the block
if (m_serialPort->waitForReadyRead(TOUT_MS))
{
buff.append(m_serialPort->readAll());
}
The following code DOES NOT WORK as well
buff.append(m_serialPort->readAll());
To make things work you have to do
m_serialPort->waitForReadyRead(TOUT_MS))
buff.append(m_serialPort->readAll());
It seems that calling waitForReadyRead triggers some mechanism that make things work.