]> git.alsa-project.org Git - alsa-utils.git/commitdiff
amixer - fixed TLV dBscale and added dBrange parsing
authorJaroslav Kysela <perex@t61.perex-int.cz>
Thu, 14 Aug 2008 12:57:19 +0000 (14:57 +0200)
committerJaroslav Kysela <perex@t61.perex-int.cz>
Thu, 14 Aug 2008 12:57:43 +0000 (14:57 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
amixer/amixer.c

index 61259f6703dd05c1322f8ccbc3c4c8340dacfb36..f93fa9eb627c46a145dc6a4741db94f183505944 100644 (file)
@@ -456,7 +456,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
        unsigned int type = tlv[0];
        unsigned int size;
        unsigned int idx = 0;
-       
+
        if (tlv_size < 2 * sizeof(unsigned int)) {
                printf("TLV size error!\n");
                return;
@@ -487,12 +487,12 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
                printf("dBscale-");
                if (size != 2 * sizeof(unsigned int)) {
                        while (size > 0) {
-                               printf("0x%x", tlv[idx++]);
+                               printf("0x%08x,", tlv[idx++]);
                                size -= sizeof(unsigned int);
                        }
                } else {
                        printf("min=");
-                       print_dB(tlv[2]);
+                       print_dB((int)tlv[2]);
                        printf(",step=");
                        print_dB(tlv[3] & 0xffff);
                        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-");
                if (size != 2 * sizeof(unsigned int)) {
                        while (size > 0) {
-                               printf("0x%x", tlv[idx++]);
+                               printf("0x%08x,", tlv[idx++]);
                                size -= sizeof(unsigned int);
                        }
                } else {
@@ -513,11 +513,31 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
                        print_dB(tlv[3]);
                }
                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
        default:
                printf("unk-%i-", type);
                while (size > 0) {
-                       printf("0x%x", tlv[idx++]);
+                       printf("0x%08x,", tlv[idx++]);
                        size -= sizeof(unsigned int);
                }
                break;