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. Serial port number in windows

Serial port number in windows

Scheduled Pinned Locked Moved 3rd Party Software
28 Posts 6 Posters 21.1k 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.
  • I Offline
    I Offline
    Immii
    wrote on last edited by
    #4

    My colleagues uses serial port and they use "QextSerialPort":http://qextserialport.sourceforge.net/, have look of this, this may help

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #5

      I just know, my problem is not to use serial, but know what com port number the os assign to a device.

      [quote author="Immii" date="1293096664"]My colleagues uses serial port and they use "QextSerialPort":http://qextserialport.sourceforge.net/, have look of this, this may help[/quote]

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #6

        Judging by your wording, I guess you're talking about USB devices that act as a serial device? Or are you talking about real serial ports on your system?

        I just did a bit of "Googling":http://www.google.nl/search?sourceid=chrome&ie=UTF-8&q=windows+usb+serial+port+api#hl=nl&expIds=17259,17291&xhr=t&q=windows+usb+api&cp=14&pf=p&sclient=psy&source=hp&aq=0&aqi=&aql=&oq=windows+usb+ap&gs_rfai=&pbx=1&fp=32b4510a29fc6da5, and it already turned up some starting points, like the "third hit":http://www.google.nl/url?sa=t&source=web&cd=3&sqi=2&ved=0CC8QFjAC&url=http://www.codemiles.com/download/file.php?id=719&ei=zxgTTYXfFciEOtHI7ZgJ&usg=AFQjCNH6tdyMFNHdG17twCGsJXSOxKYNJQ on that query. This is really Windows specific, though it would be nice to have a Qt-like API to get these kinds of notifications in a platform independent way. In KDE, I guess it would be in Solid. Perhaps the Windows port of that part of the KDE project contains the code you need?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stukdev
          wrote on last edited by
          #7

          I need know what the com port is assignet to a serial-usb adapter, because every time that i insert a device i always go to control panel, i want create a program to quickly get this information.
          After much time of googling i see this "link":http://www.naughter.com/enumser.html , but is hard to port on a mingw, i lost many headers.
          But i think there aren't much way to do this. And yes is very useful if this can be cross-platform. But for unix a simple dmesg can resolve this :P

          [quote author="Andre" date="1293097662"]Judging by your wording, I guess you're talking about USB devices that act as a serial device? Or are you talking about real serial ports on your system?

          I just did a bit of "Googling":http://www.google.nl/search?sourceid=chrome&ie=UTF-8&q=windows+usb+serial+port+api#hl=nl&expIds=17259,17291&xhr=t&q=windows+usb+api&cp=14&pf=p&sclient=psy&source=hp&aq=0&aqi=&aql=&oq=windows+usb+ap&gs_rfai=&pbx=1&fp=32b4510a29fc6da5, and it already turned up some starting points, like the "third hit":http://www.google.nl/url?sa=t&source=web&cd=3&sqi=2&ved=0CC8QFjAC&url=http://www.codemiles.com/download/file.php?id=719&ei=zxgTTYXfFciEOtHI7ZgJ&usg=AFQjCNH6tdyMFNHdG17twCGsJXSOxKYNJQ on that query. This is really Windows specific, though it would be nice to have a Qt-like API to get these kinds of notifications in a platform independent way. In KDE, I guess it would be in Solid. Perhaps the Windows port of that part of the KDE project contains the code you need?[/quote]

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #8

            Looks like an interesting project. If anything, it shows that Windows is a bit of a mess if you need to try 9 ways to actually get all the serial ports. If it is hard to use with MinGw, then why not use it with MSVC instead? You could make it a small, separate process that just communicates the data to your main application when needed. You can use any IPC mechanism you want for that, including just outputting the data over the stdout and reading that with QProcess.

            Still, you could try and see if the simple way of reading out the registry would be enough in your case? You can use QSettings for that...

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gronerth
              wrote on last edited by
              #9

              You can do with QextSerialPort. Example code:

              @QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
              qDebug() << "SerialSettings::LoadPorts(): List of ports availables:\n";
              for (int i = 0; i < ports.size(); i++) {
              qDebug() << "port name: " << ports.at(i).portName;
              qDebug() << "friendly name: " << ports.at(i).friendName;
              qDebug() << "physical name: " << ports.at(i).physName;
              qDebug() << "enumerator name: " << ports.at(i).enumName;
              qDebug() << "===================================";
              }
              @


              JETG

              1 Reply Last reply
              0
              • S Offline
                S Offline
                stukdev
                wrote on last edited by
                #10

                What is it?!?
                When this function was added to the project?!?
                QextSerialEnumerator?!? QextPortInfo?!?

                [quote author="gronerth" date="1293126666"]You can do with QextSerialPort. Example code:

                @QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
                qDebug() << "SerialSettings::LoadPorts(): List of ports availables:\n";
                for (int i = 0; i < ports.size(); i++) {
                qDebug() << "port name: " << ports.at(i).portName;
                qDebug() << "friendly name: " << ports.at(i).friendName;
                qDebug() << "physical name: " << ports.at(i).physName;
                qDebug() << "enumerator name: " << ports.at(i).enumName;
                qDebug() << "===================================";
                }
                @[/quote]

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  vsorokin
                  wrote on last edited by
                  #11

                  This methods of this library: "QExtSerialPort":http://qextserialport.sourceforge.net/

                  --
                  Vasiliy

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #12

                    It might just be me, but I don't see the classes mentioned in the code fragment in the documentation linked from the page you give. I am looking at http://qextserialport.sourceforge.net/qextserialport-1.1.x/

                    Is this new API? Newer than the latest API docs on the webpage?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stukdev
                      wrote on last edited by
                      #13

                      This API is very strange!

                      Look this "http://code.google.com/p/qextserialport/source/browse/#hg/src":http://code.google.com/p/qextserialport/source/browse/#hg/src

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        gronerth
                        wrote on last edited by
                        #14

                        The api version that i have downloaded is: qextserialport-1.2win-alpha (win version), you can download from here: http://sourceforge.net/projects/qextserialport/files/qextserialport alpha/


                        JETG

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          stukdev
                          wrote on last edited by
                          #15

                          This is a new alpha API, that include enumerator :) Great news!

                          [quote author="gronerth" date="1293458810"]The api version that i have downloaded is: qextserialport-1.2win-alpha (win version), you can download from here: http://sourceforge.net/projects/qextserialport/files/qextserialport alpha/

                          [/quote]

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            gronerth
                            wrote on last edited by
                            #16

                            Yeap, hope that works for your app!


                            JETG

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              stukdev
                              wrote on last edited by
                              #17

                              I trying this new api, but i don't understand why i have to make dll and not use the function in my application like the old version of api.

                              [quote author="gronerth" date="1293459428"]Yeap, hope that works for your app![/quote]

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                gronerth
                                wrote on last edited by
                                #18

                                Well, i have worked with that api, using the dlls, do you mean that u need to link statically?


                                JETG

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  stukdev
                                  wrote on last edited by
                                  #19

                                  Yes, i use the old api in static mode, this api is writing for build shared library, look the macro
                                  @

                                  define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT

                                  @ in the code

                                  [quote author="gronerth" date="1293461425"]Well, i have worked with that api, using the dlls, do you mean that u need to link statically?[/quote]

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    gronerth
                                    wrote on last edited by
                                    #20

                                    Where is that definition?, i have never tried to link statically, but in the "qextserialport.pro" there is a line that says: #CONFIG += staticlib, have you tried to uncomment it?, and then compile it again( qmake, make)....


                                    JETG

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      stukdev
                                      wrote on last edited by
                                      #21

                                      Yes, but many error give to me.
                                      That line is in the class QextSerialEnumerator
                                      @
                                      class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject@

                                      [quote author="gronerth" date="1293463915"]Where is that definition?, i have never tried to link statically, but in the "qextserialport.pro" there is a line that says: #CONFIG += staticlib, have you tried to uncomment it?, and then compile it again( qmake, make)....[/quote]

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        gronerth
                                        wrote on last edited by
                                        #22

                                        mmm Maybe i have a differente version, because the QextSerialEnumerator doenst inherit from QObject:

                                        @/*!

                                        • Serial port enumerator. This class provides list of ports available in the system.
                                        • Windows implementation is based on Zach Gorman's work from
                                        • <a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).
                                          */
                                          class QextSerialEnumerator
                                          @

                                        JETG

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          stukdev
                                          wrote on last edited by
                                          #23

                                          @
                                          \section Credits
                                          Windows implementation is based on Zach Gorman's work from
                                          <a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).

                                          OS X implementation, see
                                          http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html

                                          \author Michal Policht, Liam Staskawicz
                                          */
                                          class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject
                                          @

                                          What version do you have of the library ?
                                          [quote author="gronerth" date="1293464466"]mmm Maybe i have a differente version, because the QextSerialEnumerator doenst inherit from QObject:

                                          @/*!

                                          • Serial port enumerator. This class provides list of ports available in the system.
                                          • Windows implementation is based on Zach Gorman's work from
                                          • <a href="http://www.codeproject.com">The Code Project</a> (http://www.codeproject.com/system/setupdi.asp).
                                            */
                                            class QextSerialEnumerator
                                            @

                                          [/quote]

                                          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