]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: info - handle situations when devices are not available in kernel
authorJaroslav Kysela <perex@perex.cz>
Thu, 9 Jan 2025 15:09:22 +0000 (16:09 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 9 Jan 2025 15:11:13 +0000 (16:11 +0100)
The kernel returns ENOTTY error in this case. Do nothing for this error code.

Closes: https://github.com/alsa-project/alsa-utils/issues/287
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/info.c

index 31b32945c4e01f318cf99d45dae1f6eae7b55a56..9acd701f10845943b72c82aeb1d169f56b3b0a8e 100644 (file)
@@ -35,6 +35,8 @@ static int pcm_device_list(snd_ctl_t *ctl, snd_pcm_stream_t stream, bool *first)
        streamfirst = true;
        while (1) {
                if ((err = snd_ctl_pcm_next_device(ctl, &dev)) < 0) {
+                       if (err == ENOTTY)      /* no kernel support */
+                               return 0;
                        error("snd_ctl_pcm_next_device: %s", snd_strerror(err));
                        return err;
                }
@@ -102,6 +104,8 @@ static int rawmidi_device_list(snd_ctl_t *ctl, snd_rawmidi_stream_t stream, bool
        streamfirst = true;
        while (1) {
                if ((err = snd_ctl_rawmidi_next_device(ctl, &dev)) < 0) {
+                       if (err == ENOTTY)      /* no kernel support */
+                               return 0;
                        error("snd_ctl_rawmidi_next_device: %s", snd_strerror(err));
                        return err;
                }
@@ -159,7 +163,9 @@ static int hwdep_device_list(snd_ctl_t *ctl)
        first = true;
        while (1) {
                if ((err = snd_ctl_hwdep_next_device(ctl, &dev)) < 0) {
-                       error("snd_ctl_pcm_next_device");
+                       if (err == ENOTTY)      /* no kernel support */
+                               return 0;
+                       error("snd_ctl_pcm_next_device: %s", snd_strerror(err));
                        return err;
                }
                if (dev < 0)