Error to read /dev/ttyUSB0!
<p>The problem:</p>

<ul>
<li><p>jni side open serial port and set parameters ok, tested out and work fine.</p></li>
<li><p>java side only read device the following way:</p>

<pre><code>in = new BufferedInputStream(new FileInputStream("/dev/ttyUSB0"));
</code></pre></li>
</ul>

<p>The port number is correct I have tested out it!</p>

<p>The above code it own thread, of course not blocking UI worker thread!</p>

<pre><code>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.
}
</code></pre>

<p>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 </p>

<pre><code>len = in.read(bytes); 
</code></pre>

<p>Android manifest file includes</p>

<pre><code>uses-permission android:name="android.permission.ACCESS_SUPERUSER"
</code></pre>

<p>before application application part.</p>

<p>Thanks for helps!</p>
