lemanhtrung / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

Problem with LPT Ports #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

for a project I need to scan all available ports for s.th. So I collect
them with the enumerator. But the enumerator also lists LPT Ports. There
are problems with two kinds of LPT ports.

1. friendly name: "ECP-Printerport <LPT X>"
2. friendly name: "Unusable Parallel Port <LPT Y>"

I open the ports with this code:

if (port->open(QIODevice::ReadWrite)) {
   connect(port, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
   qDebug() << "listening for data on" << port->portName();
} else {
   qDebug() << "device failed to open:" << port->errorString();
}

By opening the LPT Port type 1 the program turns to the else sector an I
get the following error:
"Failed to set Comm Mask. Error Code:"
"device failed to open: "No Error has occurred"

But after this the port is still open. port>isOpen() returns true. And so
for I have to close the port with port->close(), to set a new portname and
open the next port. This works.

With the second type of port I get the same messages and the port is opened
too. But when I want to close it with port->close() the program crashes.

Original issue reported on code.google.com by tuxia...@gmail.com on 30 May 2010 at 7:19

GoogleCodeExporter commented 9 years ago
I known reason, but I don not know how to solve it.

from source code, we can see the history:

GUID_CLASS_COMPORT
↓
↓
aa5882dfa3bd
GUID_DEVCLASS_PORTS
↓
↓
3e39065422a9
GUID_DEVINTERFACE_COMPORT
↓
↓
ba72a2da9857
GUID_DEVCLASS_PORTS

The first one can solve the problem, but i don't know, why it is not be used 
again?

Original comment by dbzhang...@gmail.com on 10 Nov 2011 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 8:41