amixer: fix display of unreadable control elements

When an element is marked as not readble, do not try to read it and then
complain about the error, but just ignore it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
Clemens Ladisch 2010-02-01 13:22:39 +01:00
parent 0034b1f83f
commit cdc496addb

View file

@ -602,6 +602,8 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
break; break;
} }
if (level & LEVEL_BASIC) { if (level & LEVEL_BASIC) {
if (!snd_ctl_elem_info_is_readable(info))
goto __skip_read;
if ((err = snd_hctl_elem_read(elem, control)) < 0) { if ((err = snd_hctl_elem_read(elem, control)) < 0) {
error("Control %s element read error: %s\n", card, snd_strerror(err)); error("Control %s element read error: %s\n", card, snd_strerror(err));
return err; return err;
@ -638,6 +640,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
} }
} }
printf("\n"); printf("\n");
__skip_read:
if (!snd_ctl_elem_info_is_tlv_readable(info)) if (!snd_ctl_elem_info_is_tlv_readable(info))
goto __skip_tlv; goto __skip_tlv;
tlv = malloc(4096); tlv = malloc(4096);