Diff between fee302da253595b405eda54051106bd109cf1120 and a238e3b108c9bebc3d0a321f816ab205d0048cf1

Changed Files

File Additions Deletions Status
tools/parser/avdtp.c +47 -3 modified

Full Patch

diff --git a/tools/parser/avdtp.c b/tools/parser/avdtp.c
index 5806c07..14dc417 100644
--- a/tools/parser/avdtp.c
+++ b/tools/parser/avdtp.c
@@ -150,6 +150,13 @@ static char *codec2str(uint8_t type, uint8_t codec)
 	return "Unknown";
 }
 
+static char *vndcodec2str(uint32_t vendor, uint16_t vndcodec)
+{
+	if (vendor == 0x0000004f && vndcodec == 0x0001)
+		return "aptX";
+	return "Unknown";
+}
+
 static char *cat2str(uint8_t cat)
 {
 	switch (cat) {
@@ -213,13 +220,23 @@ static void capabilities(int level, struct frame *frm)
 
 		if (cat == 7) {
 			uint8_t type, codec;
-			uint16_t tmp, freq;
-			uint32_t bitrate;
+			uint16_t tmp, freq, vndcodec = 0;
+			uint32_t bitrate, vendor = 0;
 
 			type  = get_u8(frm);
 			codec = get_u8(frm);
 
-			printf("%s - %s\n", cat2str(cat), codec2str(type, codec));
+			if (codec == 255) {
+				vendor = btohl(htonl(get_u32(frm)));
+				vndcodec = btohs(htons(get_u16(frm)));
+
+				printf("%s - %s (%s)\n", cat2str(cat),
+						codec2str(type, codec),
+						vndcodec2str(vendor, vndcodec));
+			} else {
+				printf("%s - %s\n", cat2str(cat),
+							codec2str(type, codec));
+			}
 
 			switch (codec) {
 			case 0:
@@ -324,6 +341,33 @@ static void capabilities(int level, struct frame *frm)
 				printf("%ubps ", bitrate);
 				printf("%s\n", tmp & 0x80 ? "VBR" : "");
 				break;
+			case 255:
+				if (vendor == 0x0000004f &&
+							vndcodec == 0x0001) {
+					tmp = get_u8(frm);
+					p_indent(level + 1, frm);
+					if (tmp & 0x80)
+						printf("16kHz ");
+					if (tmp & 0x40)
+						printf("32kHz ");
+					if (tmp & 0x20)
+						printf("44.1kHz ");
+					if (tmp & 0x10)
+						printf("48kHz ");
+					printf("\n");
+					p_indent(level + 1, frm);
+					if (tmp & 0x02)
+						printf("Stereo ");
+					if (tmp & 0x01)
+						printf("Mono ");
+					printf("\n");
+					break;
+				} else {
+					hex_dump(level + 1, frm, len - 8);
+					frm->ptr += (len - 8);
+					frm->len -= (len - 8);
+				}
+				break;
 			default:
 				hex_dump(level + 1, frm, len - 2);
 				frm->ptr += (len - 2);