Skip to contentSkip to conversation

tools/avtest: Add AAC configuration

PATCH Applied Frédéric Danis 3 participants 3 messages Feb 20, 2025 – Feb 21, 2025 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/avtest: Add AAC configuration

The tests A2DP/SNK/AVP/BI-01-C, A2DP/SNK/AVP/BI-02-C, A2DP/SNK/AVP/BI-05-C and A2DP/SNK/AVP/BI-07-C expect the IUT to provide an AAC configuration.

This can be used by adding '--aac' to the avtest command, e.g. for A2DP/SNK/AVP/BI-01-C test:
tools/avtest --aac --reject setconf --reject-code 214

---
 tools/avtest.c | 49 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 12 deletions(-)
tools/avtest.c +37 -12
index 5ac3418aa..a52662d80 100644
@@ -151,7 +151,7 @@ struct avctp_header {
 
 #define AVCTP_PACKET_SINGLE	0
 
-static const unsigned char media_transport[] = {
+static const unsigned char media_transport_sbc[] = {
 		0x01,	/* Media transport category */
 		0x00,
 		0x07,	/* Media codec category */
@@ -164,6 +164,24 @@ static const unsigned char media_transport[] = {
 		0x33,
 };
 
+static const unsigned char media_transport_aac[] = {
+		0x01,	/* Media transport category */
+		0x00,
+		0x07,	/* Media codec category */
+		0x08,
+		0x00,	/* Media type audio */
+		0x02,	/* Codec MPEG2,4 AAC */
+		0x80,	/* Codec MPEG-2 AAC LC */
+		0x01,	/* 44100 */
+		0x8C,	/* 48000, 1 and 2 channels */
+		0x84,	/* VBR supported, Max peak rate 320000 */
+		0xE2,
+		0x00
+};
+
+static const unsigned char *media_transport = media_transport_sbc;
+static size_t media_transport_size = sizeof(media_transport_sbc);
+
 static int media_sock = -1;
 
 static void dump_avctp_header(struct avctp_header *hdr)
@@ -254,30 +272,30 @@ static void process_avdtp(int srv_sk, int sk, unsigned char reject,
 				start->signal_id = AVDTP_GET_CAPABILITIES;
 				start->no_of_packets = 3;
 				memcpy(&buf[3], media_transport,
-						sizeof(media_transport));
+						media_transport_size);
 				len = write(sk, buf,
 						3 + sizeof(media_transport));
 
 				/* Continue packet */
 				hdr->packet_type = AVDTP_PKT_TYPE_CONTINUE;
 				memcpy(&buf[1], media_transport,
-						sizeof(media_transport));
+						media_transport_size);
 				len = write(sk, buf,
-						1 + sizeof(media_transport));
+						1 + media_transport_size);
 
 				/* End packet */
 				hdr->packet_type = AVDTP_PKT_TYPE_END;
 				memcpy(&buf[1], media_transport,
-						sizeof(media_transport));
+						media_transport_size);
 				len = write(sk, buf,
-						1 + sizeof(media_transport));
+						1 + media_transport_size);
 			} else {
 				hdr->message_type = AVDTP_MSG_TYPE_ACCEPT;
 				memcpy(&buf[2], media_transport,
-						sizeof(media_transport));
+						media_transport_size);
 				printf("Accepting get capabilities command\n");
 				len = write(sk, buf,
-						2 + sizeof(media_transport));
+						2 + media_transport_size);
 			}
 			break;
 
@@ -578,10 +596,10 @@ static void do_avdtp_send(int sk, const bdaddr_t *src, const bdaddr_t *dst,
 		hdr->signal_id = AVDTP_SET_CONFIGURATION;
 		buf[2] = 1 << 2; /* ACP SEID */
 		buf[3] = 1 << 2; /* INT SEID */
-		memcpy(&buf[4], media_transport, sizeof(media_transport));
+		memcpy(&buf[4], media_transport, media_transport_size);
 		if (invalid)
 			buf[5] = 0x01; /* LOSC != 0 */
-		len = write(sk, buf, 4 + sizeof(media_transport));
+		len = write(sk, buf, 4 + media_transport_size);
 		break;
 
 	case AVDTP_GET_CONFIGURATION:
@@ -717,7 +735,8 @@ static void usage(void)
 		"\t--preconf            Configure stream before actual command\n"
 		"\t--wait <N>           Wait N seconds before exiting\n"
 		"\t--fragment           Use minimum MTU and fragmented messages\n"
-		"\t--invalid <command>  Send invalid command\n");
+		"\t--invalid <command>  Send invalid command\n"
+		"\t--aac                MPEG2,4 AAC LC\n");
 }
 
 static struct option main_options[] = {
@@ -731,6 +750,7 @@ static struct option main_options[] = {
 	{ "fragment",   0, 0, 'F' },
 	{ "avctp",	0, 0, 'C' },
 	{ "wait",	1, 0, 'w' },
+	{ "aac",	0, 0, 'a' },
 	{ 0, 0, 0, 0 }
 };
 
@@ -774,7 +794,7 @@ int main(int argc, char *argv[])
 	bacpy(&src, BDADDR_ANY);
 	bacpy(&dst, BDADDR_ANY);
 
-	while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFCw:R:",
+	while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFCw:R:a",
 						main_options, NULL)) != EOF) {
 		switch (opt) {
 		case 'i':
@@ -818,6 +838,11 @@ int main(int argc, char *argv[])
 			reject_code = atoi(optarg);
 			break;
 
+		case 'a':
+			media_transport = media_transport_aac;
+			media_transport_size = sizeof(media_transport_aac);
+			break;
+
 		case 'h':
 		default:
 			usage();
Signature · 1 line
2.43.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=935871

---Test result---

Test Summary:

CheckPatch                    PENDING   0.36 seconds
GitLint                       PENDING   0.32 seconds
BuildEll                      PASS      20.55 seconds
BluezMake                     PASS      1544.66 seconds
MakeCheck                     PASS      12.93 seconds
MakeDistcheck                 PASS      158.77 seconds
CheckValgrind                 PASS      213.74 seconds
CheckSmatch                   PASS      287.60 seconds
bluezmakeextell               PASS      98.18 seconds
IncrementalBuild              PENDING   0.39 seconds
ScanBuild                     PASS      870.44 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Frédéric Danis
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Thu, 20 Feb 2025 08:22:35 +0100 you wrote:

The tests A2DP/SNK/AVP/BI-01-C, A2DP/SNK/AVP/BI-02-C, A2DP/SNK/AVP/BI-05-C and A2DP/SNK/AVP/BI-07-C expect the IUT to provide an AAC configuration.

This can be used by adding '--aac' to the avtest command, e.g. for A2DP/SNK/AVP/BI-01-C test:
tools/avtest --aac --reject setconf --reject-code 214

[...]

Here is the summary with links:
- [BlueZ] tools/avtest: Add AAC configuration

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fc7be1e86771

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html