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. [Solved]QSerialPortInfo::availablePorts() does not work. Can not enumerate serial ports

[Solved]QSerialPortInfo::availablePorts() does not work. Can not enumerate serial ports

Scheduled Pinned Locked Moved General and Desktop
22 Posts 5 Posters 12.2k Views 1 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.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on last edited by
    #13

    bq. You say USB mouse is not a serial port?

    Yes. The USB mouse it is an "input" class device, not an "tty" class device (i.e. not an serial port).

    bq. I run a virtual serial port using socat and again QSerialPortInfo did not find.

    You should do modifications in source code (as I say before) and then your /dev/ttyS0 device will listed.

    bq. Maybe I have problem in understanding usb concept and serial port.

    Yes, it is. :)

    [quote]
    I think any usb device assigned to a serial port e.g usb webcam.
    I attach a usb webcam to my computer and QSerialPortInfo did not find it also.
    [/quote]

    Sorry, you are wrong. :)

    In any case, your PC's has not any serial ports. You has only a few "faked" /dev/ttyS0-S3 (maybe up to ttyS14) serial ports. It is normal... You can read more about serial ports e.g. "here":http://www.tldp.org/HOWTO/Serial-HOWTO-10.html.

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #14

      [quote author="jmimi" date="1388572677"]You say USB mouse is not a serial port?[/quote]Hi,

      USB = "Universal Serial Bus", not "Serial Port". This is what most serial ports look like: http://en.wikipedia.org/wiki/File:Serial_port.jpg

      The Serial Port is a very old technology. They can still be found in embedded systems and industrial systems, but modern PCs don't supply them any more.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jmimi
        wrote on last edited by
        #15

        Thank you kuzulis.
        You're patient and meek.
        I shall read more and more.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jmimi
          wrote on last edited by
          #16

          JKSH : Hi .
          But usb is serial not parallel.
          I know RS232 is a serial port and I think usb is serial too.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #17

            [quote author="jmimi" date="1388575219"]I know RS232 is a serial port and I think usb is serial too.[/quote]Yes, USB and RS-232 communications are both serial, but their protocols are VERY different:

            • Serial port: http://en.wikipedia.org/wiki/RS-232#Signals
            • USB: http://en.wikipedia.org/wiki/USB#Communication

            Nowadays, when people say "serial port", they mean "RS-232". Even though data is transmitted through USB cables serially, USB does not use the RS-232 standard. Therefore, USB ports are not considered serial ports.

            From the "Qt documentation":http://qt-project.org/doc/qt-5/topics-network-connectivity.html#serial-port-communication:

            "The Qt Serial Port module provides a C++ API for communicating through serial ports, using the RS-232 standard. It works with physical ports and also with drivers that emulate these ports. Examples of serial port emulators include virtual COM ports, com0com emulators, and the Bluetooth SPP."

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jmimi
              wrote on last edited by
              #18

              Thanks you JKSH
              I should read more.
              I create a virtual com port using socat according below
              @$ socat -d -d pty,raw,echo=0, pty,raw,echo=0

              2014/01/01 16:03:58 socat[10509] N PTY is /dev/pts/4
              2014/01/01 16:03:58 socat[10509] N PTY is /dev/pts/5
              2014/01/01 16:03:58 socat[10509] N starting data transfer loop with FDs [3,3] and [5,5]

              @
              But QSerialPortInfo did not find for me. According to documentation you linked, it should be happened but it didn`t.
              So I willchange the source code according to kuzulis said and test again.
              I do not have the device right now. I want to develop software without it and will test with the device actually. communication with device is part of my software. So I need to create a virtual com port and test with it.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                huseyinkozan
                wrote on last edited by
                #19

                socat creates symlink, but QSerialPortInfo does not care about symlinks:
                https://code.woboq.org/qt5/qtserialport/src/serialport/qserialportinfo_unix.cpp.html#91

                aha_1980A 1 Reply Last reply
                0
                • H huseyinkozan

                  socat creates symlink, but QSerialPortInfo does not care about symlinks:
                  https://code.woboq.org/qt5/qtserialport/src/serialport/qserialportinfo_unix.cpp.html#91

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #20

                  @huseyinkozan Please create a report at bugreports.qt.io for this. This forum is not the right place to discuss if the behavior is correct or not.

                  And @kuzulis, you might be interested in this.

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  1
                  • K Offline
                    K Offline
                    kuzulis
                    Qt Champions 2020
                    wrote on last edited by
                    #21

                    Yes, QSPI ignores the socat's symlinks, because it is not a serial ports at all. It is not a bug. If you want to use a virtual serial ports on linux, please use the tty0tty kernel module.

                    H 1 Reply Last reply
                    1
                    • K kuzulis

                      Yes, QSPI ignores the socat's symlinks, because it is not a serial ports at all. It is not a bug. If you want to use a virtual serial ports on linux, please use the tty0tty kernel module.

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

                      @kuzulis Thanks. Tried tty0tty, but it have a bug. So, switched to crossed USB converters.

                      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