mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:45:41 +01:00
amixer - fixed TLV dBscale and added dBrange parsing
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
e02535b1a8
commit
ec73719ec6
1 changed files with 25 additions and 5 deletions
|
@ -456,7 +456,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
|
||||||
unsigned int type = tlv[0];
|
unsigned int type = tlv[0];
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
|
|
||||||
if (tlv_size < 2 * sizeof(unsigned int)) {
|
if (tlv_size < 2 * sizeof(unsigned int)) {
|
||||||
printf("TLV size error!\n");
|
printf("TLV size error!\n");
|
||||||
return;
|
return;
|
||||||
|
@ -487,12 +487,12 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
|
||||||
printf("dBscale-");
|
printf("dBscale-");
|
||||||
if (size != 2 * sizeof(unsigned int)) {
|
if (size != 2 * sizeof(unsigned int)) {
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
printf("0x%x", tlv[idx++]);
|
printf("0x%08x,", tlv[idx++]);
|
||||||
size -= sizeof(unsigned int);
|
size -= sizeof(unsigned int);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("min=");
|
printf("min=");
|
||||||
print_dB(tlv[2]);
|
print_dB((int)tlv[2]);
|
||||||
printf(",step=");
|
printf(",step=");
|
||||||
print_dB(tlv[3] & 0xffff);
|
print_dB(tlv[3] & 0xffff);
|
||||||
printf(",mute=%i", (tlv[3] >> 16) & 1);
|
printf(",mute=%i", (tlv[3] >> 16) & 1);
|
||||||
|
@ -503,7 +503,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
|
||||||
printf("dBlinear-");
|
printf("dBlinear-");
|
||||||
if (size != 2 * sizeof(unsigned int)) {
|
if (size != 2 * sizeof(unsigned int)) {
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
printf("0x%x", tlv[idx++]);
|
printf("0x%08x,", tlv[idx++]);
|
||||||
size -= sizeof(unsigned int);
|
size -= sizeof(unsigned int);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -513,11 +513,31 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
|
||||||
print_dB(tlv[3]);
|
print_dB(tlv[3]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef SND_CTL_TLVT_DB_RANGE
|
||||||
|
case SND_CTL_TLVT_DB_RANGE:
|
||||||
|
printf("dBrange-\n");
|
||||||
|
if ((size / (6 * sizeof(unsigned int))) != 0) {
|
||||||
|
while (size > 0) {
|
||||||
|
printf("0x%08x,", tlv[idx++]);
|
||||||
|
size -= sizeof(unsigned int);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
idx = 0;
|
||||||
|
while (idx < size) {
|
||||||
|
print_spaces(spaces + 2);
|
||||||
|
printf("rangemin=%i,", tlv[0]);
|
||||||
|
printf(",rangemax=%i\n", tlv[1]);
|
||||||
|
decode_tlv(spaces + 4, tlv + 2, 6 * sizeof(unsigned int));
|
||||||
|
idx += 6 * sizeof(unsigned int);
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
printf("unk-%i-", type);
|
printf("unk-%i-", type);
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
printf("0x%x", tlv[idx++]);
|
printf("0x%08x,", tlv[idx++]);
|
||||||
size -= sizeof(unsigned int);
|
size -= sizeof(unsigned int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue