I developed an Android application which connects to an external USB device to send and receive messages.
I followed the guidelines of the official Android Host USB API here (as well as a few other SO posts): https://developer.android.com/guide/topics/connectivity/usb/host.html
Everything works fine except for one thing: It seems that the external USB device is sending data when my app is not connected which causes it's USB buffers to overflow - which stops the device.
According to the device manufacturer the solution would be to enable DTR/DTE (which I have to admit I don't really understand what it is). But this apparently would enable them to check if my app is listening and only then send their data.
So, could you please share a code example of how to enable DTR/DTE on an Android USB connection?
Update:
After some more searching it seems that I'd need use the UsbDeviceConnection.controlTransfer method - but I have no idea what the parameters should be.
I finally found the answer:
connection.controlTransfer(0x21, 0x22, 0x1, 0, null, 0, 0);
I found it here: Android USB host read from device