Skip to content

Commit

Permalink
alsactl: info - handle situations when devices are not available in k…
Browse files Browse the repository at this point in the history
…ernel

The kernel returns ENOTTY error in this case. Do nothing for this error code.

Closes: #287
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
perexg committed Jan 9, 2025
1 parent 258d649 commit 54e09df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion alsactl/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 54e09df

Please sign in to comment.