OSDN Git Service

ucm: fixed find-device substitution (non-continuous PCM devices)
authorJaroslav Kysela <perex@perex.cz>
Fri, 16 Apr 2021 12:48:08 +0000 (14:48 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 16 Apr 2021 12:48:11 +0000 (14:48 +0200)
The PCM device numbers may be non-continous. Skip them when -ENOENT error
is returned.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/ucm_subs.c

index b9fee72..c56730c 100644 (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;
        }