Skip to contentSkip to conversation

adapter-api: Add Experimental property

PATCH In review Luiz Augusto von Dentz 2 participants 7 messages Sep 7, 2021 – Sep 8, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/5 adapter-api: Add Experimental property

From: Luiz Augusto von Dentz <[email protected]>

This adds Experimental property which indicates what experimental features are currently enabled.

---
 doc/adapter-api.txt | 5 +++++
 1 file changed, 5 insertions(+)
doc/adapter-api.txt +5 -0
index 464434a81..490608e8d 100644
@@ -335,3 +335,8 @@ Properties	string Address [readonly]
 				"peripheral": Supports the peripheral role.
 				"central-peripheral": Supports both roles
 						      concurrently.
+
+		array{string} ExperimentalFeatures [readonly, optional]
+
+			List of 128-bit UUIDs that represents the experimental
+			features currently enabled.
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 2/5 adapter: Implement Experimental property

From: Luiz Augusto von Dentz <[email protected]>

This implements Experimental property which indicates the list of UUIDs that represents the experimental features currently enabled.

---
 src/adapter.c | 149 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 109 insertions(+), 40 deletions(-)
src/adapter.c +109 -40
index ddd896751..dd187f847 100644
@@ -102,6 +102,30 @@ static const struct mgmt_blocked_key_info blocked_keys[] = {
 		 0x22, 0x8e, 0x07, 0x56, 0xb4, 0xe8, 0x5f, 0x01}},
 };
 
+/* d4992530-b9ec-469f-ab01-6c481c47da1c */
+static const uint8_t debug_uuid[16] = {
+	0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, 0x01, 0xab,
+	0x9f, 0x46, 0xec, 0xb9, 0x30, 0x25, 0x99, 0xd4,
+};
+
+/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
+static const uint8_t le_simult_central_peripheral_uuid[16] = {
+	0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
+	0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
+};
+
+/* 330859bc-7506-492d-9370-9a6f0614037f */
+static const uint8_t quality_report_uuid[16] = {
+	0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
+	0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33,
+};
+
+/* 15c0a148-c273-11ea-b3de-0242ac130004 */
+static const uint8_t rpa_resolution_uuid[16] = {
+	0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+	0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+};
+
 static DBusConnection *dbus_conn = NULL;
 
 static uint32_t kernel_features = 0;
