2024-04-11 18:35:00

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v3 1/3] shared/bap: Fix not updating location

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

Fix not updating map.location when selecting.
---
src/shared/bap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index f553096dfcc6..b452461ac715 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5163,12 +5163,10 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,

/* Check if there are any channels left to select */
map.count &= ~(map.count & rc->count);
- if (!map.count)
- break;
-
/* Check if there are any locations left to select */
map.location &= ~(map.location & rc->location);
- if (!map.location)
+
+ if (!map.count || !map.location)
break;

/* Check if device require AC*(i) settings */
--
2.44.0



2024-04-11 18:35:21

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v3 3/3] shared/bap: Fix not resuming reading source/sink locations

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

If there is and unexpected disconnect and the source/sink locations
where left uninitialized this attempts to resume reading them once a
new session is attached.
---
src/shared/bap.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index cc1fa1ffbe32..79d9345d9161 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,19 @@ 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);
+ }
+ }
+
queue_foreach(bap->remote_eps, bap_endpoint_foreach, bap);

bap_cp_attach(bap);
--
2.44.0


2024-04-11 19:04:43

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v3 2/3] shared/bap: Make bt_bap_select fallback in case of no channel allocation

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

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


2024-04-11 20:34:41

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v3,1/3] shared/bap: Fix not updating location

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

---Test result---

Test Summary:
CheckPatch PASS 1.25 seconds
GitLint FAIL 1.06 seconds
BuildEll PASS 24.37 seconds
BluezMake PASS 1666.15 seconds
MakeCheck PASS 13.36 seconds
MakeDistcheck PASS 180.32 seconds
CheckValgrind PASS 253.00 seconds
CheckSmatch WARNING 350.35 seconds
bluezmakeextell PASS 118.67 seconds
IncrementalBuild PASS 4594.81 seconds
ScanBuild PASS 1021.15 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v3,2/3] 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,v3,2/3] 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 struct
uressrc/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