Skip to contentSkip to conversation

media: Populate location to qos structure

PATCH In review Kiran K 4 participants 8 messages Oct 20, 2023 Bluetooth drivers

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH 1/5 media: Populate location to qos structure

Allow clients to register Location for endpoint.

---
 profiles/audio/media.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
profiles/audio/media.c +11 -0
index 1d98ac5a1a70..d0520d3216c9 100644
@@ -1609,6 +1609,10 @@ static int parse_properties(DBusMessageIter *props, const char **uuid,
 			if (var != DBUS_TYPE_UINT16)
 				return -EINVAL;
 			dbus_message_iter_get_basic(&value, &qos->ppd_max);
+		} else if (strcasecmp(key, "Location") == 0) {
+			if (var != DBUS_TYPE_UINT32)
+				return -EINVAL;
+			dbus_message_iter_get_basic(&value, &qos->location);
 		}
 
 		dbus_message_iter_next(props);
@@ -2799,6 +2803,13 @@ static void app_register_endpoint(void *data, void *user_data)
 		dbus_message_iter_get_basic(&iter, &qos.ppd_min);
 	}
 
+	if (g_dbus_proxy_get_property(proxy, "Location", &iter)) {
+		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
+			goto fail;
+
+		dbus_message_iter_get_basic(&iter, &qos.location);
+	}
+
 	endpoint = media_endpoint_create(app->adapter, app->sender, path, uuid,
 						delay_reporting, codec,
 						vendor.cid, vendor.vid, &qos,
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/5 bap: Fix update of sink location value

pac->sink_loc needs to be updated only if there is a change.

---
 src/shared/bap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
src/shared/bap.c +1 -3
index 925501c48d98..2fd21b81b72d 100644
@@ -2491,13 +2491,11 @@ static void pacs_sink_location_changed(struct bt_pacs *pacs)
 
 static void pacs_add_sink_location(struct bt_pacs *pacs, uint32_t location)
 {
-	location |= pacs->sink_loc_value;
-
 	/* Check if location value needs updating */
 	if (location == pacs->sink_loc_value)
 		return;
 
-	pacs->sink_loc_value = location;
+	pacs->sink_loc_value |= location;
 
 	pacs_sink_location_changed(pacs);
 }
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 3/5 bap: Do not set default location for sink and source

In reply to Kiran K

let the clients register the required location for source and sink endpoints.

---
 src/shared/bap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
src/shared/bap.c +2 -3
index 2fd21b81b72d..5cb8b5aba659 100644
@@ -474,9 +474,8 @@ static struct bt_pacs *pacs_new(struct gatt_db *db)
 
 	pacs = new0(struct bt_pacs, 1);
 
-	/* Set default values */
-	pacs->sink_loc_value = PACS_SNK_LOCATION;
-	pacs->source_loc_value = PACS_SRC_LOCATION;
+	pacs->sink_loc_value = 0;
+	pacs->source_loc_value = 0;
 	pacs->sink_context_value = PACS_SNK_CTXT;
 	pacs->source_context_value = PACS_SRC_CTXT;
 	pacs->supported_sink_context_value = PACS_SUPPORTED_SNK_CTXT;
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 4/5 bap: Fix reading source codec capabilities

In reply to Kiran K

Sink ASE capabilities were read instead of source.

---
 src/shared/bap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/shared/bap.c +1 -1
index 5cb8b5aba659..bd00fa210abe 100644
@@ -2634,7 +2634,7 @@ static void bap_add_source(struct bt_bap_pac *pac)
 	iov.iov_base = value;
 	iov.iov_len = 0;
 
-	queue_foreach(pac->bdb->sinks, pac_foreach, &iov);
+	queue_foreach(pac->bdb->sources, pac_foreach, &iov);
 
 	pacs_add_source_location(pac->bdb->pacs, pac->qos.location);
 	pacs_add_source_supported_context(pac->bdb->pacs,
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 5/5 media: Parse conext and supported context

In reply to Kiran K

Allow clients to register available context and supported context for bap endpoint.

---
 profiles/audio/media.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
profiles/audio/media.c +23 -0
index d0520d3216c9..69f77a80c8ea 100644
@@ -1613,6 +1613,15 @@ static int parse_properties(DBusMessageIter *props, const char **uuid,
 			if (var != DBUS_TYPE_UINT32)
 				return -EINVAL;
 			dbus_message_iter_get_basic(&value, &qos->location);
+		} else if (strcasecmp(key, "Context") == 0) {
+			if (var != DBUS_TYPE_UINT16)
+				return -EINVAL;
+			dbus_message_iter_get_basic(&value, &qos->context);
+		} else if (strcasecmp(key, "SupportedContext") == 0) {
+			if (var != DBUS_TYPE_UINT16)
+				return -EINVAL;
+			dbus_message_iter_get_basic(&value,
+						    &qos->supported_context);
 		}
 
 		dbus_message_iter_next(props);
@@ -2810,6 +2819,20 @@ static void app_register_endpoint(void *data, void *user_data)
 		dbus_message_iter_get_basic(&iter, &qos.location);
 	}
 
+	if (g_dbus_proxy_get_property(proxy, "Context", &iter)) {
+		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT16)
+			goto fail;
+
+		dbus_message_iter_get_basic(&iter, &qos.context);
+	}
+
+	if (g_dbus_proxy_get_property(proxy, "SupportedContext", &iter)) {
+		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT16)
+			goto fail;
+
+		dbus_message_iter_get_basic(&iter, &qos.supported_context);
+	}
+
 	endpoint = media_endpoint_create(app->adapter, app->sender, path, uuid,
 						delay_reporting, codec,
 						vendor.cid, vendor.vid, &qos,
Signature · 1 line
2.34.1
#5 lore raw
In reply to Kiran K

Hi,

pe, 2023-10-20 kello 19:55 +0530, Kiran K kirjoitti:

Quoted 10 lines

Allow clients to register Location for endpoint.

---
 profiles/audio/media.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
profiles/audio/media.c +0 -0
index 1d98ac5a1a70..d0520d3216c9 100644

profiles/audio/media.c static int parse_properties(DBusMessageIter *props, const char **uuid, · line 1616

Quoted 8 lines
profiles/audio/media.c +4 -0
@@ -1609,6 +1609,10 @@ static int parse_properties(DBusMessageIter *props, const char **uuid,
 			if (var != DBUS_TYPE_UINT16)
 				return -EINVAL;
 			dbus_message_iter_get_basic(&value, &qos->ppd_max);
+		} else if (strcasecmp(key, "Location") == 0) {
+			if (var != DBUS_TYPE_UINT32)
+				return -EINVAL;
+			dbus_message_iter_get_basic(&value, &qos->location);
 		}

The name of the key should be "Locations", not "Location", see doc/org.bluez.MediaEndpoint.rst

profiles/audio/media.c static void app_register_endpoint(void *data, void *user_data) · line 2806

Quoted 7 lines
profiles/audio/media.c +1 -0
 		dbus_message_iter_next(props);
@@ -2799,6 +2803,13 @@ static void app_register_endpoint(void *data, void *user_data)
 		dbus_message_iter_get_basic(&iter, &qos.ppd_min);
 	}
 
+	if (g_dbus_proxy_get_property(proxy, "Location", &iter)) {

Similarly here.

Quoted 9 lines
profiles/audio/media.c +6 -0
+		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
+			goto fail;
+
+		dbus_message_iter_get_basic(&iter, &qos.location);
+	}
+
 	endpoint = media_endpoint_create(app->adapter, app->sender, path, uuid,
 						delay_reporting, codec,
 						vendor.cid, vendor.vid, &qos,
Signature · 1 line
Pauli Virtanen
#6 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=795144

---Test result---

Test Summary:

CheckPatch                    PASS      2.33 seconds
GitLint                       PASS      1.64 seconds
BuildEll                      PASS      28.35 seconds
BluezMake                     PASS      930.45 seconds
MakeCheck                     PASS      11.57 seconds
MakeDistcheck                 PASS      180.89 seconds
CheckValgrind                 PASS      278.11 seconds
CheckSmatch                   PASS      381.00 seconds
bluezmakeextell               PASS      120.14 seconds
IncrementalBuild              PASS      3824.44 seconds
ScanBuild                     PASS      1143.53 seconds

---
Regards,
Linux Bluetooth

#7 lore raw
In reply to Kiran K
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

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

Quoted 4 lines · On Fri, 20 Oct 2023 19:55:50 +0530 you wrote:

Allow clients to register Location for endpoint.

---
 profiles/audio/media.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Here is the summary with links:
- [v1,1/5] media: Populate location to qos structure (no matching commit)
- [v1,2/5] bap: Fix update of sink location value

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5f8323f2aaa3
  - [v1,3/5] bap: Do not set default location for sink and source
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=932e64206069
  - [v1,4/5] bap: Fix reading source codec capabilities
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a564d6a0d533
  - [v1,5/5] media: Parse conext and supported context
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f02e0c8664a6

You are awesome, thank you!

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