Comment résoudre l'erreur java.io.IOException: erreur d'Entrée/sortie dans nativeavailable pour la Communication Série?

J'ai processeur Arm qui est AllWinner A13 ,mémoire RAM - 512 mo-OS - Linaro 13.01 Ubuntu (debian). Maintenant, je m faisant de Série du programme de Communication pour /dev/ttyS0. j'ai fait simple programme pour les Deux sens de Communication Série en java avec netbeans. Dans mon processeur je court rx-tx de ttyS0 pour la boucle de retour coonection vérification. Les moyens ce que j'ai envoyer par l'intermédiaire du port Série que je serai de retour en arrière. mais j'obtiens l'erreur. j'ai installé openjdk-7, librxtx-java sur mon processeur. mon code et l'erreur est ci-dessous. Si quelqu'un a une idée ou solution, alors s'il vous plaît suggérer à moi.

package serialcomm_linaro;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class TwoWaySerialComm
{
public TwoWaySerialComm()
{
super();
}
void connect ( String portName ) throws Exception
{
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if ( portIdentifier.isCurrentlyOwned() )
{
System.out.println("Error: Port is currently in use");
}
else
{
CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
if ( commPort instanceof SerialPort )
{
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();
(new Thread(new SerialReader(in))).start();
(new Thread(new SerialWriter(out))).start();
}
else
{
System.out.println("Error: Only serial ports are handled by this example.");
}
}     
}
/** */
public static class SerialReader implements Runnable 
{
InputStream in;
public SerialReader ( InputStream in )
{
this.in = in;
}
public void run ()
{
byte[] buffer = new byte[1024];
int len = -1;
try
{
while ( ( len = this.in.read(buffer)) > -1 )
{
System.out.print(new String(buffer,0,len));
}
}
catch ( IOException e )
{
e.printStackTrace();
}            
}
}
/** */
public static class SerialWriter implements Runnable 
{
OutputStream out;
public SerialWriter ( OutputStream out )
{
this.out = out;
}
public void run ()
{
try
{                
int c = 0;
while ( ( c = System.in.read()) > -1 )
{
this.out.write(c);
}                
}
catch ( IOException e )
{
e.printStackTrace();
}            
}
}
public static void main ( String[] args )
{
try
{
(new TwoWaySerialComm()).connect("/dev/ttyS0");
}
catch ( Exception e )
{
//TODO Auto-generated catch block
e.printStackTrace();
}
}
}

mon est ci-dessous . Dans ce hors je viens d'envoyer 123 et je reçois un retour en arrière 23 en premier et ensuite 1111... plus de temps, et puis errore. Au lieu de 111111.... je veux juste revenir 123.

enter code here
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyS0
123
23
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
java.io.IOExcepti on: Input/output error in nativeavailable
at gnu.io.RXTXPort.nativeavailable(Native Method)
at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1429)
at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1341)
at serialcomm_linaro.TwoWaySerialComm$SerialReader.run(TwoWaySerialComm.java:66)
at java.lang.Thread.run(Thread.java:722)

OriginalL'auteur Jay | 2013-03-22