alsa-utils: amixer: Fix SND_CTL_TLVT_DB_RANGE handling

Current support for handling SND_CTL_TLVT_DB_RANGE in amixer is completely
broken. This patch fixes it.

Reported-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Lars-Peter Clausen 2011-06-16 14:19:18 +02:00 committed by Takashi Iwai
parent 471191abe5
commit 8709ffe841

View file

@ -517,20 +517,20 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
#ifdef SND_CTL_TLVT_DB_RANGE #ifdef SND_CTL_TLVT_DB_RANGE
case SND_CTL_TLVT_DB_RANGE: case SND_CTL_TLVT_DB_RANGE:
printf("dBrange-\n"); printf("dBrange-\n");
if ((size / (6 * sizeof(unsigned int))) != 0) { if ((size % (6 * sizeof(unsigned int))) != 0) {
while (size > 0) { while (size > 0) {
printf("0x%08x,", tlv[idx++]); printf("0x%08x,", tlv[idx++]);
size -= sizeof(unsigned int); size -= sizeof(unsigned int);
} }
break; break;
} }
idx = 0; while (size > 0) {
while (idx < size) {
print_spaces(spaces + 2); print_spaces(spaces + 2);
printf("rangemin=%i,", tlv[0]); printf("rangemin=%i,", tlv[idx++]);
printf(",rangemax=%i\n", tlv[1]); printf(",rangemax=%i\n", tlv[idx++]);
decode_tlv(spaces + 4, tlv + 2, 6 * sizeof(unsigned int)); decode_tlv(spaces + 4, tlv + idx, 4 * sizeof(unsigned int));
idx += 6 * sizeof(unsigned int); idx += 4;
size -= 6 * sizeof(unsigned int);
} }
break; break;
#endif #endif