profiles: Add remote endpoint path to SelectProperties
v2 cover profiles: Add remote endpoint path to SelectProperties
The SelectProperties method is only called on the central (initiator) device. But there's no information related to the remote device for which is call is done.
These commits allow the audio server to link this call method to the appropriate remote endpoint.
Changes in V2:
- Set endpoint part of the dictionary properties
- Pass rpac to select function instead of DBus specific path
- Add a new commit to keep consistency after fixing previous patch for a checkpatch warning
Frédéric Danis (3):
profiles: Add remote endpoint path to SelectProperties
doc: Add remote endpoint path to SelectProperties
profiles: Fix function definition style
doc/media-api.txt | 6 ++++-- profiles/audio/bap.c | 2 ++ profiles/audio/media.c | 15 ++++++++++++--- src/shared/bap.c | 12 +++++++++++- src/shared/bap.h | 11 +++++++---- 5 files changed, 36 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/3 profiles: Add remote endpoint path to SelectProperties
This adds the remote endpoint path to the dictionary sent in SelectProperties.
It allows audio application to know for which remote endpoint the call is done and so for which it should act as an initiator.
--- profiles/audio/bap.c | 2 ++ profiles/audio/media.c | 15 ++++++++++++--- src/shared/bap.c | 12 +++++++++++- src/shared/bap.h | 7 +++++-- 4 files changed, 30 insertions(+), 6 deletions(-)
profiles/audio/bap.c +2 -0
@@ -555,6 +555,8 @@ static struct bap_ep *ep_register(struct btd_service *service,return NULL ; } +bt_bap_pac_set_user_data (rpac, ep->path); +DBG ("ep %p lpac %p rpac %p path %s" , ep, ep->lpac, ep->rpac, ep->path);queue_push_tail (queue, ep);
profiles/audio/media.c +12 -3
@@ -889,16 +889,20 @@ done: data->cb (data->pac, err, caps, metadata, &qos, data->user_data); } -static int pac_select (struct bt_bap_pac *pac,struct bt_bap_pac_qos *qos, -struct iovec *caps,struct iovec *metadata, +static int pac_select (struct bt_bap_pac *lpac,struct bt_bap_pac *rpac, +struct bt_bap_pac_qos *qos,bt_bap_pac_select_t cb,void *cb_data,void *user_data) {struct media_endpoint *endpoint = user_data; +struct iovec *caps; +struct iovec *metadata; +const char *endpoint_path;struct pac_select_data *data;DBusMessage *msg;DBusMessageIter iter, dict;const char *key ="Capabilities" ; +bt_bap_pac_get_codec (rpac,NULL , &caps, &metadata);if (!caps)return -EINVAL ;
@@ -911,7 +915,7 @@ static int pac_select(struct bt_bap_pac *pac, struct bt_bap_pac_qos *qos, } data = new0(struct pac_select_data, 1); - data->pac = pac; + data->pac = lpac; data->cb = cb; data->user_data = cb_data;
@@ -919,6 +923,11 @@ static int pac_select(struct bt_bap_pac *pac, struct bt_bap_pac_qos *qos,dbus_message_iter_open_container (&iter,DBUS_TYPE_ARRAY ,"{sv}" , &dict); + endpoint_path =bt_bap_pac_get_user_data (rpac); +if (endpoint_path) +g_dbus_dict_append_entry (&dict,"Endpoint" , +DBUS_TYPE_OBJECT_PATH , &endpoint_path); +g_dbus_dict_append_basic_array (&dict,DBUS_TYPE_STRING , &key,DBUS_TYPE_BYTE , &caps->iov_base, caps->iov_len);
src/shared/bap.c +11 -1
@@ -3934,6 +3934,16 @@ int bt_bap_pac_get_codec(struct bt_bap_pac *pac, uint8_t *id,return bt_bap_pac_get_vendor_codec (pac, id,NULL ,NULL , data, metadata); } +void bt_bap_pac_set_user_data (struct bt_bap_pac *pac,void *user_data) +{ + pac->user_data = user_data; +} + +void *bt_bap_pac_get_user_data (struct bt_bap_pac *pac) +{ +return pac->user_data; +} +static bool find_ep_unused (const void *data,const void *user_data) {const struct bt_bap_endpoint *ep = data;
@@ -4066,7 +4076,7 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,if (!lpac->ops || !lpac->ops->select)return -EOPNOTSUPP ; - lpac->ops->select (lpac, &rpac->qos, rpac->data, rpac->metadata, + lpac->ops->select (lpac, rpac, &rpac->qos, func, user_data, lpac->user_data);return 0 ;
src/shared/bap.h +5 -2
@@ -120,8 +120,8 @@ struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name, struct iovec *metadata);struct bt_bap_pac_ops { -int (*select) (struct bt_bap_pac *pac,struct bt_bap_pac_qos *qos, -struct iovec *caps,struct iovec *metadata, +int (*select)(struct bt_bap_pac *lpac,struct bt_bap_pac *rpac, +struct bt_bap_pac_qos *qos,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,
@@ -186,6 +186,9 @@ int bt_bap_pac_get_vendor_codec(struct bt_bap_pac *pac, uint8_t *id,int bt_bap_pac_get_codec (struct bt_bap_pac *pac,uint8_t *id,struct iovec **data,struct iovec **metadata); +void bt_bap_pac_set_user_data (struct bt_bap_pac *pac,void *user_data); +void *bt_bap_pac_get_user_data (struct bt_bap_pac *pac); +/* Stream related functions */ int bt_bap_select (struct bt_bap_pac *lpac,struct bt_bap_pac *rpac,bt_bap_pac_select_t func,void *user_data);
Signature · 1 line
2.25.1
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=672467
---Test result---
Test Summary:
CheckPatch PASS 3.40 seconds GitLint FAIL 2.32 seconds Prep - Setup ELL PASS 26.45 seconds Build - Prep PASS 0.68 seconds Build - Configure PASS 8.09 seconds Build - Make PASS 735.40 seconds Make Check PASS 11.29 seconds Make Check w/Valgrind PASS 286.38 seconds Make Distcheck PASS 237.35 seconds Build w/ext ELL - Configure PASS 8.26 seconds Build w/ext ELL - Make PASS 82.60 seconds Incremental Build w/ patches PASS 292.60 seconds Scan Build WARNING 516.29 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint Output:
[BlueZ,v2,3/3] profiles: Fix function definition style
6: B3 Line contains hard tab characters (\t): "+ int (*select) (struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,"
##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches. Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************profiles/audio/media.c:1459:6: warning: 8th function call argument is an uninitialized value
if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~profiles/audio/media.c:3005:3: warning: Use of memory after it is freed
release_endpoint(adapter->endpoints->data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3008:3: warning: Use of memory after it is freed
media_player_destroy(adapter->players->data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~3 warnings generated.
---
Regards,
Linux Bluetooth
PATCH v2 2/3 doc: Add remote endpoint path to SelectProperties
In reply to Frédéric Danis--- doc/media-api.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
doc/media-api.txt +4 -2
@@ -601,8 +601,10 @@ Methods void SetConfiguration(object transport, dict properties) dict SelectProperties(dict properties) Select preferable properties from the supported - properties. Refer to SetConfiguration for the list of - possible properties. + properties: + object Endpoint [ISO only] + Refer to SetConfiguration for the list of + other possible properties. Returns propeties which can be used to setup a transport.
Signature · 1 line
2.25.1
PATCH v2 3/3 profiles: Fix function definition style
In reply to Frédéric DanisThis was found by checkpatch in previous commit:
WARNING:SPACING: Unnecessary space before function pointer arguments 124: FILE: src/shared/bap.h:123:
+ int (*select) (struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
Do the same for (*config) and (*clear) for consistence.
--- src/shared/bap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/shared/bap.h +2 -2
@@ -123,10 +123,10 @@ struct bt_bap_pac_ops {int (*select)(struct bt_bap_pac *lpac,struct bt_bap_pac *rpac,struct bt_bap_pac_qos *qos,bt_bap_pac_select_t cb,void *cb_data,void *user_data); -int (*config) (struct bt_bap_stream *stream,struct iovec *cfg, +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); +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,
Signature · 1 line
2.25.1
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 6 lines · On Tue, 30 Aug 2022 16:47:31 +0200 you wrote:
The SelectProperties method is only called on the central (initiator) device. But there's no information related to the remote device for which is call is done.
These commits allow the audio server to link this call method to the appropriate remote endpoint.
Quoted 7 lines
Changes in V2:
- Set endpoint part of the dictionary properties
- Pass rpac to select function instead of DBus specific path
- Add a new commit to keep consistency after fixing previous patch for a checkpatch warning[...]
Here is the summary with links:
- [BlueZ,v2,1/3] profiles: Add remote endpoint path to SelectProperties
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=eb62d17e26f6 - [BlueZ,v2,2/3] doc: Add remote endpoint path to SelectProperties https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fdff0e3ce300 - [BlueZ,v2,3/3] profiles: Fix function definition style https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d04b64003d9d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html