ucm: fixed find-device substitution (non-continuous PCM devices)

The PCM device numbers may be non-continous. Skip them when -ENOENT error
is returned.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-04-16 14:48:08 +02:00
parent 652ddf866f
commit 508506a80c

View File

@ -380,12 +380,15 @@ static struct lookup_iterate *rval_pcm_lookup1(struct lookup_iterate *iter,
snd_ctl_t *ctl = iter->ctl_list->ctl;
int err;
next:
if (snd_ctl_pcm_next_device(ctl, &device) < 0 || device < 0)
return NULL;
pcminfo = iter->info;
snd_pcm_info_set_device(pcminfo, device);
err = snd_ctl_pcm_info(ctl, pcminfo);
if (err < 0) {
if (err == -ENOENT)
goto next;
uc_error("Unable to obtain PCM info (device %d)", device);
return NULL;
}