[Solved]QSerialPortInfo::availablePorts() outputting a lot of information to stdout? (linux and libudev related)
-
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)
-
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. -
@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)
-
@shavera Still cannot confirm. Your program gives me the following output:
ttyS0ttyS1ttyS10ttyS11ttyS12ttyS13ttyS14ttyS15ttyS16ttyS17ttyS18ttyS19ttyS2ttyS20ttyS21ttyS2ttyS23ttyS24ttyS25ttyS26ttyS27ttyS28ttyS29ttyS3ttyS30ttyS31ttyS4ttyS5ttyS6ttyS7ttyS8ttyS9
Fascinating :-/
-
@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.
-
Hi,
Same thing on kubuntu, no special output from udev. You might have some logging option turned on on your machine
-
@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.
-
@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. -
@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.
-
@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...
-
@kuzulis Unfortunately I don't have the expertise to debug this.
-
I just upgraded my suite to 5.4.1 locally, and I still have the same issue.
-
@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
-
@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.
-
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!