Parallel Port Issues

I'm in the process of adding port selection & configuration options to a program from a few years back, and have run into a few odd bugs that I can't piece together. Here's the long and short of it.

The troubles begin with list population. I'm using javax.comm combined with the following line...

Enumeration pList = CommPortIdentifier.getPortIdentifiers();

... to obtain a list of the available serial and parallel ports. This gives me COM1, LPT1, and LPT2. The issue there is that I don't HAVE two parallel ports -- both a glance through Windows' Device Manager and just looking at the back of the computer confirm it. Strangely enough, though, not only does this phantom port appear in the enumeration, but attempting to open it is giving me not a No Such Port Exception, but rather a Port in Use Exception. And trying to close the port results in a Null Pointer Exception. So to recap, I've found ports which aren't there, but are being used by something and can't be freed up.

It's a bit confounding, really.

Oh, and while LPT1 has connected using the same code, the function ParallelPort.setMode(int mode) isn't working properly; it will take LPT_MODE_SPP, but none of its brethren. No ECp, no EPP, no Nibble, no PS2.

Any chance anyone has seen these before? I'm aware that using a Windows machine and the no-longer-supported javax.comm is not recommended by Sun; would getting RXTX abe t all likely to solve these problems?

Thanks much.

[1508 byte] By [mhanlon2a] at [2007-11-27 7:51:57]
# 1

It miht not solve all you problems but getting RXTX is probably a worth while thing to do.

As for the phantom port; All javax.comm does is ask the operating system for the ports available. If it is giving spurious ports then either:

a) the OS is reportin that those ports exist. The port may exist in hardware and be used for something internal to your machine. It may exist and be disabled in your bios as you MB does not have sockets for it. It may be a USB device attached (internal or external) that pretends to be a parrallel port (etc. etc. etc.)

b) there is a bug in javax.comm that reports extranious ports (take a look at the bug database to see if it is a known problem)

matfud

matfuda at 2007-7-12 19:33:09 > top of Java-index,Java Essentials,Java Programming...