@@ -285,8 +309,7 @@ struct btd_adapter {
 
 	bool is_default;		/* true if adapter is default one */
 
-	bool le_simult_roles_supported;
-	bool quality_report_supported;
+	struct queue *exps;
 };
 
 typedef enum {
@@ -3250,7 +3273,8 @@ static gboolean property_get_roles(const GDBusPropertyTable *property,
 		dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
 	}
 
-	if (adapter->le_simult_roles_supported) {
+	if (queue_find(adapter->exps, NULL,
+				le_simult_central_peripheral_uuid)) {
 		const char *str = "central-peripheral";
 		dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
 	}
@@ -3260,6 +3284,48 @@ static gboolean property_get_roles(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static void property_append_experimental(void *data, void *user_data)
+{
+	uint8_t *feature = data;
+	DBusMessageIter *iter = user_data;
+	uint128_t value;
+	bt_uuid_t uuid;
+	char str[MAX_LEN_UUID_STR + 1];
+	char *ptr;
+
+	bswap_128(feature, &value);
+	bt_uuid128_create(&uuid, value);
+	bt_uuid_to_string(&uuid, str, sizeof(str));
+
+	ptr = str;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &ptr);
+}
+
+static gboolean property_get_experimental(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *user_data)
+{
+	struct btd_adapter *adapter = user_data;
+	DBusMessageIter entry;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+					DBUS_TYPE_STRING_AS_STRING, &entry);
+
+	queue_foreach(adapter->exps, property_append_experimental, &entry);
+
+	dbus_message_iter_close_container(iter, &entry);
+
+	return TRUE;
+}
+
+static gboolean property_experimental_exits(const GDBusPropertyTable *property,
+								void *data)
+{
+	struct btd_adapter *adapter = data;
+
+	return !queue_isempty(adapter->exps);
+}
+
 static DBusMessage *remove_device(DBusConnection *conn,
 					DBusMessage *msg, void *user_data)
 {
@@ -3619,6 +3685,8 @@ static const GDBusPropertyTable adapter_properties[] = {
 	{ "Modalias", "s", property_get_modalias, NULL,
 					property_exists_modalias },
 	{ "Roles", "as", property_get_roles },
+	{ "ExperimentalFeatures", "as", property_get_experimental, NULL,
+					property_experimental_exits },
 	{ }
 };
 
@@ -5526,6 +5594,7 @@ static void adapter_free(gpointer user_data)
 
 	g_queue_foreach(adapter->auths, free_service_auth, NULL);
 	g_queue_free(adapter->auths);
+	queue_destroy(adapter->exps, NULL);
 
 	/*
 	 * Unregister all handlers for this specific index since
@@ -6496,6 +6565,7 @@ static struct btd_adapter *btd_adapter_new(uint16_t index)
 	DBG("Pairable timeout: %u seconds", adapter->pairable_timeout);
 
 	adapter->auths = g_queue_new();
+	adapter->exps = queue_new();
 
 	return btd_adapter_ref(adapter);
 }
@@ -9394,38 +9464,22 @@ static bool set_blocked_keys(struct btd_adapter *adapter)
 	.func = _func, \
 }
 
-/* d4992530-b9ec-469f-ab01-6c481c47da1c */
-static const uint8_t debug_uuid[16] = {
-	0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, 0x01, 0xab,
-	0x9f, 0x46, 0xec, 0xb9, 0x30, 0x25, 0x99, 0xd4,
-};
-
-/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
-static const uint8_t le_simult_central_peripheral_uuid[16] = {
-	0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
-	0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
-};
-
-/* 330859bc-7506-492d-9370-9a6f0614037f */
-static const uint8_t quality_report_uuid[16] = {
-	0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
-	0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33,
-};
-
-/* 15c0a148-c273-11ea-b3de-0242ac130004 */
-static const uint8_t rpa_resolution_uuid[16] = {
-	0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
-	0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
-};
-
 static void set_exp_debug_complete(uint8_t status, uint16_t len,
 					const void *param, void *user_data)
 {
-	if (status != 0)
+	struct btd_adapter *adapter = user_data;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+	if (status != 0) {
 		error("Set Experimental Debug failed with status 0x%02x (%s)",
 						status, mgmt_errstr(status));
-	else
-		DBG("Experimental Debug successfully set");
+		return;
+	}
+
+	DBG("Experimental Debug successfully set");
+
+	if (action)
+		queue_push_tail(adapter->exps, (void *)debug_uuid);
 }
 
 static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
@@ -9434,8 +9488,11 @@ static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
 	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
 
 	/* If already set don't attempt to set it again */
-	if (action == (flags & BIT(0)))
+	if (action == (flags & BIT(0))) {
+		if (action)
+			queue_push_tail(adapter->exps, (void *)debug_uuid);
 		return;
+	}
 
 	memset(&cp, 0, sizeof(cp));
 	memcpy(cp.uuid, debug_uuid, 16);
@@ -9452,25 +9509,33 @@ static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
 static void le_simult_central_peripheral_func(struct btd_adapter *adapter,
 							uint32_t flags)
 {
-	adapter->le_simult_roles_supported = flags & 0x01;
+	if (flags & 0x01)
+		queue_push_tail(adapter->exps,
+				(void *)le_simult_central_peripheral_uuid);
 }
 
 static void quality_report_func(struct btd_adapter *adapter, uint32_t flags)
 {
-	adapter->quality_report_supported = le32_to_cpu(flags) & 0x01;
-
-	btd_info(adapter->dev_id, "quality_report_supported %d",
-			adapter->quality_report_supported);
+	if (flags & 0x01)
+		queue_push_tail(adapter->exps, (void *)quality_report_uuid);
 }
 
 static void set_rpa_resolution_complete(uint8_t status, uint16_t len,
 					const void *param, void *user_data)
 {
-	if (status != 0)
+	struct btd_adapter *adapter = user_data;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+	if (status != 0) {
 		error("Set RPA Resolution failed with status 0x%02x (%s)",
 						status, mgmt_errstr(status));
-	else
-		DBG("RPA Resolution successfully set");
+		return;
+	}
+
+	DBG("RPA Resolution successfully set");
+
+	if (action)
+		queue_push_tail(adapter->exps, (void *)rpa_resolution_uuid);
 }
 
 static void rpa_resolution_func(struct btd_adapter *adapter, uint32_t flags)
@@ -9479,8 +9544,12 @@ static void rpa_resolution_func(struct btd_adapter *adapter, uint32_t flags)
 	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
 
 	/* If already set don't attempt to set it again */
-	if (action == (flags & BIT(0)))
+	if (action == (flags & BIT(0))) {
+		if (action)
+			queue_push_tail(adapter->exps,
+						(void *)rpa_resolution_uuid);
 		return;
+	}
 
 	memset(&cp, 0, sizeof(cp));
 	memcpy(cp.uuid, rpa_resolution_uuid, 16);
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 3/5 client: Add support for printing ExperimentalFeatures property

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Thid adds support to show command to print ExperimentalFeatures property:

[bluetooth]# show
Controller ...

	Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)
---
 client/main.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)
