Qextserual can't detect virtual com-port
Hey everybody,
just got a question if anyone noticed similar problem to mine..
im using qt 4.5 with qexserialport 1.2 alpha
got a device connected to USB Serial Port (FTDI)
I noticed that it actually cant detect it...
Code:
QextSerialEnumerator enumer;
QList<QextPortInfo>ports = enumer.getPorts();
strlist.clear();
for( int i = 0; i < ports.count(); ++i) strlist << ports.at(i).portName;
ui.comboBox_Comm->addItems(strlist);
In fact i have got the info from real comm-port, but can't get the info from virtual comm-port:confused:
thanks!
Jim
Re: Qextserual can't detect virtual com-port
I don't use this alpha version of Qextserialport.
You can scan a list of QString("COM%1").arg(i) and try to open the port: if you can open it, there is an available port. On Linux you can query the list of /dev/ttyS* and /dev/ttyUSB*.
Re: Qextserual can't detect virtual com-port
Quote:
Originally Posted by
PaceyIV
I don't use this alpha version of Qextserialport.
You can scan a list of QString("COM%1").arg(i) and try to open the port: if you can open it, there is an available port. On Linux you can query the list of /dev/ttyS* and /dev/ttyUSB*.
thanks, but i have got the list of com port information, but except for the vitual com port..
Re: Qextserual can't detect virtual com-port
I don't understand. What's the difference between a virtual-com and a real-com port?
If I connect my Arduino with the USB cable on my PC (a microcontroller with the FTDI chip), Windows, same as Linux, shows me a COM3 or a /dev/ttyUSB0. This is a virtual com port, but the system operator is the only subject that knows this. Any programs see that port as a real serial port.
Re: Qextserual can't detect virtual com-port
indeed, i can see the virtual-com port under device management (windows), und i can use other software to open the port, but, only my Qt code, as i described, can't detect die virtual-com port.
so i don't understand, if the QextSerialEnumerator support the virtual-device or not..
Re: Qextserual can't detect virtual com-port
Quote:
Originally Posted by
PaceyIV
I don't use this alpha version of Qextserialport.
You can scan a list of QString("COM%1").arg(i) and try to open the port: if you can open it, there is an available port. On Linux you can query the list of /dev/ttyS* and /dev/ttyUSB*.
however, i notice that you can scan the port with a normal version of Qextserialport?
I used the alpha version of Qextserialport because it can easy detect the port information.
Re: Qextserual can't detect virtual com-port
Here my code.
Code:
// Query available SerialPort name
{
QextSerialPort testPort;
testPort.setBaudRate(BAUD115200);
testPort.setFlowControl(FLOW_OFF);
testPort.setParity(PAR_NONE);
testPort.setDataBits(DATA_8);
testPort.setStopBits(STOP_1);
#ifdef _WIN
for (int i=1; i<MAX_COM_PORT; i++)
{
testPortName
= QString("COM%1").
arg(i
);
testPort.setPortName(testPortName);
{
portsName.append(testPortName);
testPort.close();
}
}
#else // _UNIX
filters << "ttyS*" << "ttyUSB*";
dir.setNameFilters(filters);
dir.
setFilter(QDir::Files |
QDir::System);
QFileInfoList list = dir.entryInfoList();
for (int i=0; i< list.size(); i++)
{
portsName.append(list.at(i).canonicalFilePath ());
}
#endif
return portsName;
}
Re: Qextserual can't detect virtual com-port
thanks a lot, i will try it later!
Re: Qextserual can't detect virtual com-port
Hi,
I use code very similiar to the one PaceyIV posted.
The problem is that my system gets blocked whenever a COM Port is not existing but Qt tries to open it anyways. My whole application freezes for about 5 seconds
I have two ideas for a solution.
Let the open methods run in the background. How? I dont know.
Set a timeout for the open method. How? I dont know.
Another option would be a different code that avoids opening ports that dont exist, is there a solution for that?
Any help is highly appreciated.
Re: Qextserual can't detect virtual com-port
hi i want to get the corresponding port name when we choose a printer name in a combobox.....i stuck with it for few days,,,kindly help me'