Skip to contentSkip to conversation

adapter: Enable MSFT a2dp offload codec when Experimental is set

PATCH In review Kiran K 3 participants 12 messages Nov 19, 2021

Subsystems (2)
lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH v2 1/9 adapter: Enable MSFT a2dp offload codec when Experimental is set

This enables codec offload experimental feature if its UUIDs has been enabled by main.conf:Experimental or -E has been passed in the command line.

---
 src/adapter.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/main.c    |  1 +
 src/main.conf |  1 +
 3 files changed, 45 insertions(+)
src/adapter.c +43 -0
index 309956bbb5be..1627cc127057 100644
@@ -142,6 +142,13 @@ static const struct mgmt_exp_uuid codec_offload_uuid = {
 	.str = "a6695ace-ee7f-4fb9-881a-5fac66c629af"
 };
 
+/* 0cc2131f-96f0-4cd1-b313-b97e7cbc8335 */
+static const struct mgmt_exp_uuid msft_a2dp_offload_codecs_uuid = {
+	.val = { 0x35, 0x83, 0xbc, 0x7c, 0x7e, 0xb9, 0x13, 0xb3,
+		0xd1, 0x4c, 0xf0, 0x96, 0x1f, 0x13, 0xc2, 0x0c},
+	.str = "0cc2131f-96f0-4cd1-b313-b97e7cbc8335"
+};
+
 static DBusConnection *dbus_conn = NULL;
 
 static uint32_t kernel_features = 0;
@@ -9789,6 +9796,41 @@ static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
 	btd_error(adapter->dev_id, "Failed to set Codec Offload");
 }
 
+static void msft_a2dp_offload_complete(uint8_t status, uint16_t len,
+				       const void *param, void *user_data)
+{
+	struct btd_adapter *adapter = user_data;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+	if (status != 0) {
+		error("Set MSFT a2dp offload codec failed with status 0x%02x (%s)",
+		       status, mgmt_errstr(status));
+		return;
+	}
+
+	DBG("MSFT a2dp offload codecs successfully set");
+
+	if (action)
+		queue_push_tail(adapter->exps,
+				(void *)msft_a2dp_offload_codecs_uuid.val);
+}
+
+static void msft_a2dp_offload_func(struct btd_adapter *adapter, uint8_t action)
+{
+	struct mgmt_cp_set_exp_feature cp;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, msft_a2dp_offload_codecs_uuid.val, 16);
+	cp.action = action;
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
+		      adapter->dev_id, sizeof(cp), &cp,
+		      msft_a2dp_offload_complete, adapter, NULL) > 0)
+		return;
+
+	btd_error(adapter->dev_id, "Failed to set RPA Resolution");
+}
+
 static const struct exp_feat {
 	const struct mgmt_exp_uuid *uuid;
 	void (*func)(struct btd_adapter *adapter, uint8_t action);
@@ -9799,6 +9841,7 @@ static const struct exp_feat {
 	EXP_FEAT(&quality_report_uuid, quality_report_func),
 	EXP_FEAT(&rpa_resolution_uuid, rpa_resolution_func),
 	EXP_FEAT(&codec_offload_uuid, codec_offload_func),
+	EXP_FEAT(&msft_a2dp_offload_codecs_uuid, msft_a2dp_offload_func),
 };
 
 static void read_exp_features_complete(uint8_t status, uint16_t length,
src/main.c +1 -0
index dd954e1abfe9..9776ff89a1d9 100644
@@ -571,6 +571,7 @@ static const char *valid_uuids[] = {
 	"15c0a148-c273-11ea-b3de-0242ac130004",
 	"330859bc-7506-492d-9370-9a6f0614037f",
 	"a6695ace-ee7f-4fb9-881a-5fac66c629af",
+	"0cc2131f-96f0-4cd1-b313-b97e7cbc8335",
 	"*"
 };
 
src/main.conf +1 -0
index c82d7e6482c4..ab4a6128ad5c 100644
@@ -116,6 +116,7 @@
 # 15c0a148-c273-11ea-b3de-0242ac130004 (BlueZ Experimental LL privacy)
 # 330859bc-7506-492d-9370-9a6f0614037f (BlueZ Experimental Bluetooth Quality Report)
 # a6695ace-ee7f-4fb9-881a-5fac66c629af (BlueZ Experimental Offload Codecs)
+# 0cc2131f-96f0-4cd1-b313-b97e7cbc8335 (BlueZ Experimental MSFT a2dp offload Codecs)
 # Defaults to false.
 #Experimental = false
 
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 2/9 shared/util: Decode MSFT offload codec UUID

This adds MSFT offload codec UUID to uuid128_table so it is decoded by the likes of btmon.

---
 src/shared/util.c | 2 ++
 1 file changed, 2 insertions(+)
src/shared/util.c +2 -0
index 81b20d86f4ad..6754ca7bf17c 100644
@@ -1108,6 +1108,8 @@ static const struct {
 	{ "330859bc-7506-492d-9370-9a6f0614037f",
 		"BlueZ Experimental Bluetooth Quality Report" },
 	{ "a6695ace-ee7f-4fb9-881a-5fac66c629af", "BlueZ Offload Codecs"},
+	{ "0cc2131f-96f0-4cd1-b313-b97e7cbc8335",
+		"BlueZ Experimental MSFT offload codecs" },
 	{ }
 };
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v2 3/9 mgmt: Set MSFT offload codec feature

In reply to Kiran K

Add support to toggle msft offload codec feature.

---
 tools/btmgmt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
tools/btmgmt.c +42 -0
index 42ef9acefaea..3d76269b178a 100644
@@ -2597,6 +2597,46 @@ static void cmd_exp_offload_codecs(int argc, char **argv)
 	}
 }
 
