title: reading data from usb serial port in Android
body: <p>I use prolifit PL23023 chip for send and receive data to my android app. I Handled driver thing about pl2303 and I can write and read data over serial. but the problem is when for example I receive a 15 byte data,its read in a 11byte data and a 4byte data. no data loss,its give me all data but in a 11byte packets.
  I controlled every thing about buffer size and it seems no problem.
  This is method that reads data:</p>
  
  <pre><code>    @Override
      public int read(byte[] dest, int timeoutMillis) throws IOException {
        //  synchronized (mReadBufferLock) {
              int readAmt = Math.min(dest.length, mReadBuffer.length);
  
              int numBytesRead = mConnection.bulkTransfer(mReadEndpoint, mReadBuffer,
                      readAmt, timeoutMillis);
              if (numBytesRead &lt; 0) {
                  return 0;
              }
              System.arraycopy(mReadBuffer, 0, dest, 0, numBytesRead);
              return numBytesRead;
          //}
      }
  </code></pre>
  
  <p>and bulkTransfer() method finally executed in native methods and we do not know about what is going in bulkTransfer().</p>
  
  <p>and interesting thing about this functionality is that when I put a break point in first of this line.</p>
  
  <pre><code>   int numBytesRead = mConnection.bulkTransfer(mReadEndpoint, mReadBuffer,
                      readAmt, timeoutMillis);
  </code></pre>
  
  <p>and run the program in Debug mode, the value of numBytesRead in 15 byte example sets to 15 and every thing is ok! I dont know what is happening. in debug mode I can get more than 11 byte packets but in normal mode I can get only 11 byte packets.</p>