Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. USB Communication Using Qt
QtWS25 Last Chance

USB Communication Using Qt

Scheduled Pinned Locked Moved 3rd Party Software
57 Posts 13 Posters 110.5k Views
  • 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.
  • D Offline
    D Offline
    dcbasso
    wrote on 3 Jul 2012, 12:56 last edited by
    #30

    What its the best to access USB port:

    http://doc.qt.nokia.com/qtextended4.4/qserialport.html

    http://code.google.com/p/qextserialport/

    http://qt-apps.org/content/show.php/QSerialDevice?content=112039 (Updated)

    Thanks.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 3 Jul 2012, 13:29 last edited by
      #31

      According to "this post":http://qt-project.org/forums/viewthread/15580/#90074 there is a wiki on "QtSerialPort":http://qt-project.org/wiki/QtSerialPort Apparently, the source is inherited from QSerialDevice.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcbasso
        wrote on 4 Jul 2012, 13:05 last edited by
        #32

        It's possible to use the QtSerialPort on QT4? On this page (see: http://qt-project.org/wiki/Building-Qt-5-from-Git#15e7b6ad3df43ff719f8388ab4afb1cc) show thats is possible but he only explains to build in qt5!

        Anyone is using on QT4? The example there show only to build on Windows, not on linux...

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dcbasso
          wrote on 4 Jul 2012, 13:49 last edited by
          #33

          Well, I compile using QT Creator 4.8.1, now I copy the compile folder "QtAddOnSerialPort" to directory:

          "../bin/QtSDK/Desktop/Qt/4.8.1/gcc/include/."

          This will be enough to work with SerialPort/USB on QT?

          Thanks all!

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kuzulis
            Qt Champions 2020
            wrote on 4 Jul 2012, 14:07 last edited by
            #34

            Possible.

            Build and install process:

            
            bq. $mkdir serialport-build
            $cd  serialport-build
            $qmake ../qtserialport/serialport.pro
            $make (or nmake)
            $make install (or nmake install)
            
            Note: But in Windows, this build and install only the Debug version. To build and install Release version - just repeat the steps again, with:
            
            bq. $qmake ../qtserialport/serialport.pro CONFIG+=release
            
            
            use:
            ~~~
            
            your custom *.pro file:
            
            bq. CONFIG += serialport
            
            your *.cpp file:
            
            @#include <QtAddOnSerialPort/serialport.h>
            #include <QtAddOnSerialPort/serialportinfo.h>
             
            QT_USE_NAMESPACE_SERIALPORT@
            
            1 Reply Last reply
            0
            • D Offline
              D Offline
              dcbasso
              wrote on 4 Jul 2012, 14:32 last edited by
              #35

              hi kuzulis, from QtCreator I build and appears to works fine... Doing the make as you said give me an error...
              I have already copy and past the folder "QtAddOnSerialPorta" to “../bin/QtSDK/Desktop/Qt/4.8.1/gcc/include/.” and QtCreator find the includes:

              @
              #include <QtAddOnSerialPort/serialport.h>
              #include <QtAddOnSerialPort/serialportinfo.h
              @

              I'm trying to run the example on that page but doesn't works.... the errors:

              "Undefined reference to 'QtAddOn::SerialPort::SerialPortInfo::avaliablePorts()'"
              ... (more others 14 similar erros)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dcbasso
                wrote on 4 Jul 2012, 14:47 last edited by
                #36

                Sorry I made some mistake:

                When I try to compile on Qt using 4.6.1 or using the make on shell It gives me this error:

                moc_serialport.cpp:55:16: error: ‘SerialPort’ was not declared in this scope

                On the QT 4.8.1 the Qt Creator gives the message:
                ...
                #error (moc changes too much)
                ...

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dcbasso
                  wrote on 4 Jul 2012, 14:54 last edited by
                  #37

                  I try again, reopening the project and now works... but now I'm very confused!

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kuzulis
                    Qt Champions 2020
                    wrote on 4 Jul 2012, 15:18 last edited by
                    #38

                    Remove (clear) away all that you previously copied by hand and do as I have indicated in the "above":http://qt-project.org/forums/viewreply/90605/

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dcbasso
                      wrote on 4 Jul 2012, 16:35 last edited by
                      #39

                      Will not compile... the errors at code...

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dcbasso
                        wrote on 4 Jul 2012, 16:39 last edited by
                        #40

                        See the errors:

                        @
                        ...
                        ...
                        ...
                        /home/dvl/SOURCE_CODE/qtserialport/src -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/home/dvl/SOURCE_CODE/qtserialport/src -I. -I/home/dvl/SOURCE_CODE/qtserialport/src -I. -o moc_serialport.o moc_serialport.cpp
                        moc_serialport.cpp:55:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:56:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:57:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:58:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:59:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:60:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:61:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:62:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:63:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:64:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:65:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:66:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:67:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:68:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:69:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:70:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:71:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:72:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:73:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:74:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:75:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:76:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:77:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:78:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:79:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:80:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:81:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:82:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:83:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:84:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:85:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:86:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:87:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:88:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:89:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:90:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:91:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:92:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:93:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:94:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:95:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:96:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:97:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:98:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:99:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:100:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:101:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:102:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:103:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:104:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:105:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:106:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:107:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:108:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:109:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:110:16: error: ‘SerialPort’ was not declared in this scope
                        moc_serialport.cpp:142:19: error: ‘SerialPort’ has not been declared
                        moc_serialport.cpp:151:20: error: ‘SerialPort’ has not been declared
                        moc_serialport.cpp:151:45: error: non-member function ‘const QMetaObject* metaObject()’ cannot have cv-qualifier
                        /usr/include/QtCore/qobject.h: In function ‘const QMetaObject* metaObject()’:
                        /usr/include/QtCore/qobject.h:296:33: error: ‘QScopedPointer<QObjectData> QObject::d_ptr’ is protected
                        ...
                        ...
                        ...
                        @

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          dcbasso
                          wrote on 4 Jul 2012, 17:58 last edited by
                          #41

                          Fixed... Compiled in manual way... testing...

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            dcbasso
                            wrote on 4 Jul 2012, 18:00 last edited by
                            #42

                            I'm still having the same problems:

                            “Undefined reference to ‘QtAddOn::SerialPort::SerialPortInfo::avaliablePorts()’”
                            ....
                            ...

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              kuzulis
                              Qt Champions 2020
                              wrote on 4 Jul 2012, 19:09 last edited by
                              #43

                              I do not know what you did - but I have everything working well.

                              1.To start, try to remove all the headers, libraries, etc. QtSerialPort of the your *nix OS.
                              2. Download the latest version of the library
                              3. Build and install library to the system step-by-step, see an new updated manual in the Wiki.
                              4. Create a new blank project and include the library as stated in the Wiki

                              More anything, I can not help you, because I can not control all of your "curves" action.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                dcbasso
                                wrote on 4 Jul 2012, 19:11 last edited by
                                #44

                                Sorry guys... to many posts here about this problem but:

                                Now I got another error:

                                #include "qglobal.h"
                                "qglobal.h not such file or directory

                                • I post it before you answer me kuzulis
                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  dcbasso
                                  wrote on 4 Jul 2012, 19:17 last edited by
                                  #45

                                  Well... I will try once again...
                                  Thanks anyway!

                                  1 Reply Last reply
                                  0
                                  • F Offline
                                    F Offline
                                    franku
                                    wrote on 5 Jul 2012, 20:15 last edited by
                                    #46

                                    You may want to have a look at "libusb-win32":http://sourceforge.net/apps/trac/libusb-win32/wiki. It depens wether you are using ftdi chips for the µC side, or want to build your usb-client on the controller yourself. For attaching a device very simple try to use the ftdi232 with either vcp or d2xx usage. I.e. "ftdi-link":http://www.ftdichip.com/Products/ICs/FT231X.html
                                    .. frank

                                    This, Jen, is the internet.

                                    1 Reply Last reply
                                    0
                                    • D Offline
                                      D Offline
                                      dcbasso
                                      wrote on 5 Jul 2012, 20:22 last edited by
                                      #47

                                      My client is using the µC "NXP LPC2366", I have the driver for him!
                                      I need to build a app which will run at on windows, linux and Mac OS.

                                      That the way I'm trying to use the QtSerialPort!

                                      I'm doing something wrong in the conception off app?

                                      1 Reply Last reply
                                      0
                                      • F Offline
                                        F Offline
                                        franku
                                        wrote on 5 Jul 2012, 20:53 last edited by
                                        #48

                                        The "chips":http://www.ftdichip.com/Drivers/VCP.htm do have drivers for several os. Using your own driver has to supply your own usb VID. Which library you use may depend on the way you want to build it and if you want to use polling or event driven mode to receive data. However, I've used QExtSerialport for Windows and it works fine using a QThread polling the data once a msec.

                                        This, Jen, is the internet.

                                        1 Reply Last reply
                                        0
                                        • K Offline
                                          K Offline
                                          kuzulis
                                          Qt Champions 2020
                                          wrote on 6 Jul 2012, 06:57 last edited by
                                          #49

                                          bq. My client is using the µC “NXP LPC2366”, I have the driver for him!

                                          I have questions:

                                          1. NXP LPC2366 It's ARM MCU?
                                          2. The client uses the "native" serial interface of MCU (USART), or emulation via the USB interface of MCU?
                                          3. If the emulation, then it serial port correct whether is determined by SerialPortInfo::availablePorts() (QtSerialPort) ? If incorrectly - that let me know.

                                          bq. However, I’ve used QExtSerialport for Windows and it works fine using a QThread polling the data once a msec.

                                          Polling to use threads - this is redundant and inefficient, and I do not believe that you get exactly 1 ms. But this is offtopic.

                                          1 Reply Last reply
                                          0

                                          39/57

                                          4 Jul 2012, 16:35

                                          • Login

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