[alsa-devel] [PATCH 1/2] ALSA: ASoC: add STA32X codec driver

Lars-Peter Clausen lars at metafoo.de
Thu Jun 16 13:38:37 CEST 2011


On 06/16/2011 01:26 PM, Daniel Mack wrote:
> [...]
> Looks different now, but I'd say that's still not what you expected:
> 
> # amixer cget numid=39
> numid=39,iface=MIXER,name='Limiter1 Attack Threshold (DRC Mode)'
>   ; type=INTEGER,access=rw---R--,values=1,min=0,max=16,step=0
>   : values=9
>   | dBrange-
>     rangemin=3,,rangemax=72
>       |
>     rangemin=3,,rangemax=72
>       |
>     rangemin=3,,rangemax=72
>       |

Ok, looks like the current implementation is completely broken...

diff --git a/amixer/amixer.c b/amixer/amixer.c
index a177288..3bc6743 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -517,20 +517,20 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
 #ifdef SND_CTL_TLVT_DB_RANGE
 	case SND_CTL_TLVT_DB_RANGE:
 		printf("dBrange-\n");
-		if ((size / (6 * sizeof(unsigned int))) != 0) {
+		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) {
+		while (size >= 0) {
 			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);
+			printf("rangemin=%i,", tlv[idx++]);
+			printf(",rangemax=%i\n", tlv[idx++]);
+			decode_tlv(spaces + 4, tlv + idx, 4 * sizeof(unsigned int));
+			idx += 4 * sizeof(unsigned int);
+			size -= 6 * sizeof(unsigned int);
 		}
 		break;
 #endif


More information about the Alsa-devel mailing list