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. Multi serial port application
Qt 6.11 is out! See what's new in the release blog

Multi serial port application

Scheduled Pinned Locked Moved Unsolved General and Desktop
49 Posts 5 Posters 55.1k 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.
  • V Offline
    V Offline
    veera
    wrote on last edited by
    #16

    @mrjj ,
    just now declared a QSerialPort as data members of the dialog class in dialog.h still also i am getting same error...

    here is the declaration of the QSerialPort

    #ifndef DIALOG_H
    #define DIALOG_H

    #include <QDialog>
    #include <stdio.h>
    #include <QtSerialPort/QSerialPort>
    
    
    namespace Ui {
    class Dialog;
    }
    
    class Dialog : public QDialog
    {
        Q_OBJECT
    
    public:
        QSerialPort serial;
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #17

      Super
      but what error ?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        veera
        wrote on last edited by
        #18

        can not able to open the serial port..what was the type its receiving whether its ttyS4 or /dev/ttyS4?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          veera
          wrote on last edited by
          #19

          @mrjj ,
          I am directly assigning the portname from gui qcombox is it correct way for accessing the port name ?

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #20

            Hi
            normally its ttyS4
            for
            serial->setPortName(p.name);

            Did you see the sample
            http://doc.qt.io/qt-5/qtserialport-terminal-example.html

            Its available directly in Creator and you can use to test.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              veera
              wrote on last edited by
              #21

              yes i have refer that example only.....

              1 Reply Last reply
              0
              • V Offline
                V Offline
                veera
                wrote on last edited by
                #22

                i have tried both the things not able to open the port .....

                mrjjM 1 Reply Last reply
                0
                • V veera

                  i have tried both the things not able to open the port .....

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #23

                  @veera

                  so are you sure PC has that port ?

                  if using a serial usb adapter, it has other name.

                  If you cannot open port using the Terminal sample then
                  something is wrong outside Qt.

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    veera
                    wrote on last edited by
                    #24

                    yes having two ports only ttyS4 and ttyS5 i am not using any usb to serial converter i am directly connecting with serial port only .....i have tried terminal example its giving the permission error means sudo permission .....

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      veera
                      wrote on last edited by
                      #25

                      permission is denied error while opening the port in Terminal Sample...

                      jsulmJ 1 Reply Last reply
                      0
                      • V veera

                        permission is denied error while opening the port in Terminal Sample...

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #26

                        @veera What does

                        ls -lh /dev/ttyS4
                        

                        say?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • mrdebugM Offline
                          mrdebugM Offline
                          mrdebug
                          wrote on last edited by
                          #27

                          Are you in dialout group?

                          Need programmers to hire?
                          www.labcsp.com
                          www.denisgottardello.it
                          GMT+1
                          Skype: mrdebug

                          1 Reply Last reply
                          1
                          • V Offline
                            V Offline
                            veera
                            wrote on last edited by
                            #28

                            i tried using this command on the qt project path also not able to open the serial ports.....

                            1 Reply Last reply
                            0
                            • V Offline
                              V Offline
                              veera
                              wrote on last edited by
                              #29

                              yes i am in dialout group....

                              1 Reply Last reply
                              0
                              • V Offline
                                V Offline
                                veera
                                wrote on last edited by
                                #30

                                crw-rw---- 1 root dialout 4, 68 Dec 11 13:22 /dev/ttyS4

                                1 Reply Last reply
                                0
                                • V Offline
                                  V Offline
                                  veera
                                  wrote on last edited by
                                  #31

                                  @jsulm said in multi serial port application:

                                  ls -lh /dev/ttyS4

                                  crw-rw---- 1 root dialout 4, 68 Dec 11 13:22 /dev/ttyS4

                                  1 Reply Last reply
                                  0
                                  • mrdebugM Offline
                                    mrdebugM Offline
                                    mrdebug
                                    wrote on last edited by
                                    #32

                                    Are you sure you really have 4 serial ports? Which kind of machine have you got?
                                    In some case, with a beaglebone board for example, you have to enable the third and fourth serial port with a special kernel parameter.

                                    Need programmers to hire?
                                    www.labcsp.com
                                    www.denisgottardello.it
                                    GMT+1
                                    Skype: mrdebug

                                    1 Reply Last reply
                                    1
                                    • mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #33

                                      Hi
                                      Often you have to add your user to the dialout group to be allowed to use it

                                      usermod -a -G dialout MY_USER_NAME

                                      as @mrdebug asks/says

                                      1 Reply Last reply
                                      0
                                      • V Offline
                                        V Offline
                                        veera
                                        wrote on last edited by
                                        #34

                                        @mrdebug
                                        I have only two serial ports i am connecting slot machine to my desktop computer.....need to connect from desktop to slot machine i am struggling to open the serial port please help me i have added like this

                                        1 Reply Last reply
                                        0
                                        • V Offline
                                          V Offline
                                          veera
                                          wrote on last edited by
                                          #35

                                          sudo usermod -a -G dialout veera

                                          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