On Thu, 12 Apr 2018 16:49:27 +0200, Charles Flèche wrote: > > > Sort of, yes > > >From the snd_seq_query_port_subscribers doc: "To list up all the > subscriptions, call this function with the index numbers from 0 until this > returns a negative value." > > So does it mean than in certain cases snd_seq_query_port_subscribers > increments the index itself, and sometime it does not ? It shouldn't increment the index number by itself; at least the kernel interface doesn't do that. But the API doesn't check whether the backend (plugin) didn't touch the returned index value or not, so the possibility is still open :) Takashi > > Thanks, Takashi > > On Thu, Apr 12, 2018 at 4:44 PM, Takashi Iwai <tiwai@xxxxxxx> wrote: > > > On Sun, 08 Apr 2018 18:37:58 +0200, > > Charles Flèche wrote: > > > > > > Hi all, > > > > > > I'm iterating through subscribers with snd_seq_query_port_subscribers to > > > disconnect them. It works most of the time, but when a2j (an alsa -> jack > > > MIDI bridge) runs, snd_seq_query_port_subscribers does not update the > > subs > > > index, and the next call returns 0, leading to an infinite loop. I have > > to > > > manually increase the index when the disconnection fails (meaning that I > > > hit an a2j connection). > > > > > > while (snd_seq_query_port_subscribers(seq, subs) >= 0) { > > > addr = *snd_seq_query_subscribe_get_addr(subs); > > > if (snd_seq_disconnect_to(seq, port, addr.client, addr.port) < 0) { > > > snd_seq_query_subscribe_set_index(subs, > > > snd_seq_query_subscribe_get_index(subs) + 1); > > > } > > > } > > > > > > 1. Is the non-updated subs index an expected behavior ? > > > > Sort of, yes. It's no iterator operation like query_next_client. > > It just queries the given index and fills out the result. The user > > needs to iterate with incrementing the index manually. > > > > > 2. Is my fix a correct one or could it leads to other issues ? > > > > It's the correct implementation. > > > > > > HTH, > > > > Takashi > > > [2 <text/html; UTF-8 (quoted-printable)>] > _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel