The problem:
jni side open serial port and set parameters ok, tested out and work fine.
java side only read device the following way:
in = new BufferedInputStream(new FileInputStream("/dev/ttyUSB0"));
The port number is correct I have tested out it!
The above code it own thread, of course not blocking UI worker thread!
byte[] bytes= new byte[1024];
ByteArrayOutputStream byteStream= new ByteArrayOutputStream();
int len;
len=in.read(bytes);// This is line which doesn't work!
byteStream.write(bytes, 0, len);
if(len!=-1) {
// And here I will be parsed data.
}
So I want open serial port and set parameters in jni side, and it's working nice, also close to port works well. But now I want to read to the open ttyUSB0 port in own thread, but it crash in line
len = in.read(bytes);
Android manifest file includes
uses-permission android:name="android.permission.ACCESS_SUPERUSER"
before application application part.
Thanks for helps!