The goal is to connect a guitar to USB host capable Android device, do some processing on the signal and play it through the device.
Problem is I'm not finding much documentation on it. The device shows up can contains 6 interfaces.
However, in all the examples I see, the first interface is always used..
UsbInterface intf = device.getInterface(0);
My device contains 6 interfaces BUT the first interface, i.e. getInterface(0)
has no endpoints. 3/6 have no endpoints but the other 3 all have 1 end point.
I read that you need to find the correct interface and endpoint. In my case, I only want an IN endpoint to receive data.
Any advice on how to that would be very appreciated.
Cheers
The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
USB accessory mode allows users to connect USB host hardware specifically designed for Android-powered devices. The accessories must adhere to the Android accessory protocol outlined in the Android Accessory Development Kit documentation.
This is how I got down to the bottom of it.
The last interface, I believe is the one I am looking for.
It has a endpoint type value USB_ENDPOINT_XFER_ISOC (1) signifying the regular isochronous connection I was looking for
// Cycle through interfaces and print out endpoint info
StringBuilder builder = new StringBuilder();
for (int i=0; i<device.getInterfaceCount(); i++)
{
String epDirString = "No endpoints";
String epTypeString = "No endpoints";
if (device.getInterface(i).getEndpointCount() > 0)
{
epDirString = String.valueOf(device.getInterface(i).getEndpoint(0).getDirection());
epTypeString = String.valueOf(device.getInterface(i).getEndpoint(0).getType());
}
builder.append("Int. " + i + " EP count: " + device.getInterface(i).getEndpointCount() +
" || EP direction: " + epDirString + " || EP type: " + epTypeString + "\n");
}
// Show results in a dialog
Builder dBuilder = new AlertDialog.Builder(USBActivity.this);
dBuilder.setMessage(builder.toString()).show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With