client/main.c +28 -5
index 506602bbd..9a36a8c65 100644
@@ -319,7 +319,7 @@ static void print_property(GDBusProxy *proxy, const char *name)
 	print_property_with_label(proxy, name, NULL);
 }
 
-static void print_uuid(const char *uuid)
+static void print_uuid(const char *label, const char *uuid)
 {
 	const char *text;
 
@@ -340,9 +340,10 @@ static void print_uuid(const char *uuid)
 			n = sizeof(str) - 1;
 		}
 
-		bt_shell_printf("\tUUID: %s%*c(%s)\n", str, 26 - n, ' ', uuid);
+		bt_shell_printf("\t%s: %s%*c(%s)\n", label, str, 26 - n, ' ',
+									uuid);
 	} else
-		bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+		bt_shell_printf("\t%s: %*c(%s)\n", label, 26, ' ', uuid);
 }
 
 static void print_uuids(GDBusProxy *proxy)
@@ -359,7 +360,28 @@ static void print_uuids(GDBusProxy *proxy)
 
 		dbus_message_iter_get_basic(&value, &uuid);
 
-		print_uuid(uuid);
+		print_uuid("UUID", uuid);
+
+		dbus_message_iter_next(&value);
+	}
+}
+
+static void print_experimental(GDBusProxy *proxy)
+{
+	DBusMessageIter iter, value;
+
+	if (g_dbus_proxy_get_property(proxy, "ExperimentalFeatures",
+						&iter) == FALSE)
+		return;
+
+	dbus_message_iter_recurse(&iter, &value);
+
+	while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_STRING) {
+		const char *uuid;
+
+		dbus_message_iter_get_basic(&value, &uuid);
+
+		print_uuid("ExperimentalFeatures", uuid);
 
 		dbus_message_iter_next(&value);
 	}
@@ -984,6 +1006,7 @@ static void cmd_show(int argc, char *argv[])
 	print_property(adapter->proxy, "Modalias");
 	print_property(adapter->proxy, "Discovering");
 	print_property(adapter->proxy, "Roles");
