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() outputting a lot of information to stdout? (linux and libudev related)
Forum Updated to NodeBB v4.3 + New Features

[Solved]QSerialPortInfo::availablePorts() outputting a lot of information to stdout? (linux and libudev related)

Scheduled Pinned Locked Moved General and Desktop
qserialportlinux
15 Posts 5 Posters 7.3k Views 4 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.
  • shaveraS Offline
    shaveraS Offline
    shavera
    wrote on last edited by shavera
    #1

    While the list it returns is the correct list of actually available ports, the process of calling 'availablePorts()' then sends a lot of stuff to the terminal output: (below is an example of output)

    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty52'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty53'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty54'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty55'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty56'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty57'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty58'
    libudev: udev_device_new_from_syspath: device 0x986200 has devpath '/devices/virtual/tty/tty59'

    To the best of my knowledge, these ports aren't actually available for use, but they're polluting the output. Can I at least suppress these messages? I don't know enough about the details of what it's seeing to disable them more deeply

    (Qt 5.3.1; Linux Mint 17.1; Kernel 3.13.0-37-generic if that's any help)

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi,
      I'm on Ubuntu 14.10 with Qt 5.4.0 and cannot confirm this. Please provide a minimal working example to reproduce this behaviour.

      shaveraS 1 Reply Last reply
      0
      • ? A Former User

        Hi,
        I'm on Ubuntu 14.10 with Qt 5.4.0 and cannot confirm this. Please provide a minimal working example to reproduce this behaviour.

        shaveraS Offline
        shaveraS Offline
        shavera
        wrote on last edited by shavera
        #3

        @Wieland

        This produces the behaviour succinctly:

        #include <QCoreApplication>
        #include <QSerialPortInfo>
        #include <QTextStream>
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
        
            QList<QSerialPortInfo> infoList = QSerialPortInfo::availablePorts();
        
            foreach(QSerialPortInfo info, infoList) QTextStream(stdout) << info.portName();
        
            return a.exec();
        }
        

        Edit: sorry, I should be specific about the output. The output includes (ellipses to remove all the repeats)

        ...
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty62'
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty63'
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty7'
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty8'
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty9'
        libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/ttyprintk'
        ttyS0
        

        The last line, ttyS0, is the one actually in the "infoList". All the rest are lines generated during the call to available ports (can be seen in debug mode, for instance)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @shavera Still cannot confirm. Your program gives me the following output:

          ttyS0ttyS1ttyS10ttyS11ttyS12ttyS13ttyS14ttyS15ttyS16ttyS17ttyS18ttyS19ttyS2ttyS20ttyS21ttyS2ttyS23ttyS24ttyS25ttyS26ttyS27ttyS28ttyS29ttyS3ttyS30ttyS31ttyS4ttyS5ttyS6ttyS7ttyS8ttyS9
          

          Fascinating :-/

          shaveraS 1 Reply Last reply
          0
          • ? A Former User

            @shavera Still cannot confirm. Your program gives me the following output:

            ttyS0ttyS1ttyS10ttyS11ttyS12ttyS13ttyS14ttyS15ttyS16ttyS17ttyS18ttyS19ttyS2ttyS20ttyS21ttyS2ttyS23ttyS24ttyS25ttyS26ttyS27ttyS28ttyS29ttyS3ttyS30ttyS31ttyS4ttyS5ttyS6ttyS7ttyS8ttyS9
            

            Fascinating :-/

            shaveraS Offline
            shaveraS Offline
            shavera
            wrote on last edited by
            #5

            @Wieland Yeah, I'm tempted to believe this is something on my linux box itself, and maybe not intrinsic to Qt? I'll try in another environment when I have the chance.

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

              Hi,

              Same thing on kubuntu, no special output from udev. You might have some logging option turned on on your machine

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                @Wieland ,

                This output:

                ttyS0 ... ttyS30

                also is bad. This happens only if are not used nor udev, nor sysfs.

                Anyway, need to use the latest Qt 5.4.1 release to try reproduce it.

                @shavera ,

                yes, as says @SGaist , most likely, your PC has some extended debug output configuration (in systemd ?), so, it is no Qt-specific.

                1 Reply Last reply
                2
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @kuzulis
                  These devices are in /sys/class/tty. Don't know if there is actually hardware in this computer that would justify the presence of these device files but I really doubt it. I suppose Ubuntu is doing something wrong.

                  1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Hi,

                    Same thing on kubuntu, no special output from udev. You might have some logging option turned on on your machine

                    shaveraS Offline
                    shaveraS Offline
                    shavera
                    wrote on last edited by
                    #9

                    @SGaist That sounds likely, actually. I feel like I'd turned on some logging to debug some other problem eons ago, and now I couldn't possibly tell you what or where it is. But that it's not reproducing for others strikes me that it's my computer so... that's fine then.

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

                      @Wieland ,

                      hmm it is strange, because this https://qt.gitorious.org/qt/qtserialport/commit/52e0a7c73dc5ac3352e4cec8ac7c9295b94eef97 patch (for Qt since 5.4.0) should solve this problem...

                      ? shaveraS 2 Replies Last reply
                      0
                      • K kuzulis

                        @Wieland ,

                        hmm it is strange, because this https://qt.gitorious.org/qt/qtserialport/commit/52e0a7c73dc5ac3352e4cec8ac7c9295b94eef97 patch (for Qt since 5.4.0) should solve this problem...

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #11

                        @kuzulis Unfortunately I don't have the expertise to debug this.

                        1 Reply Last reply
                        0
                        • K kuzulis

                          @Wieland ,

                          hmm it is strange, because this https://qt.gitorious.org/qt/qtserialport/commit/52e0a7c73dc5ac3352e4cec8ac7c9295b94eef97 patch (for Qt since 5.4.0) should solve this problem...

                          shaveraS Offline
                          shaveraS Offline
                          shavera
                          wrote on last edited by
                          #12

                          @kuzulis

                          I just upgraded my suite to 5.4.1 locally, and I still have the same issue.

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

                            @shavera ,

                            what issue? If you about:

                            libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty62'

                            then it is not a QtSerialPort issue..

                            Besides, in your case QSerialPortInfo returns one valid device ttyS0:

                            ttyS0

                            that is right.

                            @Wieland ,

                            Unfortunately I don't have the expertise to debug this.

                            You can read this: http://forum.qt.io/topic/46253/solved-qserialport-error-message-qiodevice-read-device-not-open/11

                            shaveraS 1 Reply Last reply
                            1
                            • K kuzulis

                              @shavera ,

                              what issue? If you about:

                              libudev: udev_device_new_from_syspath: device 0x13daf10 has devpath '/devices/virtual/tty/tty62'

                              then it is not a QtSerialPort issue..

                              Besides, in your case QSerialPortInfo returns one valid device ttyS0:

                              ttyS0

                              that is right.

                              @Wieland ,

                              Unfortunately I don't have the expertise to debug this.

                              You can read this: http://forum.qt.io/topic/46253/solved-qserialport-error-message-qiodevice-read-device-not-open/11

                              shaveraS Offline
                              shaveraS Offline
                              shavera
                              wrote on last edited by
                              #14

                              @kuzulis
                              The problem is that it creates a lot of clutter in a terminal window if I'm running it from a terminal or if I'm debugging from a terminal with debug statements.

                              However, I didn't know if it was a thing generally observed in Qt, or if it was specific to my local machine, so I thought I'd ask on the forums to see if others have observed the behaviour. They have not, therefore it's some sort of logging on my computer whenever the serial ports are queried. Not sure exactly what, but at least now I know the problem is constrained to my workspace, and not likely to appear 'in production' as it were.

                              1 Reply Last reply
                              0
                              • vikramgV Offline
                                vikramgV Offline
                                vikramg
                                wrote on last edited by
                                #15

                                Resurrecting this ancient thread with a concrete solution in case it helps someone: I just ran into this as well; libudev debug messages were cluttering the Application Output. It turns out you don't even have to query serial ports -- the messages are emitted just by virtue of including the serialport module.

                                Like the OP, turned out that I too had turned on some logging to debug a different problem ages ago. After some hunting, I discovered that this logging had been enabled by adding the line

                                udev_log="debug"

                                in /etc/udev/udev.conf. After I commented out that line and rebooted, the libudev messages are gone!

                                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