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

Event when new serial port is added

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 5 Posters 1.1k Views 3 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.
  • S Offline
    S Offline
    Stefanoxjx
    wrote on last edited by
    #1

    Hi,
    I would like to ask you if exist in Qt an event generated when a new serial port is added to PC.
    I thought to use QTimer and check every seconds if QSerialPortInfo::availablePorts() report a different number of ports respect last call, but if exist a specific event it be very good.
    Thanks.

    Stefano

    JonBJ 1 Reply Last reply
    0
    • S Stefanoxjx

      Hi,
      I would like to ask you if exist in Qt an event generated when a new serial port is added to PC.
      I thought to use QTimer and check every seconds if QSerialPortInfo::availablePorts() report a different number of ports respect last call, but if exist a specific event it be very good.
      Thanks.

      Stefano

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Stefanoxjx
      Not in Qt, it's very platform-specific.. See e.g. https://stackoverflow.com/questions/41671828/how-to-emit-a-signal-when-serial-port-is-connected-or-disconnected-in-qt

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

        Hi
        Are you using a usb serial one ?
        Maybe you can test this one and see if it sends event
        https://github.com/wang-bin/qdevicewatcher

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

          Hi,

          KDE's Solid framework might be of interest.

          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
          5
          • K Offline
            K Offline
            kuzulis
            Qt Champions 2020
            wrote on last edited by
            #5

            You can take a code from the qextserialport library.

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Stefanoxjx
              wrote on last edited by
              #6

              Hi, thanks for your answers.
              In the end I decided to use a QTimer and check QSerialPortInfo::availablePorts() every seconds.
              Seems to work fine.

              1 Reply Last reply
              2

              • Login

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