+	print_experimental(adapter->proxy);
 
 	if (adapter->ad_proxy) {
 		bt_shell_printf("Advertising Features:\n");
@@ -1424,7 +1447,7 @@ static void cmd_scan_filter_uuids(int argc, char *argv[])
 		char **uuid;
 
 		for (uuid = filter.uuids; uuid && *uuid; uuid++)
-			print_uuid(*uuid);
+			print_uuid("UUID", *uuid);
 
 		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 	}
Signature · 1 line
2.31.1
author maintainer
#3 lore raw

PATCH 4/5 main.conf: Allow passing a list of UUIDs to Experimental

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This allows the user to enable a subset of the experimental features to be enabled instead of all of them and also change -E to work in the same way so a list of UUIDs can also be given at the command line.

---
 src/adapter.c | 106 ++++++++++++++++++++++++++-----------------------
 src/btd.h     |   5 ++-
 src/main.c    | 108 ++++++++++++++++++++++++++++++++++++++++++++++----
 src/main.conf |  10 ++++-
 4 files changed, 169 insertions(+), 60 deletions(-)
src/adapter.c +56 -50
index dd187f847..bc6469e0a 100644
@@ -102,28 +102,37 @@ static const struct mgmt_blocked_key_info blocked_keys[] = {
 		 0x22, 0x8e, 0x07, 0x56, 0xb4, 0xe8, 0x5f, 0x01}},
 };
 
+struct mgmt_exp_uuid {
+	uint8_t val[16];
+	const char *str;
+};
+
 /* d4992530-b9ec-469f-ab01-6c481c47da1c */
-static const uint8_t debug_uuid[16] = {
-	0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, 0x01, 0xab,
-	0x9f, 0x46, 0xec, 0xb9, 0x30, 0x25, 0x99, 0xd4,
+static const struct mgmt_exp_uuid debug_uuid = {
+	.val = { 0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, 0x01, 0xab,
+		0x9f, 0x46, 0xec, 0xb9, 0x30, 0x25, 0x99, 0xd4 },
+	.str = "d4992530-b9ec-469f-ab01-6c481c47da1c"
 };
 
 /* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
-static const uint8_t le_simult_central_peripheral_uuid[16] = {
-	0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
-	0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
+static const struct mgmt_exp_uuid le_simult_central_peripheral_uuid = {
+	.val = { 0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
+		0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67 },
+	.str = "671b10b5-42c0-4696-9227-eb28d1b049d6"
 };
 
 /* 330859bc-7506-492d-9370-9a6f0614037f */
-static const uint8_t quality_report_uuid[16] = {
-	0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
-	0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33,
+static const struct mgmt_exp_uuid quality_report_uuid = {
+	.val = { 0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
+		0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33 },
+	.str = "330859bc-7506-492d-9370-9a6f0614037f"
 };
 
 /* 15c0a148-c273-11ea-b3de-0242ac130004 */
-static const uint8_t rpa_resolution_uuid[16] = {
-	0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
-	0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+static const struct mgmt_exp_uuid rpa_resolution_uuid = {
+	.val = { 0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+		0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15 },
+	.str = "15c0a148-c273-11ea-b3de-0242ac130004"
 };
 
 static DBusConnection *dbus_conn = NULL;
@@ -3274,7 +3283,7 @@ static gboolean property_get_roles(const GDBusPropertyTable *property,
 	}
 
 	if (queue_find(adapter->exps, NULL,
-				le_simult_central_peripheral_uuid)) {
+				le_simult_central_peripheral_uuid.val)) {
 		const char *str = "central-peripheral";
 		dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
 	}
@@ -9479,23 +9488,15 @@ static void set_exp_debug_complete(uint8_t status, uint16_t len,
 	DBG("Experimental Debug successfully set");
 
 	if (action)
-		queue_push_tail(adapter->exps, (void *)debug_uuid);
+		queue_push_tail(adapter->exps, (void *)debug_uuid.val);
 }
 
-static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
+static void exp_debug_func(struct btd_adapter *adapter, uint8_t action)
 {
 	struct mgmt_cp_set_exp_feature cp;
-	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
-
-	/* If already set don't attempt to set it again */
-	if (action == (flags & BIT(0))) {
-		if (action)
-			queue_push_tail(adapter->exps, (void *)debug_uuid);
-		return;
-	}
 
 	memset(&cp, 0, sizeof(cp));
-	memcpy(cp.uuid, debug_uuid, 16);
+	memcpy(cp.uuid, debug_uuid.val, 16);
 	cp.action = action;
 
 	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
@@ -9507,17 +9508,17 @@ static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
 }
 
 static void le_simult_central_peripheral_func(struct btd_adapter *adapter,
-							uint32_t flags)
+							uint8_t action)
 {
-	if (flags & 0x01)
+	if (action)
 		queue_push_tail(adapter->exps,
-				(void *)le_simult_central_peripheral_uuid);
+				(void *)le_simult_central_peripheral_uuid.val);
 }
 
-static void quality_report_func(struct btd_adapter *adapter, uint32_t flags)
+static void quality_report_func(struct btd_adapter *adapter, uint8_t action)
 {
-	if (flags & 0x01)
-		queue_push_tail(adapter->exps, (void *)quality_report_uuid);
+	if (action)
+		queue_push_tail(adapter->exps, (void *)quality_report_uuid.val);
 }
 
 static void set_rpa_resolution_complete(uint8_t status, uint16_t len,
@@ -9535,24 +9536,15 @@ static void set_rpa_resolution_complete(uint8_t status, uint16_t len,
 	DBG("RPA Resolution successfully set");
 
 	if (action)
-		queue_push_tail(adapter->exps, (void *)rpa_resolution_uuid);
+		queue_push_tail(adapter->exps, (void *)rpa_resolution_uuid.val);
 }
 
-static void rpa_resolution_func(struct btd_adapter *adapter, uint32_t flags)
+static void rpa_resolution_func(struct btd_adapter *adapter, uint8_t action)
 {
 	struct mgmt_cp_set_exp_feature cp;
-	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
-
-	/* If already set don't attempt to set it again */
-	if (action == (flags & BIT(0))) {
-		if (action)
-			queue_push_tail(adapter->exps,
-						(void *)rpa_resolution_uuid);
-		return;
-	}
 
 	memset(&cp, 0, sizeof(cp));
-	memcpy(cp.uuid, rpa_resolution_uuid, 16);
+	memcpy(cp.uuid, rpa_resolution_uuid.val, 16);
 	cp.action = action;
 
 	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
@@ -9564,14 +9556,14 @@ static void rpa_resolution_func(struct btd_adapter *adapter, uint32_t flags)
 }
 
 static const struct exp_feat {
-	const uint8_t *uuid;
-	void (*func)(struct btd_adapter *adapter, uint32_t flags);
+	const struct mgmt_exp_uuid *uuid;
+	void (*func)(struct btd_adapter *adapter, uint8_t action);
 } exp_table[] = {
-	EXP_FEAT(debug_uuid, exp_debug_func),
-	EXP_FEAT(le_simult_central_peripheral_uuid,
+	EXP_FEAT(&debug_uuid, exp_debug_func),
+	EXP_FEAT(&le_simult_central_peripheral_uuid,
 		 le_simult_central_peripheral_func),
-	EXP_FEAT(quality_report_uuid, quality_report_func),
-	EXP_FEAT(rpa_resolution_uuid, rpa_resolution_func),
+	EXP_FEAT(&quality_report_uuid, quality_report_func),
+	EXP_FEAT(&rpa_resolution_uuid, rpa_resolution_func),
 };
 
 static void read_exp_features_complete(uint8_t status, uint16_t length,
@@ -9608,13 +9600,27 @@ static void read_exp_features_complete(uint8_t status, uint16_t length,
 
 		for (j = 0; j < ARRAY_SIZE(exp_table); j++) {
 			const struct exp_feat *feat = &exp_table[j];
+			uint8_t action;
 
-			if (memcmp(rp->features[i].uuid, feat->uuid,
+			if (memcmp(rp->features[i].uuid, feat->uuid->val,
 					sizeof(rp->features[i].uuid)))
 				continue;
 
+			action = btd_experimental_enabled(feat->uuid->str);
+
+			DBG("%s flags %u action %u", feat->uuid->str,
+				rp->features[i].flags, action);
+
+			/* If already set don't attempt to set it again */
+			if (action == (rp->features[i].flags & BIT(0))) {
+				if (action)
+					queue_push_tail(adapter->exps,
+						(void *)feat->uuid->val);
+				continue;
+			}
+
 			if (feat->func)
-				feat->func(adapter, rp->features[i].flags);
+				feat->func(adapter, action);
 		}
 	}
 }
src/btd.h +4 -1
index d72883546..f83591f8f 100644
@@ -10,6 +10,8 @@
  *
  */
 
+#include <stdbool.h>
+
 typedef enum {
 	BT_MODE_DUAL,
 	BT_MODE_BREDR,
@@ -109,7 +111,7 @@ struct btd_opts {
 	gboolean	debug_keys;
 	gboolean	fast_conn;
 	gboolean	refresh_discovery;
-	gboolean	experimental;
+	struct queue	*experimental;
 
 	uint16_t	did_source;
 	uint16_t	did_vendor;
@@ -140,5 +142,6 @@ void rfkill_init(void);
 void rfkill_exit(void);
 
 GKeyFile *btd_get_main_conf(void);
+bool btd_experimental_enabled(const char *uuid);
 
 void btd_exit(void);
src/main.c +100 -8

155 lines not on this page · raw message

src/main.conf +9 -1
index 71924cb17..e05291d8e 100644
@@ -86,7 +86,15 @@
 # profile is connected. Defaults to true.
 #RefreshDiscovery = true
 
-# Enables experimental features and interfaces.
+# Enables experimental features and interfaces, alternatively a list of UUIDs
+# can be given.
+# Possible values: true,false,<UUID List>
+# Possible UUIDS:
+# d4992530-b9ec-469f-ab01-6c481c47da1c (BlueZ Experimental Debug)
+# 671b10b5-42c0-4696-9227-eb28d1b049d6 (BlueZ Experimental Simultaneous Central and Peripheral)
+# 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)
 # Defaults to false.
 #Experimental = false
 
Signature · 1 line
2.31.1
author maintainer
#4 lore raw

PATCH 5/5 adapter: Enable codec offload when Experimental is set

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

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 | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
src/adapter.c +42 -0
index bc6469e0a..ce715766c 100644
@@ -135,6 +135,13 @@ static const struct mgmt_exp_uuid rpa_resolution_uuid = {
 	.str = "15c0a148-c273-11ea-b3de-0242ac130004"
 };
 
+/* a6695ace-ee7f-4fb9-881a-5fac66c629af */
+static const struct mgmt_exp_uuid codec_offload_uuid = {
+	.val = { 0xaf, 0x29, 0xc6, 0x66, 0xac, 0x5f, 0x1a, 0x88,
+		0xb9, 0x4f, 0x7f, 0xee, 0xce, 0x5a, 0x69, 0xa6 },
+	.str = "a6695ace-ee7f-4fb9-881a-5fac66c629af"
+};
+
 static DBusConnection *dbus_conn = NULL;
 
 static uint32_t kernel_features = 0;
@@ -9555,6 +9562,40 @@ static void rpa_resolution_func(struct btd_adapter *adapter, uint8_t action)
 	btd_error(adapter->dev_id, "Failed to set RPA Resolution");
 }
 
+static void codec_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 Codec Offload failed with status 0x%02x (%s)",
+						status, mgmt_errstr(status));
+		return;
+	}
+
+	DBG("Codec Offload successfully set");
+
+	if (action)
+		queue_push_tail(adapter->exps, (void *)codec_offload_uuid.val);
+}
+
+static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
+{
+	struct mgmt_cp_set_exp_feature cp;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, codec_offload_uuid.val, 16);
+	cp.action = action;
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
+			adapter->dev_id, sizeof(cp), &cp,
+			codec_offload_complete, adapter, NULL) > 0)
+		return;
+
+	btd_error(adapter->dev_id, "Failed to set Codec Offload");
+}
+
 static const struct exp_feat {
 	const struct mgmt_exp_uuid *uuid;
 	void (*func)(struct btd_adapter *adapter, uint8_t action);
@@ -9564,6 +9605,7 @@ static const struct exp_feat {
 		 le_simult_central_peripheral_func),
 	EXP_FEAT(&quality_report_uuid, quality_report_func),
 	EXP_FEAT(&rpa_resolution_uuid, rpa_resolution_func),
+	EXP_FEAT(&codec_offload_uuid, codec_offload_func),
 };
 
 static void read_exp_features_complete(uint8_t status, uint16_t length,
Signature · 1 line
2.31.1
#5 lore raw
In reply to Luiz Augusto von Dentz

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

---Test result---

Test Summary:

CheckPatch                    FAIL      2.03 seconds
GitLint                       FAIL      0.62 seconds
Prep - Setup ELL              PASS      48.33 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      8.39 seconds
Build - Make                  PASS      208.28 seconds
Make Check                    PASS      9.35 seconds
Make Distcheck                PASS      246.88 seconds
Build w/ext ELL - Configure   PASS      8.45 seconds
Build w/ext ELL - Make        PASS      196.29 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
client: Add support for printing ExperimentalFeatures property WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #11:

	Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)

- total: 0 errors, 1 warnings, 64 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.

"[PATCH] client: Add support for printing ExperimentalFeatures" 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.

main.conf: Allow passing a list of UUIDs to Experimental WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #267: FILE: src/main.c:568:
+static const char *valid_uuids[] = {

- total: 0 errors, 1 warnings, 375 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.

"[PATCH] main.conf: Allow passing a list of UUIDs to Experimental" 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: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
client: Add support for printing ExperimentalFeatures property
7: B3 Line contains hard tab characters (\t): " Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

---
Regards,
Linux Bluetooth

author maintainer
#6 lore raw

Hi,

Quoted 105 lines · On Tue, Sep 7, 2021 at 3:56 PM <[email protected]> wrote:

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

---Test result---

Test Summary:

CheckPatch                    FAIL      2.03 seconds
GitLint                       FAIL      0.62 seconds
Prep - Setup ELL              PASS      48.33 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      8.39 seconds
Build - Make                  PASS      208.28 seconds
Make Check                    PASS      9.35 seconds
Make Distcheck                PASS      246.88 seconds
Build w/ext ELL - Configure   PASS      8.45 seconds
Build w/ext ELL - Make        PASS      196.29 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
client: Add support for printing ExperimentalFeatures property WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #11:

        Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)

- total: 0 errors, 1 warnings, 64 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.

"[PATCH] client: Add support for printing ExperimentalFeatures" 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.

main.conf: Allow passing a list of UUIDs to Experimental WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #267: FILE: src/main.c:568:
+static const char *valid_uuids[] = {

- total: 0 errors, 1 warnings, 375 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.

"[PATCH] main.conf: Allow passing a list of UUIDs to Experimental" 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: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
client: Add support for printing ExperimentalFeatures property
7: B3 Line contains hard tab characters (\t): " Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

Quoted 3 lines

---
Regards,
Linux Bluetooth

Pushed.

Signature · 1 line
Luiz Augusto von Dentz