best way to read from UsbDeviceConnection in USB host mode
<p>To read data from an opened USB connection one uses <code>UsbDeviceConnection bulkTransfer</code> method.</p>

<p>I have the situation that after sending a request the routine should read all incoming data, which can be just 8 bytes or even 300+ bytes.</p>

<p>The problem is that bulkTransfer does not read all the bytes for some reason - it just returns with some bytes while there could be more to come.</p>

<p>Is it better to write a loop around bulkTransfer until there is no more data, or increase the timeout, or possibly there is another approach.</p>

<p>What would be the best way to handle this?</p>

<p>I tried the loop approach and I am surprised that it only reads about 10-20 bytes each time with a timeout of even 1second. I am sure there is more data already available, don't know why it does not read more at a time.</p>

<p>Does it matter which buffersize one uses - many examples have 4096 but how does changing this influence the reading of data?</p>

<p>Many thanks</p>
