Problem with rxtx end paraller port under linux

B

Brzezi

Hi.

I am trying make paraller port to work under linux using rxtx library for
java, but i have problems:

port is recognized and opened correctly, but i cant read from it :/

It is my simple code:

#v+
<code>
import gnu.io.*;
[...]

CommPortIdentifier portId = null;
try{
portId = CommPortIdentifier.getPortIdentifier("/dev/lp0");
}
catch(NoSuchPortException e){
System.out.println(e);
}

CommPort port = null;

try{
port = portId.open("Tester", 1000);
}
catch(PortInUseException e){
System.out.println(e);
}

InputStream in = null;

try{
in = port.getInputStream();
}
catch(IOException e){
System.out.println(e);
}

try{
System.out.println("Wczytano: " + in.read()); // here is
// thrown exception
}catch(IOException e){
System.out.println(e.getMessage());
}

port.close();
}
</code>
#v-

When I run this code, I get Exception: "Input/output error in readByte"
this exception is thrown in line which I marked...

What is the problem? do you have any solution? or mayby there is any other
library for paraller/serial port?


PS. serial port works fine, when I change "/dev/lp0" to "/dev/ttyS0"
program waits for data to read, doesent throw any exception

Pozdrawiam
Brzezi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top