this.sp = new RXTXPort("/dev/ttyS0");
sp.setInputBufferSize(0);
sp.setOutputBufferSize(0);
- sp.sendBreak(100);
- Thread.sleep(100);
- sp.sendBreak(100);
+ sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
+ sp.setFlowControlMode(sp.FLOWCONTROL_RTSCTS_IN | sp.FLOWCONTROL_RTSCTS_OUT);
try {
_run();
} finally {
System.err.println("login string: " + sb.toString());
if (!sb.toString().startsWith(pass_string)) return;
- //try { Thread.sleep(2000); } catch(Exception e) { }
+ //try { Thread.sleep(500); } catch(Exception e) { }
final OutputStream os = socket.getOutputStream();
- System.err.println("sending instructions...");
- sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
- sp.setFlowControlMode(sp.FLOWCONTROL_RTSCTS_IN | sp.FLOWCONTROL_RTSCTS_OUT);
+ System.out.println("sending breaks");
+ for(int i=0; i<2; i++) {
+ sp.sendBreak(100);
+ Thread.sleep(100);
+ }
+ System.out.println("done sending breaks");
+
final OutputStream fos = sp.getOutputStream();
final InputStream fis = sp.getInputStream();
- while(fis.available() > 0)
- is.read();
+ System.err.println("sending instructions...");
new Thread() {
public void run() {
try {