I have the following use case:
At step 6, I get USB error 7: Transfer error on bulk endpoint: Operation timed out
on the accessory - the same as when the app is not running at all! This happens, even though the app is notified that an UsbAccessory is available.
What is the correct way to handle this situation?
Currently if the app is closed, there is no way to reopen the port for receiving from the android side. It is caused by a bug in the lower layer driver implementation.
One way to handle this is to have a protocol running to check if the app is alive. If it's not alive, one of the possible ways to recover is to power cycle the usb port from the accessory side.
The best way to trigger the lower layer driver to re-enumerate is to power cycle the usb port as of now.
If you where to close the port before the app is closed, it would work fine. But that is not the case here since the app is being killed.