Hi ALSA devs,
I work on Android and starting from Android T, we use libusb to connect to an MIDI peripheral when Android is in host mode. We do this by opening the device, disconnecting the kernel MIDI interface, claiming the MIDI interface, and using its endpoints.
However, we started getting bug reports from customers that some USB peripherals stop playing audio once MIDI is opened.
Disconnecting the kernel MIDI interface with USBDEVFS_DISCONNECT causes the USB sound card to disappear for some devices. I tested with 6 USB interfaces with both MIDI and audio and I found the following.
1. I can disconnect the Audio Control, Audio Streaming, and Midi Streaming interfaces on the Komplete Audio 6 and the Alesis iO4 without the sound card disappearing. 2. I can disconnect the Audio Streaming and MIDI Streaming interfaces on the PreSonus USB 96 without the sound card disappearing. Disconnecting the Audio Control interface causes the sound card to disappear. 3. I can disconnect the Audio Streaming interface on the PreSonus Studio 26c, Yamaha AG06, and the Focusrite Scarlett 2i4 without the sound card disappearing. Disconnecting the Audio Control or MIDI Streaming interfaces causes the sound card to disappear.
After calling USBDEVFS_RESET, the sound cards come back up.
Does anyone know why certain USB peripherals do not handle USBDEVFS_DISCONNECT cleanly on certain interfaces?
Thanks, Robert