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

QSerialPort stops working on Linux after 0 Bytes are available on port



    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.4.1
    • Serial Port
    • None
    • ubuntu 14.04.3 LTS
      Release 14.04



      I am sorry for reporting a potential bug. Maybe this bug also causes other bugs which have already been reported.

      The QT terminal example does only show serial line data for a short period of time after connect. I use a Prolific USB Serial Line interface (GPS Receiver) at 38400 baud.
      I verified the correct function of the GPS receiver by using the minicom terminal emulator. In that case data is permanently displayed and not stopping to be received.

      I temporarily added the serialport code to the terminal project in order to better debug it. Thereby I found a possible problem in qserialport_unix.cpp, which at least in this constellation causes a problem.

      In readNotification() Line723 readBytes is sometimes 0 and a resourceError is reported by decodeSystemError at the same time, This then results in setReadNotification to be set to false, which prevents further processing of incoming data, causing the serial line input to fail from then onwards.

      After connect the first errors reported are unknown error caused by errno == 3
      Later on ResourceError is reported caused by errno == EAGAIN

      I am not quite sure if EAGAIN is the normal case when no data is currently available at the serial line port. Perhaps this situation should not be reported as resourceError but ignored instead.

      By the way, if the USB serial line adapter is disconnected, then errno == ENOENT after some time which is corectly reported as deviceNotFoundError by decodeSystemError(). Due to the fact that any error != ResourceError is converted to ReadError, the disconnection is not distinguished from other errors. I think it might be better to report all possible errors by differnt errorcodes, but this is of less importance.


        Issue Links

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



              kuzulis Denis Shienkov
              frank12385 Frank Ziegler
              0 Vote for this issue
              2 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes