[alsa-devel] seq module loading issue
Clemens Ladisch
clemens at ladisch.de
Thu Oct 9 09:29:03 CEST 2014
Adam Goode wrote:
> I've observed a scenario in ALSA that I would like some feedback on
> solving. On Linux, Chrome uses seq for WebMIDI. Eventually, there will be
> hotplug detection code in Chrome that looks like this:
>
> 1. Connect to announce port
> 2. Listen for any announcements for client/port start/end
> 3. Send MIDIConnectionEvent events to JavaScript clients (
> http://webaudio.github.io/web-midi-api/#midiconnectionevent-interface)
>
> Here is the scenario where this fails:
>
> 1. Cold boot a machine with no MIDI devices plugged in
> 2. Start client, subscribe on the seq announce port
> 3. Insert USB MIDI device
> 4. snd_rawmidi module is loaded, triggered by insertion of MIDI device
> 5. snd_seq_midi is NOT loaded, but marked for loading later
>
> At this point, there is no client start event sent to the announce port.
In practice, programs that listen to these announcements do so in order
to dynamically update their own list of MIDI clients/ports, and
enumerating those would have triggered autoloading. This might be the
reason that this problem has not been reported so far.
I don't know about your implementation of the MIDIAccess interface, but
it looks as if enumeration is needed when the client accesses either the
"inputs" or "outputs" fields. Couldn't you trigger the same enumeration
when the onconnect/ondisconnect event handlers are set?
Regards,
Clemens
More information about the Alsa-devel
mailing list