* [PATCH BlueZ v4 2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation
2024-04-11 20:03 [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location Luiz Augusto von Dentz
@ 2024-04-11 20:03 ` Luiz Augusto von Dentz
2024-04-11 20:03 ` [PATCH BlueZ v4 3/4] shared/bap: Fix not resuming reading attributes Luiz Augusto von Dentz
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-11 20:03 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If channel allocation could not be matched attempt to call .select
without a channel allocation as the device might require a different
matching algorithm.
Fixes: https://github.com/bluez/bluez/issues/793
---
src/shared/bap.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index b452461ac715..cc1fa1ffbe32 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5116,6 +5116,7 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
void *user_data)
{
const struct queue_entry *lchan, *rchan;
+ int selected = 0;
if (!lpac || !rpac || !func)
return -EINVAL;
@@ -5158,8 +5159,7 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
rc->location, &rpac->qos,
func, user_data,
lpac->user_data);
- if (count)
- (*count)++;
+ selected++;
/* Check if there are any channels left to select */
map.count &= ~(map.count & rc->count);
@@ -5175,6 +5175,16 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
}
}
+ /* Fallback to no channel allocation since none could be matched. */
+ if (!selected) {
+ lpac->ops->select(lpac, rpac, 0, &rpac->qos, func, user_data,
+ lpac->user_data);
+ selected++;
+ }
+
+ if (count)
+ *count += selected;
+
return 0;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH BlueZ v4 3/4] shared/bap: Fix not resuming reading attributes
2024-04-11 20:03 [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location Luiz Augusto von Dentz
2024-04-11 20:03 ` [PATCH BlueZ v4 2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation Luiz Augusto von Dentz
@ 2024-04-11 20:03 ` Luiz Augusto von Dentz
2024-04-11 20:03 ` [PATCH BlueZ v4 4/4] bap: Update properties of endpoints Luiz Augusto von Dentz
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-11 20:03 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If there is an unexpected disconnect and some attributes values
where left uninitialized this attempts to resume reading them once a
new session is attached.
---
src/shared/bap.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index cc1fa1ffbe32..5fee7b4c54ca 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4703,6 +4703,18 @@ clone:
}
}
+ /* Resume reading sink locations if supported */
+ if (pacs->sink && pacs->sink_loc && !pacs->sink_loc_value) {
+ if (gatt_db_attribute_get_char_data(pacs->sink_loc,
+ NULL, &value_handle,
+ NULL, NULL, NULL)) {
+ bt_gatt_client_read_value(bap->client,
+ value_handle,
+ read_sink_pac_loc,
+ bap, NULL);
+ }
+ }
+
/* Resume reading sources if supported */
if (pacs->source && queue_isempty(bap->rdb->sources)) {
if (gatt_db_attribute_get_char_data(pacs->source,
@@ -4715,6 +4727,48 @@ clone:
}
}
+ /* Resume reading source locations if supported */
+ if (pacs->source && pacs->source_loc &&
+ !pacs->source_loc_value) {
+ if (gatt_db_attribute_get_char_data(pacs->source_loc,
+ NULL, &value_handle,
+ NULL, NULL, NULL)) {
+ bt_gatt_client_read_value(bap->client,
+ value_handle,
+ read_source_pac_loc,
+ bap, NULL);
+ }
+ }
+
+ /* Resume reading supported contexts if supported */
+ if (pacs->sink && pacs->supported_context &&
+ !pacs->supported_sink_context_value &&
+ !pacs->supported_source_context_value) {
+ if (gatt_db_attribute_get_char_data(
+ pacs->supported_context,
+ NULL, &value_handle,
+ NULL, NULL, NULL)) {
+ bt_gatt_client_read_value(bap->client,
+ value_handle,
+ read_pac_supported_context,
+ bap, NULL);
+ }
+ }
+
+ /* Resume reading contexts if supported */
+ if (pacs->sink && pacs->context &&
+ !pacs->sink_context_value &&
+ !pacs->source_context_value) {
+ if (gatt_db_attribute_get_char_data(pacs->context,
+ NULL, &value_handle,
+ NULL, NULL, NULL)) {
+ bt_gatt_client_read_value(bap->client,
+ value_handle,
+ read_pac_context,
+ bap, NULL);
+ }
+ }
+
queue_foreach(bap->remote_eps, bap_endpoint_foreach, bap);
bap_cp_attach(bap);
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH BlueZ v4 4/4] bap: Update properties of endpoints
2024-04-11 20:03 [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location Luiz Augusto von Dentz
2024-04-11 20:03 ` [PATCH BlueZ v4 2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation Luiz Augusto von Dentz
2024-04-11 20:03 ` [PATCH BlueZ v4 3/4] shared/bap: Fix not resuming reading attributes Luiz Augusto von Dentz
@ 2024-04-11 20:03 ` Luiz Augusto von Dentz
2024-04-11 22:57 ` [BlueZ,v4,1/4] shared/bap: Fix not updating location bluez.test.bot
2024-04-12 14:50 ` [PATCH BlueZ v4 1/4] " patchwork-bot+bluetooth
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-11 20:03 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If a MediaEndpoint if found during registration stage attempt to check
and update properties since they may have been updated at later stage
when a session has been attached.
---
profiles/audio/bap.c | 48 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index db0af7e7cba5..30049f0fb3a7 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -92,6 +92,9 @@ struct bap_ep {
struct bap_data *data;
struct bt_bap_pac *lpac;
struct bt_bap_pac *rpac;
+ uint32_t locations;
+ uint16_t supported_context;
+ uint16_t context;
struct queue *setups;
};
@@ -376,9 +379,10 @@ static gboolean get_locations(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
struct bap_ep *ep = data;
- uint32_t locations = bt_bap_pac_get_locations(ep->rpac);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &locations);
+ ep->locations = bt_bap_pac_get_locations(ep->rpac);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &ep->locations);
return TRUE;
}
@@ -387,9 +391,11 @@ static gboolean get_supported_context(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
struct bap_ep *ep = data;
- uint16_t context = bt_bap_pac_get_supported_context(ep->rpac);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &context);
+ ep->supported_context = bt_bap_pac_get_supported_context(ep->rpac);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16,
+ &ep->supported_context);
return TRUE;
}
@@ -398,9 +404,10 @@ static gboolean get_context(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
struct bap_ep *ep = data;
- uint16_t context = bt_bap_pac_get_context(ep->rpac);
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &context);
+ ep->context = bt_bap_pac_get_context(ep->rpac);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &ep->context);
return TRUE;
}
@@ -1261,6 +1268,31 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data,
return ep;
}
+static void ep_update_properties(struct bap_ep *ep)
+{
+ if (!ep->rpac)
+ return;
+
+ if (ep->locations != bt_bap_pac_get_locations(ep->rpac))
+ g_dbus_emit_property_changed(btd_get_dbus_connection(),
+ ep->path,
+ MEDIA_ENDPOINT_INTERFACE,
+ "Locations");
+
+ if (ep->supported_context !=
+ bt_bap_pac_get_supported_context(ep->rpac))
+ g_dbus_emit_property_changed(btd_get_dbus_connection(),
+ ep->path,
+ MEDIA_ENDPOINT_INTERFACE,
+ "SupportedContext");
+
+ if (ep->context != bt_bap_pac_get_context(ep->rpac))
+ g_dbus_emit_property_changed(btd_get_dbus_connection(),
+ ep->path,
+ MEDIA_ENDPOINT_INTERFACE,
+ "Context");
+}
+
static struct bap_ep *ep_register(struct btd_service *service,
struct bt_bap_pac *lpac,
struct bt_bap_pac *rpac)
@@ -1289,8 +1321,10 @@ static struct bap_ep *ep_register(struct btd_service *service,
}
ep = queue_find(queue, match_ep, &match);
- if (ep)
+ if (ep) {
+ ep_update_properties(ep);
return ep;
+ }
ep = new0(struct bap_ep, 1);
ep->data = data;
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* RE: [BlueZ,v4,1/4] shared/bap: Fix not updating location
2024-04-11 20:03 [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location Luiz Augusto von Dentz
` (2 preceding siblings ...)
2024-04-11 20:03 ` [PATCH BlueZ v4 4/4] bap: Update properties of endpoints Luiz Augusto von Dentz
@ 2024-04-11 22:57 ` bluez.test.bot
2024-04-12 14:50 ` [PATCH BlueZ v4 1/4] " patchwork-bot+bluetooth
4 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2024-04-11 22:57 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 3218 bytes --]
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=843758
---Test result---
Test Summary:
CheckPatch PASS 1.85 seconds
GitLint FAIL 1.44 seconds
BuildEll PASS 25.04 seconds
BluezMake PASS 1714.50 seconds
MakeCheck PASS 13.76 seconds
MakeDistcheck PASS 179.88 seconds
CheckValgrind PASS 249.74 seconds
CheckSmatch WARNING 354.55 seconds
bluezmakeextell PASS 121.59 seconds
IncrementalBuild PASS 6157.17 seconds
ScanBuild PASS 996.33 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v4,2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (87>80): "[BlueZ,v4,2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:282:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location
2024-04-11 20:03 [PATCH BlueZ v4 1/4] shared/bap: Fix not updating location Luiz Augusto von Dentz
` (3 preceding siblings ...)
2024-04-11 22:57 ` [BlueZ,v4,1/4] shared/bap: Fix not updating location bluez.test.bot
@ 2024-04-12 14:50 ` patchwork-bot+bluetooth
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2024-04-12 14:50 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 11 Apr 2024 16:03:02 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Fix not updating map.location when selecting.
> ---
> src/shared/bap.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Here is the summary with links:
- [BlueZ,v4,1/4] shared/bap: Fix not updating location
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=be79cd19c5c5
- [BlueZ,v4,2/4] shared/bap: Make bt_bap_select fallback in case of no channel allocation
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c7dcd064057f
- [BlueZ,v4,3/4] shared/bap: Fix not resuming reading attributes
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7db85520b76d
- [BlueZ,v4,4/4] bap: Update properties of endpoints
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9be5d8018dd1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread