[Rxtx] I got a COM detected but treated as a LPRPort
Alessandro Di Giovanni
alexdigio at gmail.com
Tue Mar 30 10:20:27 MDT 2010
Hi everybody,
I'm new to rxtx. I'm using it to write to a Serial Port on windows.
The different COM Ports are correctly detected by this function:
--code--------------
public Vector getDetectedSerialPorts(){
CommPortIdentifier portId;
Enumeration en = CommPortIdentifier.getPortIdentifiers();
Vector v = new Vector();
while(en.hasMoreElements()){
portId = (CommPortIdentifier) en.nextElement();
if(portId.getPortType() == CommPortIdentifier.PORT_SERIAL){
v.add(portId.getName());
}
}
return v;
}
--------------------
I tested the the application on my laptop (who has no physical Serial Ports)
just to check with a "Serial Port Sniffer" if the data were sent, and it
works: the function above finds a (virtual?) serial port and the sniffer
catches the bytes I write on that port.
Paradoxically my problem rises when I run the application on a machine with
real Serial ports:
"getDetectedSerialPorts()" works as before. It detects all of the serial
ports, but when I try to write on one of them, it looks like it's treated
like an LPRPort.
This is what I get when I try to write (e.g. on the detected COM1):
-------------------------
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
gnu.io.LPRPort
cannot be cast to gnu.io.SerialPort
-------------------------
If you have an idea about where I'm wrong, I'd be happy to know.
Thank you,
Alessandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qbang.org/pipermail/rxtx/attachments/20100330/61b4e19f/attachment-0819.htm>
More information about the Rxtx
mailing list