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. QSerialPortInfo::availablePorts() freeze for ~30s
Forum Updated to NodeBB v4.3 + New Features

QSerialPortInfo::availablePorts() freeze for ~30s

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 2.7k 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.
  • C Offline
    C Offline
    Charlie_Hdz
    wrote on last edited by
    #2

    Welcome @Hallot

    That's interesting, even though you might not have permission to access the ports, It should return really fast... Are you catching the QSerialPortInfo? What are you receiving in that QSerialPortInfo?

    Can you just that part of your code just to reference?

    Kind Regards,
    Enrique Hernandez
    gearstech.com.mx
    chernandez@gearstech.com.mx

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hallot
      wrote on last edited by Hallot
      #3

      Hello Charlie, thanks for your quick answer.

      Yes, when I do not have permission, it is really fast, and it fails as expected.
      It's when I have the permission that I encounter the issue.
      What's interesting though is that after all the wait, I have the correct devices returned.

      It's really that QSerialPortInfo::availablePorts() line that is the issue.
      It also happens when I compile and run the "Enumerator example".

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

        Hi
        Have you tested with non Qt serial app, how it reacts to scanning for ports?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Charlie_Hdz
          wrote on last edited by
          #5

          It sounds that you have some issues with your new computer's port configuration. Which platform are you using?

          Anyway about the device that you want to connect by Serial... what is it?

          Kind Regards,
          Enrique Hernandez
          gearstech.com.mx
          chernandez@gearstech.com.mx

          1 Reply Last reply
          0
          • H Offline
            H Offline
            Hallot
            wrote on last edited by Hallot
            #6

            @mrjj I have tried python -m serial.tools.list_ports but the output is wrong though immediate.
            Do you have an application in mind I could try?

            @Charlie_Hdz It's a Manjaro linux on x86_64. I would tend to agree with you, but I have no idea where to start looking.
            It's a ftdi.

            mrjjM 1 Reply Last reply
            0
            • H Hallot

              @mrjj I have tried python -m serial.tools.list_ports but the output is wrong though immediate.
              Do you have an application in mind I could try?

              @Charlie_Hdz It's a Manjaro linux on x86_64. I would tend to agree with you, but I have no idea where to start looking.
              It's a ftdi.

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

              @Hallot
              well i always use minicom as its so simple
              moserial is also cool. (X11)
              I dont know Manjaro so maybe there is another installed already

              1 Reply Last reply
              0
              • H Offline
                H Offline
                Hallot
                wrote on last edited by
                #8

                Hum, I'm not exactly sure how I can list all serial devices using minicom, but I have used libftdi and one of their example, and it lists my ftdi devices immediately.

                mrjjM 1 Reply Last reply
                0
                • H Hallot

                  Hum, I'm not exactly sure how I can list all serial devices using minicom, but I have used libftdi and one of their example, and it lists my ftdi devices immediately.

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

                  @Hallot
                  Oh, my bad, you actually type it so bad app for test.
                  Sorry.
                  so libftdi can enum all ports and not hang?
                  I wonder if it touches non ftdi ones. ( those not usb based)
                  if time permits you can try
                  https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them
                  (Søren Holm post)

                  Anyway, its most likely something under /dev that makes it hang.

                  I tried QSerialPortInfo on wm linux but i cant make it hang even when i remove
                  the serial ports so they are missing.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Charlie_Hdz
                    wrote on last edited by
                    #10

                    @mrjj said in QSerialPortInfo::availablePorts() freeze for ~30s:

                    I tried QSerialPortInfo on wm linux but i cant make it hang even when i remove
                    the serial ports so they are missing.

                    Sure, actually SerialPort tend to send "unknow" error messages instead of hanging functions.

                    Kind Regards,
                    Enrique Hernandez
                    gearstech.com.mx
                    chernandez@gearstech.com.mx

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

                      QSerialPortInfo does not use the open() system call if you do not call a deprecated isBusy() method (do not use it then). QSerialPortInfo use udev, sysfs and simple enumeration in /dev, in case previous methods were failed. You need to debug the QSerialPortInfo, or, at least try to strace a calls, where the stuck is happens.

                      PS: It is interest to know in what of 'backend' this happens: with udev, sysfs or simple enumeration by a masks from /dev directory to localise an issue.

                      PS2: From my expirience, the FTDI should work perfectly.

                      1 Reply Last reply
                      1
                      • H Offline
                        H Offline
                        Hallot
                        wrote on last edited by
                        #12

                        I'm pretty sure I use udev.
                        However, it looks there was a bug somewhere that got fixed because after the latest system update from Manjaro, the issue has disappeared.
                        No kernel or udev update though, so I am not sure what was at cause or what fixed it.

                        Anyway, I guess this can be considered solved, thanks a lot for the support.

                        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