I am having problems with the UsbRequest class in Android 3.1.
This is my code:
ByteBuffer buffer = ByteBuffer.allocate(4096); buffer.order(ByteOrder.LITTLE_ENDIAN); UsbRequest request = new UsbRequest(); request.initialize(mConnection, mEndpointIn); request.queue(buffer, 4096); if (mConnection.requestWait() == request) { byte[] data = buffer.array(); }
The data array is 4096 in size, but the bytes actually received are much shorter.
How to determine the size of actually received bytes?
Thanks.
source share