I'm writing a utility for an Android tablet that communicates with custom hardware over USB using a bulk endpoint. My development tablet is a rooted Nexus 10 (v4.4.3). Custom hardware is running Linux 3.2 using gadgetfs that appears to work fine for Linux<->Linux USB communication.
I am able to find the USB Device, verify the VID/PID, get permission, open the connection, get the interface, claim the interface, and get the endpoints. But when I attempt to send data using the following code, the application crashes:
int dataWritten = connection.bulkTransfer(endpoint, dataArray, dataArray.length, USB_TIMEOUT);
where connection is UsbDeviceConnection, endpoint is a UsbEndpoint (out), dataArray is byte[], and USB_TIMEOUT is set to 1000. Commenting out this code removes the crash.
I am unable to find out why the crash occurs since in order to attach my custom hardware to USB to test, I have to disconnect my laptop from USB debugging with the Eclipse Android Development Tools. When I reconnect to the ADT, all logging and stack trace dumps appear to have been lost. At this point I'm at a loss on how to proceed.
So my question is: How can I determine the cause of the crash if I have to disconnect my debugger in order to test it?
Thanks.