+static void exp_msft_offload_rsp(uint8_t status, uint16_t len,
+				 const void *param, void *user_data)
+{
+	if (status != 0)
+		error("Set MSFT offload codec failed with status 0x%02x (%s)",
+		      status, mgmt_errstr(status));
+	else
+		print("MSFT Offload codec feature successfully set");
+
+	bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_exp_msft_offload_codecs(int argc, char **argv)
+{
+	/* 0cc2131f-96f0-4cd1-b313-b97e7cbc8335 */
+	static const uint8_t uuid[16] = {
+				0x35, 0x83, 0xbc, 0x7c, 0x7e, 0xb9, 0x13, 0xb3,
+				0xd1, 0x4c, 0xf0, 0x96, 0x1f, 0x13, 0xc2, 0x0c,
+	};
+	struct mgmt_cp_set_exp_feature cp;
+	uint8_t val;
+	uint16_t index;
+
+	if (parse_setting(argc, argv, &val) == false)
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	index = mgmt_index;
+	if (index == MGMT_INDEX_NONE)
+		index = 0;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, uuid, 16);
+	cp.action = val;
+
+	if (mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index, sizeof(cp), &cp,
+		      exp_msft_offload_rsp, NULL, NULL) == 0) {
+		error("Unable to send msft offload codecs feature cmd");
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+}
 static void class_rsp(uint16_t op, uint16_t id, uint8_t status, uint16_t len,
 							const void *param)
 {
@@ -5640,6 +5680,8 @@ static const struct bt_shell_menu main_menu = {
 		"Set bluetooth quality report feature"			},
 	{ "exp-offload",		"<on/off>",
 		cmd_exp_offload_codecs,	"Toggle codec support"		},
+	{ "exp-msft-offload",		"<on/off>",
+		cmd_exp_msft_offload_codecs, "Toggle msft codec support"},
 	{ "read-sysconfig",	NULL,
 		cmd_read_sysconfig,	"Read System Configuration"	},
 	{ "set-sysconfig",	"<-v|-h> [options...]",
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v2 4/9 adapter: API to check if MSFT a2dp codec is enabled

In reply to Kiran K

Add an utility API to check if MSFT a2dp codec feature is enabled in Kernel.

---
 src/adapter.c | 6 ++++++
 src/adapter.h | 2 ++
 2 files changed, 8 insertions(+)
src/adapter.c +6 -0
index 1627cc127057..fd5ce614bec5 100644
@@ -9796,6 +9796,12 @@ static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
 	btd_error(adapter->dev_id, "Failed to set Codec Offload");
 }
 
+bool is_msft_a2dp_offload_supported(struct btd_adapter *adapter)
+{
+	return queue_find(adapter->exps, is_exp_feature_uuid_the_same,
+			(void *)msft_a2dp_offload_codecs_uuid.val) != NULL;
+}
+
 static void msft_a2dp_offload_complete(uint8_t status, uint16_t len,
 				       const void *param, void *user_data)
 {
src/adapter.h +2 -0
index d191daf5dc12..3857126b4dff 100644
@@ -261,3 +261,5 @@ bool btd_adapter_set_allowed_uuids(struct btd_adapter *adapter,
 							struct queue *uuids);
 bool btd_adapter_is_uuid_allowed(struct btd_adapter *adapter,
 							const char *uuid_str);
+
+bool is_msft_a2dp_offload_supported(struct btd_adapter *adapter);
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v2 5/9 avdtp: Add a flag in struct avdtp to control MSFT a2dp offload

In reply to Kiran K

Define a flag in struct avdtp to mark the support of MSFT a2dp codecs. If the flag is set, for a2dp streaming offload path will be selected.

---
 profiles/audio/avdtp.c | 7 +++++++
 src/adapter.c          | 9 +++++++++
 2 files changed, 16 insertions(+)
profiles/audio/avdtp.c +7 -0
index d3dfbf96dda3..58d419fb3148 100644
@@ -409,6 +409,9 @@ struct avdtp {
 
 	/* Attempt stream setup instead of disconnecting */
 	gboolean stream_setup;
+
+	/* use offload for transport */
+	gboolean use_offload;
 };
 
 static GSList *state_callbacks = NULL;
@@ -2425,6 +2428,7 @@ struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device,
 							struct queue *lseps)
 {
 	struct avdtp *session;
+	char *use_offload;
 
 	session = g_new0(struct avdtp, 1);
 
@@ -2436,6 +2440,9 @@ struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device,
 
 	session->version = get_version(session);
 
+	if (is_msft_a2dp_offload_supported(avdtp_get_adapter(session)))
+		session->use_offload = TRUE;
+
 	if (!chan)
 		return session;
 
src/adapter.c +9 -0
index fd5ce614bec5..235748c52780 100644
@@ -9796,6 +9796,15 @@ static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
 	btd_error(adapter->dev_id, "Failed to set Codec Offload");
 }
 
+static bool is_exp_feature_uuid_the_same(const void *data,
+					 const void *match_data)
+{
+	if (sizeof(data) != sizeof(match_data))
+		return false;
+
+	return memcmp(data, match_data, sizeof(data)) == 0;
+}
+
 bool is_msft_a2dp_offload_supported(struct btd_adapter *adapter)
 {
 	return queue_find(adapter->exps, is_exp_feature_uuid_the_same,
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v2 6/9 avdtp: Add support for offload MSFT open command

In reply to Kiran K

In a2dp offload use case, controller needs to be sent MSFT avdtp command after opening media transport channel

---
 lib/bluetooth.h        |  7 +++++++
 profiles/audio/avdtp.c | 46 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)
lib/bluetooth.h +7 -0
index 0fcf412c6c6b..b4bbe1373403 100644
@@ -158,6 +158,13 @@ struct bt_codecs {
 	struct bt_codec codecs[];
 } __attribute__((packed));
 
+#define BT_MSFT		20
+struct bt_msft {
+	uint8_t sub_opcode;
+	uint8_t len;
+	uint8_t data[];
+} __attribute__((packed));
+
 /* Connection and socket states */
 enum {
 	BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
profiles/audio/avdtp.c +46 -0

58 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#6 lore raw

PATCH v2 7/9 avdtp: Add support for MSFT offload start command

In reply to Kiran K

Send MSFT avdtp start command to trigger a2dp offload streaming after sending remote AVDTP start command.

---
 profiles/audio/avdtp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
profiles/audio/avdtp.c +21 -0
index 6a56bd4507c4..72a5e9c5a82a 100644
@@ -2907,6 +2907,24 @@ static gboolean avdtp_open_resp(struct avdtp *session, struct avdtp_stream *stre
 	return TRUE;
 }
 
+static gboolean msft_avdtp_start(struct avdtp_stream *stream)
+{
+	int sock;
+	struct bt_msft cmd;
+
+	if (!stream->io)
+		return FALSE;
+
+	sock = g_io_channel_unix_get_fd(stream->io);
+
+	cmd.sub_opcode = 0x09;
+
+	if (setsockopt(sock, SOL_BLUETOOTH, BT_MSFT, &cmd, 1))
+		return FALSE;
+
+	return TRUE;
+}
+
 static gboolean avdtp_start_resp(struct avdtp *session,
 					struct avdtp_stream *stream,
 					struct seid_rej *resp, int size)
@@ -2921,6 +2939,9 @@ static gboolean avdtp_start_resp(struct avdtp *session,
 	if (sep->state != AVDTP_STATE_STREAMING)
 		avdtp_sep_set_state(session, sep, AVDTP_STATE_STREAMING);
 
+	if (session->use_offload)
+		msft_avdtp_start(stream);
+
 	return TRUE;
 }
 
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH v2 8/9 avdtp: Add support for MSFT offload suspend command

In reply to Kiran K

In a2dp offload use case, send MSFT avdtp suspend command followed by remote AVDTP suspend command.

---
 profiles/audio/avdtp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
profiles/audio/avdtp.c +21 -0
index 72a5e9c5a82a..c0217f272b2c 100644
@@ -2958,6 +2958,24 @@ static gboolean avdtp_close_resp(struct avdtp *session,
 	return TRUE;
 }
 
+static gboolean msft_avdtp_suspend(struct avdtp_stream *stream)
+{
+	int sock;
+	struct bt_msft cmd;
+
+	if (!stream->io)
+		return FALSE;
+
+	sock = g_io_channel_unix_get_fd(stream->io);
+
+	cmd.sub_opcode = 0x0a;
+
+	if (setsockopt(sock, SOL_BLUETOOTH, BT_MSFT, &cmd, 1))
+		return FALSE;
+
+	return TRUE;
+}
+
 static gboolean avdtp_suspend_resp(struct avdtp *session,
 					struct avdtp_stream *stream,
 					void *data, int size)
@@ -2969,6 +2987,9 @@ static gboolean avdtp_suspend_resp(struct avdtp *session,
 	if (sep->cfm && sep->cfm->suspend)
 		sep->cfm->suspend(session, sep, stream, NULL, sep->user_data);
 
+	if (session->use_offload)
+		msft_avdtp_suspend(stream);
+
 	return TRUE;
 }
 
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH v2 9/9 avdtp: Add support for MSFT offload close command

In reply to Kiran K

In a2dp offload use case, send MSFT avdtp close
command followed by remote AVDTP close command.

---
 profiles/audio/avdtp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
profiles/audio/avdtp.c +21 -0
index c0217f272b2c..7619c167e6cf 100644
@@ -2945,6 +2945,24 @@ static gboolean avdtp_start_resp(struct avdtp *session,
 	return TRUE;
 }
 
+static gboolean msft_avdtp_close(struct avdtp_stream *stream)
+{
+	int sock;
+	struct bt_msft cmd;
+
+	if (!stream->io)
+		return FALSE;
+
+	sock = g_io_channel_unix_get_fd(stream->io);
+
+	cmd.sub_opcode = 0x0b;
+
+	if (setsockopt(sock, SOL_BLUETOOTH, BT_MSFT, &cmd, 1))
+		return FALSE;
+
+	return TRUE;
+}
+
 static gboolean avdtp_close_resp(struct avdtp *session,
 					struct avdtp_stream *stream,
 					struct seid_rej *resp, int size)
@@ -2953,6 +2971,9 @@ static gboolean avdtp_close_resp(struct avdtp *session,
 
 	avdtp_sep_set_state(session, sep, AVDTP_STATE_CLOSING);
 
+	if (session->use_offload)
+		msft_avdtp_close(stream);
+
 	close_stream(stream);
 
 	return TRUE;
Signature · 1 line
2.17.1
#9 lore raw
In reply to Kiran K

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=582945

---Test result---

Test Summary:

CheckPatch                    FAIL      13.45 seconds
GitLint                       PASS      8.97 seconds
Prep - Setup ELL              PASS      41.62 seconds
Build - Prep                  PASS      0.65 seconds
Build - Configure             PASS      7.91 seconds
Build - Make                  FAIL      138.93 seconds
Make Check                    FAIL      1.66 seconds
Make Distcheck                PASS      217.33 seconds
Build w/ext ELL - Configure   PASS      8.13 seconds
Build w/ext ELL - Make        FAIL      127.35 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output:
[v2,1/9] adapter: Enable MSFT a2dp offload codec when Experimental is set WARNING:LONG_LINE_STRING: line length of 83 exceeds 80 columns #89: FILE: src/adapter.c:9806:
+ error("Set MSFT a2dp offload codec failed with status 0x%02x (%s)",

/github/workspace/src/12628551.patch total: 0 errors, 1 warnings, 75 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12628551.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

[v2,6/9] avdtp: Add support for offload MSFT open command WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #72: FILE: lib/bluetooth.h:166:
+} __attribute__((packed));

/github/workspace/src/12628561.patch total: 0 errors, 1 warnings, 71 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12628561.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: Build - Make - FAIL
Desc: Build the BlueZ source tree
Output:
profiles/audio/avdtp.c: In function ‘avdtp_new’:
profiles/audio/avdtp.c:2477:8: error: unused variable ‘use_offload’ [-Werror=unused-variable]

 2477 |  char *use_offload;
      |        ^~~~~~~~~~~

cc1: all warnings being treated as errors
make[1]: *** [Makefile:8640: profiles/audio/bluetoothd-avdtp.o] Error 1
make: *** [Makefile:4175: all] Error 2

##############################
Test: Make Check - FAIL
Desc: Run 'make check'
Output:
profiles/audio/avdtp.c: In function ‘avdtp_new’:
profiles/audio/avdtp.c:2477:8: error: unused variable ‘use_offload’ [-Werror=unused-variable]

 2477 |  char *use_offload;
      |        ^~~~~~~~~~~

cc1: all warnings being treated as errors
make[1]: *** [Makefile:8640: profiles/audio/bluetoothd-avdtp.o] Error 1
make: *** [Makefile:10501: check] Error 2

##############################
Test: Build w/ext ELL - Make - FAIL
Desc: Build BlueZ source with '--enable-external-ell' configuration
Output:
profiles/audio/avdtp.c: In function ‘avdtp_new’:
profiles/audio/avdtp.c:2477:8: error: unused variable ‘use_offload’ [-Werror=unused-variable]

 2477 |  char *use_offload;
      |        ^~~~~~~~~~~

cc1: all warnings being treated as errors
make[1]: *** [Makefile:8640: profiles/audio/bluetoothd-avdtp.o] Error 1
make: *** [Makefile:4175: all] Error 2

---
Regards,
Linux Bluetooth

maintainer
#10 lore raw
In reply to Kiran K

Hi Kiran,

Quoted 34 lines

This enables codec offload experimental feature if its UUIDs has been enabled by main.conf:Experimental or -E has been passed in the command line.
---

src/adapter.c | 43 +++++++++++++++++++++++++++++++++++++++++++
src/main.c    |  1 +
src/main.conf |  1 +
3 files changed, 45 insertions(+)
src/adapter.c +10 -0
index 309956bbb5be..1627cc127057 100644
@@ -142,6 +142,13 @@ static const struct mgmt_exp_uuid codec_offload_uuid = {
 	.str = "a6695ace-ee7f-4fb9-881a-5fac66c629af"
 };
 
+/* 0cc2131f-96f0-4cd1-b313-b97e7cbc8335 */
+static const struct mgmt_exp_uuid msft_a2dp_offload_codecs_uuid = {
+	.val = { 0x35, 0x83, 0xbc, 0x7c, 0x7e, 0xb9, 0x13, 0xb3,
+		0xd1, 0x4c, 0xf0, 0x96, 0x1f, 0x13, 0xc2, 0x0c},
+	.str = "0cc2131f-96f0-4cd1-b313-b97e7cbc8335"
+};
+
 static DBusConnection *dbus_conn = NULL;
 
 static uint32_t kernel_features = 0;
@@ -9789,6 +9796,41 @@ static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
 	btd_error(adapter->dev_id, "Failed to set Codec Offload");
 }
 
+static void msft_a2dp_offload_complete(uint8_t status, uint16_t len,
+				       const void *param, void *user_data)
+{

src/adapter.c static void codec_offload_func(struct btd_adapter *adapter, uint8_t action) · line 9811

Quoted 10 lines
src/adapter.c +10 -0
+	struct btd_adapter *adapter = user_data;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+	if (status != 0) {
+		error("Set MSFT a2dp offload codec failed with status 0x%02x (%s)",
+		       status, mgmt_errstr(status));
+		return;
+	}
+
+	DBG("MSFT a2dp offload codecs successfully set");

we need to switch to using btd_debug or DBG_IDX to include the index number in the traces.

Quoted 11 lines
src/adapter.c +11 -0
+
+	if (action)
+		queue_push_tail(adapter->exps,
+				(void *)msft_a2dp_offload_codecs_uuid.val);
+}
+
+static void msft_a2dp_offload_func(struct btd_adapter *adapter, uint8_t action)
+{
+	struct mgmt_cp_set_exp_feature cp;
+
+	memset(&cp, 0, sizeof(cp));

src/adapter.c static void codec_offload_func(struct btd_adapter *adapter, uint8_t action) · line 9832

Quoted 10 lines
src/adapter.c +10 -0
+	memcpy(cp.uuid, msft_a2dp_offload_codecs_uuid.val, 16);
+	cp.action = action;
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
+		      adapter->dev_id, sizeof(cp), &cp,
+		      msft_a2dp_offload_complete, adapter, NULL) > 0)
+		return;
+
+	btd_error(adapter->dev_id, "Failed to set RPA Resolution");
+}

We are no longer dealing with the blunt copy-and-paste mistakes, please do a proper review before sending any patch.

Regards

Marcel

author
#11 lore raw

Hi Marcel,

Quoted 53 lines

-----Original Message-----
From: Marcel Holtmann <[email protected]>
Sent: Friday, November 19, 2021 3:36 PM
To: K, Kiran <[email protected]>
Cc: [email protected]; Srivatsa, Ravishankar <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; Von Dentz, Luiz <[email protected]>
Subject: Re: [PATCH v2 1/9] adapter: Enable MSFT a2dp offload codec when Experimental is set

Hi Kiran,

src/adapter.c static const struct mgmt_exp_uuid

Quoted 14 lines

This enables codec offload experimental feature if its UUIDs has been enabled by main.conf:Experimental or -E has been passed in the command line.
---

src/adapter.c | 43 +++++++++++++++++++++++++++++++++++++++++++
src/main.c    |  1 +
src/main.conf |  1 +
3 files changed, 45 insertions(+)
src/adapter.c index renamed from src/adapter.c +0 -0

309956bbb5be..1627cc127057 100644

src/adapter.c +0 -0
@@ -142,6 +142,13 @@ static const struct mgmt_exp_uuid

codec_offload_uuid = {

src/adapter.c static void codec_offload_func(struct

Quoted 14 lines
src/adapter.c +7 -0
 	.str = "a6695ace-ee7f-4fb9-881a-5fac66c629af"
 };
 
+/* 0cc2131f-96f0-4cd1-b313-b97e7cbc8335 */ static const struct
+mgmt_exp_uuid msft_a2dp_offload_codecs_uuid = {
+	.val = { 0x35, 0x83, 0xbc, 0x7c, 0x7e, 0xb9, 0x13, 0xb3,
+		0xd1, 0x4c, 0xf0, 0x96, 0x1f, 0x13, 0xc2, 0x0c},
+	.str = "0cc2131f-96f0-4cd1-b313-b97e7cbc8335"
+};
+
 static DBusConnection *dbus_conn = NULL;
 
 static uint32_t kernel_features = 0;
@@ -9789,6 +9796,41 @@ static void codec_offload_func(struct

btd_adapter *adapter, uint8_t action)

src/adapter.c static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)

Quoted 9 lines
src/adapter.c +7 -0
 	btd_error(adapter->dev_id, "Failed to set Codec Offload"); }
 
+static void msft_a2dp_offload_complete(uint8_t status, uint16_t len,
+				       const void *param, void *user_data) {
+	struct btd_adapter *adapter = user_data;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+	if (status != 0) {
+		error("Set MSFT a2dp offload codec failed with status 0x%02x

(%s)",

Quoted 8 lines

src/adapter.c static void codec_offload_func(struct btd_adapter *adapter, uint8_t action) · line 9811

Quoted 5 lines
src/adapter.c +5 -0
+		       status, mgmt_errstr(status));
+		return;
+	}
+
+	DBG("MSFT a2dp offload codecs successfully set");

we need to switch to using btd_debug or DBG_IDX to include the index number in the traces.

Ok.

Quoted 16 lines
Quoted 16 lines
src/adapter.c +15 -0
+
+	if (action)
+		queue_push_tail(adapter->exps,
+				(void *)msft_a2dp_offload_codecs_uuid.val);
+}
+
+static void msft_a2dp_offload_func(struct btd_adapter *adapter,
+uint8_t action) {
+	struct mgmt_cp_set_exp_feature cp;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, msft_a2dp_offload_codecs_uuid.val, 16);
+	cp.action = action;
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
Quoted 8 lines

src/adapter.c static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)

Quoted 5 lines
src/adapter.c +5 -0
+		      adapter->dev_id, sizeof(cp), &cp,
+		      msft_a2dp_offload_complete, adapter, NULL) > 0)
+		return;
+
+	btd_error(adapter->dev_id, "Failed to set RPA Resolution"); }

We are no longer dealing with the blunt copy-and-paste mistakes, please do a proper review before sending any patch.

My bad. I will address in the next patchset.

Quoted 4 lines

Regards

Marcel

Thanks,
Kiran