[alsa-devel] snd_seq_query_port_subscribers not updating subs index

Charles Flèche charles.fleche at free.fr
Sun Apr 8 18:37:58 CEST 2018


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 ?

2. Is my fix a correct one or could it leads to other issues ?

Many thanks,


More information about the Alsa-devel mailing list