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

serialnmea plugin does not work with external serial device

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.15.0 Beta2, 5.15
    • 5.14.1, 5.15
    • Location
    • None
    • Linux Ubuntu 18.04
    • Linux/X11, macOS
    • c3662119b64e5afa3af737cfa0cb6b55f8c1bbb2 d97b13fc2ccd38dd6d38190722d2207bb26315b5 (qt/qtlocation/5.15)

    Description

      Tried to use Waveshare SIM7000 as NMEA device with serialnmea QML plugin. When connected and properly enabled, device is /dev/ttyUSB1

      Minimal QML application with
      PositionSource { name: "serialnmea" PluginParameter { name: "serialnmea.serial_port"; value: "/dev/ttyUSB1" }} (attached)

      Verified that /dev/ttyUSB1 sends continuously proper nmea data, port ignores serial speed setting.

      Application output:

      QML debugging is enabled. Only use this in a safe environment.
      QObject::connect(QSerialPort, Unknown): invalid nullptr parameter
      qml: Position source serialnmea ready
      ^C
      
      

      When run with QT_FATAL_WARNINGS=1 under QtCreator, the stack trace when aborted is

      1  __GI_raise                                                                   raise.c                                      51   0x7ffff5d47e97 
      2  __GI_abort                                                                   abort.c                                      79   0x7ffff5d49801 
      3  qt_message_fatal                                                             qlogging.cpp                                 1894 0x7ffff672b123 
      4  QMessageLogger::warning                                                      qlogging.cpp                                 660  0x7ffff672b123 
      5  QObjectPrivate::connectImpl                                                  qobject.cpp                                  4991 0x7ffff695c2e9 
      6  QObject::connectImpl                                                         qobject.cpp                                  4970 0x7ffff695c4e8 
      7  QObjectPrivate::connect<void (QIODevice:: *)(), void (QIOPipePrivate:: *)()> qobject_p.h                                  462  0x7fffd0848dd6 
      8  QIOPipePrivate::QIOPipePrivate                                               qiopipe.cpp                                  60   0x7fffd0848dd6 
      9  QIOPipe::QIOPipe                                                             qiopipe.cpp                                  131  0x7fffd0849054 
      10 IODeviceContainer::serial                                                    qgeopositioninfosourcefactory_serialnmea.cpp 79   0x7fffd0845147 
      11 NmeaSource::NmeaSource                                                       qgeopositioninfosourcefactory_serialnmea.cpp 164  0x7fffd0840cb3 
      12 QGeoPositionInfoSourceFactorySerialNmea::positionInfoSourceWithParameters    qgeopositioninfosourcefactory_serialnmea.cpp 254  0x7fffd0841505 
      13 createSource_real                                                            qgeopositioninfosource.cpp                   338  0x7fffd0c98cde 
      14 QGeoPositionInfoSource::createSource                                         qgeopositioninfosource.cpp                   411  0x7fffd0c999b0 
      15 QDeclarativePositionSource::tryAttach                                        qdeclarativepositionsource.cpp               207  0x7fffd0f1475b 
      16 QDeclarativePositionSource::componentComplete                                qdeclarativepositionsource.cpp               861  0x7fffd0f14cd2 
      17 QQmlObjectCreator::finalize                                                  qqmlobjectcreator.cpp                        1410 0x7ffff71426d2 
      18 QQmlComponentPrivate::complete                                               qqmlcomponent.cpp                            969  0x7ffff70d0917 
      19 QQmlComponentPrivate::completeCreate                                         qqmlcomponent.cpp                            1005 0x7ffff70d0a32 
      20 QQmlComponent::create                                                        qqmlcomponent.cpp                            811  0x7ffff70d0429 
      21 QQmlApplicationEnginePrivate::finishLoad                                     qqmlapplicationengine.cpp                    134  0x7ffff7137f1c 
      22 QQmlApplicationEnginePrivate::startLoad                                      qqmlapplicationengine.cpp                    118  0x7ffff71380ae 
      23 QQmlApplicationEngine::load                                                  qqmlapplicationengine.cpp                    264  0x7ffff71380dd 
      24 main                                                                         main.cpp                                     17   0x5555555554db  

      Brief examination of the code reveals that the issue is within the constructor of the QIOPipe class: the QIOPipePrivate does QObjectPrivate::connect which internally accesses QIOPipePrivate::q_ptr but it is still null as the surrounding QObject constructor is not yet run.
      The issue can reproduced by setting the port name to any valid unallocated tty, like /dev/ttyS1 on Linux or /dev/ttys000 on MacOs 

      Attachments

        1. main.qml
          0.4 kB
        2. qt.patch
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jty9 Jyrki Yli-Nokari
            jty9 Jyrki Yli-Nokari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes