Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Inconsistent behavior of QSerialPort on Debian
Forum Updated to NodeBB v4.3 + New Features

Inconsistent behavior of QSerialPort on Debian

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtserialportlinuxescpos
23 Posts 3 Posters 8.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #11

    From your description, are you opening the same port 3 times ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hjunior
      wrote on last edited by Hjunior
      #12

      No friend they use base same class. The instances are set to use DIFFERENT PORTS as ttyS1,ttyS4,ttyS6

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #13

        All of them physical ports of your computer or converter like usb to serial ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        H 1 Reply Last reply
        0
        • SGaistS SGaist

          All of them physical ports of your computer or converter like usb to serial ?

          H Offline
          H Offline
          Hjunior
          wrote on last edited by
          #14

          @SGaist Yes all of them are phsical ports of my computer. NO usb to serial.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #15

            Does it also happen if you change devices e.g. exchange the devices from ttyS1 and ttyS6.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            H 1 Reply Last reply
            0
            • SGaistS SGaist

              Does it also happen if you change devices e.g. exchange the devices from ttyS1 and ttyS6.

              H Offline
              H Offline
              Hjunior
              wrote on last edited by
              #16

              @SGaist No difference.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #17

                Does the devies need the DTR to be set ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                H 1 Reply Last reply
                0
                • SGaistS SGaist

                  Does the devies need the DTR to be set ?

                  H Offline
                  H Offline
                  Hjunior
                  wrote on last edited by
                  #18

                  @SGaist Yes the device uses Hardware flow control and in the technical manual says it uses DTR/DSR.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #19

                    Silly question but, did you set DTR in your application ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      Hjunior
                      wrote on last edited by
                      #20

                      Hello again,

                      I finally figured out how this occurs.

                      BaseSerialDevice.cpp

                      class BaseSerialDevice : public QObject
                      {
                          Q_OBJECT
                      ....
                      protected:
                          QSerialPort *serial;
                      ....
                      

                      Problematic.cpp

                      class Problematic : public BaseSerialDevice
                      {
                          Q_OBJECT
                      ...
                      

                      MainWindow.h

                      ...
                      private:
                          Problematic worksLikeACharm;
                      

                      Everything works as expected if defined as a NON-POINTER but if;
                      MainWindow.h

                      ...
                      private:
                          Problematic* notWorksSo;
                      

                      then in MainWindow.cpp's constructor:

                      notWorksSo = new Problematic(parent()); 
                      or 
                      notWorksSo = new Problematic(NULL); 
                      or 
                      notWorksSo = new Problematic;
                      

                      the problem occurs as defined at the start of this topic. And same situation occurs if we use QSocket as same architecture.

                      I tested it from scratch at least 6 times. Im sure of that case.

                      And Cant believe and cant understand why?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #21

                        And if you build it with Problematic(this) ?

                        When you don't pass it a parent, do you delete it in the destructor of your MainWindow ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        H 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          And if you build it with Problematic(this) ?

                          When you don't pass it a parent, do you delete it in the destructor of your MainWindow ?

                          H Offline
                          H Offline
                          Hjunior
                          wrote on last edited by
                          #22

                          @SGaist Hi.

                          I am tried with Problematic(this) no change. In case of no parent arg i tried with delete, but nothing changed.

                          I tried making it static as
                          MainWindow.h

                          static Problematic* notWorksSo;
                          

                          MainWindow.cpp

                          Problematic* MainWindow::notWorksSo = 0;
                          

                          then in constructor

                          notWorksSo = new Problematic(this); 
                          

                          NOTHING CHANGED.

                          Any ideas?

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #23

                            Without seeing the implementation of these classes I can't tell.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved