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

Regression in QSerialPort since 5.10

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.2
    • 5.10, 5.11, 5.12.4, 5.13.0
    • Serial Port
    • None
    • Windows
    • 4ff9993d9f2e991f2da1885a694d4f3a61c9af73

    Description

      We upgraded from Qt 5.9.0 to Qt 5.13.0 a few weeks ago.

      We have been getting weird behavior during communication of suddenly not receiving any more readyRead() notifications until the port is closed and opened again.

      After spending a few hours tracking down changes in QSerialPort between versions, the culprit is the removal of the following code from QSerialPort::readData(char *data, qint64 maxSize):

       #if defined(Q_OS_WIN32)
          // We need try to start async reading to read a remainder from a driver's queue
          // in case we have a limited read buffer size. Because the read notification can
          // be stalled since Windows do not re-triggered an EV_RXCHAR event if a driver's
          // buffer has a remainder of data ready to read until a new data will be received.
          Q_D(QSerialPort);
          if (d->readBufferMaxSize || d->flowControl == QSerialPort::HardwareControl)
              d->startAsyncRead();
      #elif defined(Q_OS_UNIX)
          // We need try to re-trigger the read notification to read a remainder from a
          // driver's queue in case we have a limited read buffer size.
          Q_D(QSerialPort);
          if (d->readBufferMaxSize && !d->isReadNotificationEnabled())
              d->setReadNotificationEnabled(true);
      #endif
      

      Having readBufferMaxSize == 0 and NoFlowControl, calling startAsyncRead() apparently causes the problem.
      Please revert this change.

      Attachments

        1. console.png
          console.png
          16 kB
        2. qtbug78714.zip
          1.0 kB
        3. Virtual Ports.png
          Virtual Ports.png
          71 kB

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              pro-micron Steffen Mazur
              Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes