[Qt-interest] Reading data from serial port

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Sat Dec 4 07:20:23 CET 2010


> I am having a problem of reading data from USB port, I dont see any
> specialized class in QT to do this, but I found one library which uses qt to
> do this QextSerialPort. I am not sure if this is right lib or not for my
> purpose can any one please help.

USB port and serial port (UART/RS232) are 2 very different physical
interfaces. You can't simply read data off a USB port w/o knowing the
type of device connected.

>
> Do I need to use some other Windows specific library(dll) also to
> communicate with USB?

What type of device is connected to the USB port. Is it a mass-storage
device or a communication class device? Or is it a USB to serial
converter like the pl2303? Does your host OS have the required driver
for the device?

> How do I do the same in Linux?

In Linux too you need to have the driver for the particular class of
USB device (it should be there in your distro, unless it's a very
specialized device). Eg: In linux connecting a pl2303 adapter to the
USB port exposes the device under /dev/ttyUSB0/1 etc. You can then
simply read data off that port like you'd do via a regular serial
port.

HTH,
-mandeep



More information about the Qt-interest-old mailing list