Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84704

QSerialPort::waitForReadyRead always returns false

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.15.0
    • Serial Port
    • None
    • Windows

    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.

       

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kuzulis Denis Shienkov
            stefano.maghini stefano.maghini
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes