USB Ports not listed on Linux with Qt 5.3.1 [Solved]
I am somewhat confused. I know there have been posts from last year on this subject ("QSerialPortInfo list all available port on Linux":http://qt-project.org/forums/viewthread/33369) and the solution seemed to be a temporary one (http://www.qtcentre.org/threads/56487-QSerialPortInfo-get-all-available-port-in-Linux-and-Mac?p=252525#post252525).
Since my app is cross-platform, it will be necessary for all platforms to perform the same -- without major code modifications for platform differences. I also do not want to resort to command line results like
@$ lsusb -tv@
I have noticed that one problem may be that Ubuntu (and the Linux Mint variation) list USB ports differently from serial TTY devices even though USB ports are listed generically as /dev/ttysUSBn.
Here we are, nearly a year later, and possibly two versions of Linux (and at least two Qt updates ) later and it is still unclear where this stands.
I see no QUSBSerialPort class or any modifications to the QSerialPortInfo that is an essential fix for this problem. So what is the current situation on non-physical off-board devices like a USB bus device - and how should it be addressed at this point. The former re-compile solution seems unacceptable at this late date.
Even though they both have the word "serial" in their names, "Universal Serial Bus" and "Serial Port" are completely different (and incompatible) things. See "here":http://deltas.blog.com/2012/11/28/usb-vs-rs-232/ for a discussion about their differences.
QSerialPort supports the RS-232 protocol. It cannot talk to USB devices.
OK...just for the sake of the discussion; let's use your superficial semantic approach (no such discrimination exists for less technical users) what is the facility in Qt to list and use USB ports as a serial device?
[quote author="ad5xj" date="1410800094"]what is the facility in Qt to list and use USB ports as a serial device?[/quote] QSerialPortInfo lists all your physical and virtual serial ports (including USB ones). QSerialPort lets you use those ports.
I used Ubuntu 13.10 64-bit with Qt 5.3.1 (downloaded from http://qt-project.org/downloads ), and was able to communicate with a serial device through an "ATEN UC232A":http://www.aten.com/Mobility-&-USB/USB-Converters/USB-to-Serial-Converter~UC232A.html without issues. The test code from "your link":http://www.qtcentre.org/threads/56487-QSerialPortInfo-get-all-available-port-in-Linux-and-Mac?p=252525#post252525 worked fine with ttyUSB0.
If it doesn't work for you, please state:
- Your OS version
- How you installed Qt
- What you tried, and what results you got
[quote author="ad5xj" date="1410796823"]I have noticed that one problem may be that Ubuntu (and the Linux Mint variation) list USB ports differently from serial TTY devices even though USB ports are listed generically as /dev/ttysUSBn.
I see no QUSBSerialPort class or any modifications to the QSerialPortInfo that is an essential fix for this problem.[/quote]There probably was nothing to fix from Qt's side.
In your link, kuzulis (a maintainer of the Qt Serial Port module) guessed that the user's copy of the module was built without the library (libudev) required to query the Linux kernel's device manager, which resulted in it being unable to query ttyUSB0.
However, the "official packages":http://qt-project.org/downloads are built with libudev.
[quote author="ad5xj" date="1410800094"]let’s use your superficial semantic approach (no such discrimination exists for less technical users)[/quote]Apologies, I think I misunderstood your post originally. I was trying to say that, while QSerialPort can talk through a USB-to-RS232 converter, it cannot talk to a USB storage device or a USB mouse (both of which can be plugged into a USB port).
So as I understand your reply...the only time a USB port will be listed by QSerialPortInfo is when there is a USB-Serial adapter connected? ? ?
[quote author="ad5xj" date="1410882341"]So as I understand your reply...the only time a USB port will be listed by QSerialPortInfo is when there is a USB-Serial adapter connected? ? ?[/quote]Correct. That's because a USB port is not a serial port.
accordind to how i have seen their difference on deltas.blog.com they both have the word “serial” in their names, “ Serial Bus” and “Serial Port”but are completely different things.
Well, in truth of fact, USB IS serial - it has to be by the very electronic nature of the bus -- it is just not a RS-232 serial device -- just as SATA is serial but is not an ATA device ( ATA being parallel data).
It is not helpful to play these semantic games.
It would have been appropriate to say "USB ports only show up in QSerialPortInfo when a USB->Serial adapter is attached because USB p-n-p devices can be any type of serial device (like a mouse or keyboard or even a SATA external drive)" - that is the appropriate and direct approach instead of these semantic and frankly, useless arguments given the original question.
I now have an idea what to do with my application. Thanks JKSH
I'm glad to hear that you've found a way forward, and I wish you all the best for your project. Thank you also for your feedback; I will strive to be clearer in my future posts.
To be fair though, I replied your original post by saying that "QSerialPort supports the RS-232 protocol. It cannot talk to USB devices". Was that insufficient to answer your original question (as I understood it) of "Why doesn't QSerialPortInfo display my USB ports?" or "How can I get QSerialPortInfo to display my USB ports?"