shared/bap: Fix endpoint configuration
PATCH v2 1/1 shared/bap: Fix endpoint configuration
When a first local endpoint is created after connection to a remote device this doesn't trigger the SelectProperties request because bt_bap_bac ops are not yet set when bt_bap_select() is called. Creating a second local endpoint allows to trigger SelectProperties request for the first endpoint.
This commit fixes this behavior by setting the ops during bt_bap_pac creation.
---v1->v2: Add bt_bap_add_vendor_pac_full() instead of changing
bt_bap_add_vendor_pac()
profiles/audio/media.c | 9 ++++----- src/shared/bap.c | 20 ++++++++++++++++++-- src/shared/bap.h | 33 +++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 19 deletions(-)
profiles/audio/media.c +4 -5
@@ -1361,9 +1361,10 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type, metadata->iov_len = endpoint->metadata_size; } - endpoint->pac =bt_bap_add_vendor_pac (db, name, type, endpoint->codec, - endpoint->cid, endpoint->vid, &endpoint->qos, - &data, metadata); + endpoint->pac =bt_bap_add_vendor_pac_full (db, name, type, + endpoint->codec, endpoint->cid, endpoint->vid, + &endpoint->qos, &data, metadata, + &pac_ops, endpoint);if (!endpoint->pac) {error ("Unable to create PAC" );free (name);
@@ -1371,8 +1372,6 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,return false; } -bt_bap_pac_set_ops (endpoint->pac, &pac_ops, endpoint); -DBG ("PAC %s registered" , name);free (name);
src/shared/bap.c +18 -2
@@ -4124,12 +4124,14 @@ static void notify_session_pac_added(void *data, void *user_data)queue_foreach (bap->pac_cbs, notify_pac_added, user_data); } -struct bt_bap_pac *bt_bap_add_vendor_pac (struct gatt_db *db, +struct bt_bap_pac *bt_bap_add_vendor_pac_full (struct gatt_db *db,const char *name,uint8_t type,uint8_t id,uint16_t cid,uint16_t vid,struct bt_bap_pac_qos *qos,struct iovec *data, -struct iovec *metadata) +struct iovec *metadata, +struct bt_bap_pac_ops *ops, +void *ops_user_data) {struct bt_bap_db *bdb;struct bt_bap_pac *pac;
@@ -4150,6 +4152,8 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db, codec.vid = vid; pac =bap_pac_new (bdb, name, type, &codec, qos, data, metadata); +if (ops) +bt_bap_pac_set_ops (pac, ops, ops_user_data);switch (type) {case BT_BAP_SINK :
@@ -4174,6 +4178,18 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,return pac; } +struct bt_bap_pac *bt_bap_add_vendor_pac (struct gatt_db *db, +const char *name,uint8_t type, +uint8_t id,uint16_t cid,uint16_t vid, +struct bt_bap_pac_qos *qos, +struct iovec *data, +struct iovec *metadata) +{ +return bt_bap_add_vendor_pac_full (db, name, type, id, cid, vid, qos, + data, metadata, +NULL ,NULL ); +} + struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name, uint8_t type, uint8_t id, struct bt_bap_pac_qos *qos,
src/shared/bap.h +21 -12
@@ -67,6 +67,27 @@ struct bt_bap_pac_qos {uint16_t context; }; +struct bt_bap_pac_ops { +int (*select)(struct bt_bap_pac *lpac,struct bt_bap_pac *rpac, +uint32_t chan_alloc,struct bt_bap_pac_qos *qos, +bt_bap_pac_select_t cb,void *cb_data,void *user_data); +void (*cancel_select)(struct bt_bap_pac *lpac, +bt_bap_pac_select_t cb,void *cb_data,void *user_data); +int (*config)(struct bt_bap_stream *stream,struct iovec *cfg, +struct bt_bap_qos *qos,bt_bap_pac_config_t cb, +void *user_data); +void (*clear)(struct bt_bap_stream *stream,void *user_data); +}; + +struct bt_bap_pac *bt_bap_add_vendor_pac_full (struct gatt_db *db, +const char *name,uint8_t type, +uint8_t id,uint16_t cid,uint16_t vid, +struct bt_bap_pac_qos *qos, +struct iovec *data, +struct iovec *metadata, +struct bt_bap_pac_ops *ops, +void *ops_user_data); + struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db, const char *name, uint8_t type, uint8_t id, uint16_t cid, uint16_t vid,
@@ -80,18 +101,6 @@ struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,struct iovec *data, struct iovec *metadata); -struct bt_bap_pac_ops { -int (*select)(struct bt_bap_pac *lpac,struct bt_bap_pac *rpac, -uint32_t chan_alloc,struct bt_bap_pac_qos *qos, -bt_bap_pac_select_t cb,void *cb_data,void *user_data); -void (*cancel_select)(struct bt_bap_pac *lpac, -bt_bap_pac_select_t cb,void *cb_data,void *user_data); -int (*config)(struct bt_bap_stream *stream,struct iovec *cfg, -struct bt_bap_qos *qos,bt_bap_pac_config_t cb, -void *user_data); -void (*clear)(struct bt_bap_stream *stream,void *user_data); -}; -bool bt_bap_pac_set_ops (struct bt_bap_pac *pac,struct bt_bap_pac_ops *ops,void *user_data);
Signature · 1 line
2.43.0
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=1056469
---Test result---
Test Summary:
CheckPatch PENDING 0.30 seconds GitLint PENDING 0.29 seconds BuildEll PASS 20.32 seconds BluezMake PASS 653.77 seconds MakeCheck PASS 18.89 seconds MakeDistcheck PASS 246.51 seconds CheckValgrind PASS 298.03 seconds CheckSmatch WARNING 356.49 seconds bluezmakeextell PASS 183.28 seconds IncrementalBuild PENDING 0.43 seconds ScanBuild PASS 1037.09 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:src/shared/bap.c:312: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:312: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:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 10 lines · On Mon, 23 Feb 2026 13:01:42 +0100 you wrote:
When a first local endpoint is created after connection to a remote device this doesn't trigger the SelectProperties request because
bt_bap_bacops are not yet set whenbt_bap_select()is called. Creating a second local endpoint allows to trigger SelectProperties request for the first endpoint.This commit fixes this behavior by setting the ops during
bt_bap_paccreation.[...]
Here is the summary with links:
- [BlueZ,v2] shared/bap: Fix endpoint configuration
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=21459ac269ed
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html