Problem with rxtx end paraller port under linux

Discussion in 'Java' started by Brzezi, Jun 27, 2004.

  1. Brzezi

    Brzezi Guest

    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
    --
    [ E-mail: ][ MP3Blaster is playing now: ]
    [ Ekg: #3781111 ][ Title: Thats_All_I_Need_To_Know ]
    [ LinuxUser: #249916 ][ Artist: Track 07 ]
    [ Album: ]
     
    Brzezi, Jun 27, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Bitkiller

    Java rxtx libs

    Alex Bitkiller, Feb 17, 2004, in forum: Java
    Replies:
    2
    Views:
    4,294
    Alex Bitkiller
    Feb 18, 2004
  2. Nanou

    URGENT RXTX SERIAL PORT

    Nanou, May 31, 2005, in forum: Java
    Replies:
    0
    Views:
    447
    Nanou
    May 31, 2005
  3. Nanou

    URGENT RXTX SERIAL PORT

    Nanou, May 31, 2005, in forum: Java
    Replies:
    11
    Views:
    5,854
    Nanou
    Jun 2, 2005
  4. Arash Nikkar

    porting RXTX linux code to windows

    Arash Nikkar, Apr 12, 2006, in forum: Java
    Replies:
    5
    Views:
    1,668
    Martin Gregorie
    Apr 15, 2006
  5. joshua

    rxtx problem, please help!

    joshua, Jul 1, 2007, in forum: Java
    Replies:
    0
    Views:
    689
    joshua
    Jul 1, 2007
Loading...

Share This Page