Friday, March 23, 2012

[android-developers] usbReqest.queue not returning requested number of bytes

I have a USB device that I know is functional as it works under other
operating systems with drivers I've written. In its test mode, it
simply keeps the USB pipe full at the device end, transferring data as
fast as possible over the USB. At the receive end (my Galaxy Nexus
with ICS 4.0.2) I am doing something like this:

int txSize = 128*256;
UsbRequest usbReq = new UsbRequest();
usbReq.initialize(mConnection, mEndpoint); // mConnection and
mEndpoint were set up, earlier

ByteBuffer usbBuf = ByteBuffer.allocate(txSize);
usbReq .queue(usbBuf , txSize );

UsbRequest request = mConnection.requestWait();

After the above line is executed, I would expect that usbBuf would
contain txSize bytes of data from my device (which is writing out a
pattern). It does not, however. Furthermore, the time it takes to
"transfer" the data is constant for anything more than about 4K bytes.
This leads me to believe that I cannot queue more than 4K but I don't
see this documented, anywhere. Doing such small queue requests is a
problem for me (I could do it, but it complicates my program logic) so
I am hoping there may be a way around this. Is there a timeout for
asynchronous transfers that I'm exceeding (I'm going as fast as
possible over USB so it's odd that I would exceed a timeout, but if
it's really short...) I see good data on the USB with my USB analyzer
so it does seem that the data are lost at the phone.

Anyone see better than 4K USB transfers in asynchronous mode?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate