alsa-project / alsa-lib

The Advanced Linux Sound Architecture (ALSA) - library
GNU Lesser General Public License v2.1
345 stars 174 forks source link

controlC1 no longer show up after USBDEVFS_DISCONNECT #276

Closed robertwu1 closed 1 year ago

robertwu1 commented 1 year ago

After running the following IOCTL on some MIDI devices, the control C1 device node is gone.

struct usbdevfs_ioctl ctl;

ctl.ifno = interface; // MIDI interface
ctl.ioctl_code = USBDEVFS_DISCONNECT;
ctl.data = NULL;
return ioctl(device->fd, USBDEVFS_IOCTL, &ctl);

Under /dev/snd, the following disappears: controlC1, midiC1D0, pcmC1D0c, pcmC1D0p.

MidiControl, AudioStreaming, and AudioControl are under separate interfaces. If some of these were to disappear, I expect only midiC1D0 to disappear.

I've tested the following devices:

/dev/snd looks the same after USBDEVFS_DISCONNECT: PreSonus AudioBox 96, Alesis iO4, Komplete Audio 6.

controlC1, midiC1D0, pcmC1D0c, pcmC1D0p are gone: PreSonus Studio 26c, Yamaha AG06.

Here is a public Android bug of users having issues of this on Android: https://issuetracker.google.com/issues/251050530

perexg commented 1 year ago

This is alsa-lib's issue tracker. For kernel issues use https://bugzilla.kernel.org (Audio group).

MidiControl, AudioStreaming, and AudioControl are under separate interfaces. If some of these were to disappear, I expect only midiC1D0 to disappear.

This expectation is not correct. ALSA creates a soundcard which contains all components (PCM, MIDI, MIXER) as one logical block of devices. The ALSA USB driver handles the disconnect for all of those components together.

Your use seems a bit non-standard. You can discuss this on the alsa-devel mailing list - https://www.alsa-project.org/main/index.php?title=Mailing-lists .