linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] tools/hcidump: Decode FastStream, aptX Low Latency, aptX HD and LDAC
Date: Wed, 23 Jan 2019 18:45:04 +0100	[thread overview]
Message-ID: <20190123174504.12350-1-pali.rohar@gmail.com> (raw)

---
 tools/parser/avdtp.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 55 insertions(+), 3 deletions(-)

diff --git a/tools/parser/avdtp.c b/tools/parser/avdtp.c
index 18569c895..a21410f5a 100644
--- a/tools/parser/avdtp.c
+++ b/tools/parser/avdtp.c
@@ -155,6 +155,12 @@ static char *vndcodec2str(uint32_t vendor, uint16_t vndcodec)
 {
 	if (vendor == 0x0000004f && vndcodec == 0x0001)
 		return "aptX";
+	else if (vendor == 0x0000000a && vndcodec == 0x0001)
+		return "FastStream";
+	else if (vendor == 0x0000000a && vndcodec == 0x0002)
+		return "aptX Low Latency";
+	else if (vendor == 0x000000d7 && vndcodec == 0x0024)
+		return "aptX HD";
 	else if (vendor == 0x0000012d && vndcodec == 0x00aa)
 		return "LDAC";
 	return "Unknown";
@@ -403,8 +409,10 @@ static void capabilities(int level, struct frame *frm)
 				printf("%s\n", tmp & 0x80 ? "VBR" : "");
 				break;
 			case 255:
-				if (vendor == 0x0000004f &&
-							vndcodec == 0x0001) {
+				if ((vendor == 0x0000004f && vndcodec == 0x0001) ||
+				    (vendor == 0x0000000a && vndcodec == 0x0002) ||
+				    (vendor == 0x000000d7 && vndcodec == 0x0024)) {
+					/* aptX, aptX Low Latency, aptX HD */
 					tmp = p_get_u8(frm);
 					p_indent(level + 1, frm);
 					if (tmp & 0x80)
@@ -422,7 +430,51 @@ static void capabilities(int level, struct frame *frm)
 					if (tmp & 0x01)
 						printf("Mono ");
 					printf("\n");
-					break;
+				} else if (vendor == 0x0000000a && vndcodec == 0x0001) {
+					/* FastStream */
+					tmp = p_get_u8(frm);
+					freq = p_get_u8(frm);
+					if (tmp & 0x1) {
+						p_indent(level + 1, frm);
+						printf("Sink ");
+						if (freq & 0x2)
+							printf("44.1kHz ");
+						if (freq & 0x1)
+							printf("48kHz ");
+						printf("\n");
+					}
+					if (tmp & 0x2) {
+						p_indent(level + 1, frm);
+						printf("Source ");
+						if (freq & 0x20)
+							printf("16kHz ");
+						printf("\n");
+					}
+				} else if (vendor == 0x0000012d && vndcodec == 0x00aa) {
+					/* LDAC */
+					tmp = p_get_u8(frm);
+					p_indent(level + 1, frm);
+					if (tmp & 0x20)
+						printf("44.1kHz ");
+					if (tmp & 0x10)
+						printf("48kHz ");
+					if (tmp & 0x08)
+						printf("88.2kHz ");
+					if (tmp & 0x04)
+						printf("96kHz ");
+					if (tmp & 0x02)
+						printf("176.4kHz ");
+					if (tmp & 0x01)
+						printf("192kHz ");
+					printf("\n");
+					p_indent(level + 1, frm);
+					if (tmp & 0x01)
+						printf("Stereo ");
+					if (tmp & 0x02)
+						printf("Dual ");
+					if (tmp & 0x04)
+						printf("Mono ");
+					printf("\n");
 				} else {
 					hex_dump(level + 1, frm, len - 8);
 					frm->ptr += (len - 8);
-- 
2.11.0


             reply	other threads:[~2019-01-23 17:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 17:45 Pali Rohár [this message]
2019-01-23 17:46 ` [PATCH] tools/hcidump: Decode FastStream, aptX Low Latency, aptX HD and LDAC Marcel Holtmann
2019-01-23 17:54   ` Pali Rohár
2019-01-30  8:15     ` Pasi Kärkkäinen
2019-01-30 12:06       ` Pali Rohár
2019-01-30 12:24         ` Luiz Augusto von Dentz
2019-02-01 12:43           ` Pasi Kärkkäinen
2019-02-06 11:43             ` Pali Rohár
2019-02-24 13:19               ` Pasi Kärkkäinen
2019-03-05 12:26                 ` Pali Rohár
2019-04-10  8:29                   ` Pali Rohár
2019-06-07 13:07                     ` Pali Rohár
2019-10-14 11:07                       ` Pali Rohár
2020-02-09 13:05                         ` Pali Rohár
2020-04-14 23:00                           ` Pali Rohár
2020-05-03 11:14                             ` Pali Rohár
2020-08-08 13:24                               ` Pali Rohár
2020-09-29 21:34                                 ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123174504.12350-1-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).