From patchwork Tue Aug 30 20:54:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= X-Patchwork-Id: 12959868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8E46ECAAD5 for ; Tue, 30 Aug 2022 20:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230438AbiH3Uy0 (ORCPT ); Tue, 30 Aug 2022 16:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbiH3UyX (ORCPT ); Tue, 30 Aug 2022 16:54:23 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CFC3861E6 for ; Tue, 30 Aug 2022 13:54:22 -0700 (PDT) Received: from localhost.localdomain (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by madras.collabora.co.uk (Postfix) with ESMTPSA id 8DFD86601DC3 for ; Tue, 30 Aug 2022 21:54:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661892860; bh=eMxynpX8LsZUg6Hmd83LRbSqFYSJQhe3zoDjJp+qTu4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Vg5OfENEjDa8M/F2Vosu7Q+IxIctmL4S3HiNSFY2+1caZS/qAiGDdNPNdnhHfuNm6 uTxToWPWbL9Gkoro3Q41tNkwpdWAxdxMtsz6Ie5LdIn0D4q80dnnWQPNgGezSYVFvX J3xeaAN263T9cdsPC0CUIS8X8dHqpuGAlB7KpzC7aPlWu5dw4reLCyNPt0DR5G4Vd+ kqEl5PoF/ivCxfpKF+j4VWPvO3Pb9c/k1G7Wy4JGKp3NvrVm7jrIT9Ulh38ekDACjA 51qgVLrOJQj4vp/HhQW/TtV+1sB/PynNtKvSOutbi8LjlF9gXJIHQn8f9QSLopXSR1 vFi0QoaSXn06A== From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 1/3] profiles: Add remote endpoint path to SelectProperties Date: Tue, 30 Aug 2022 22:54:09 +0200 Message-Id: <20220830205411.68299-2-frederic.danis@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220830205411.68299-1-frederic.danis@collabora.com> References: <20220830205411.68299-1-frederic.danis@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index d388afe56..67aba3bd7 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -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); diff --git a/profiles/audio/media.c b/profiles/audio/media.c index ff3fa197b..85278a6d9 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -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); diff --git a/src/shared/bap.c b/src/shared/bap.c index 8edc7b72e..150b2116e 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -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; diff --git a/src/shared/bap.h b/src/shared/bap.h index ff4bac330..93b00d771 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -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); From patchwork Tue Aug 30 20:54:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= X-Patchwork-Id: 12959871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D88FECAAD5 for ; Tue, 30 Aug 2022 20:54:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbiH3Uy2 (ORCPT ); Tue, 30 Aug 2022 16:54:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbiH3UyX (ORCPT ); Tue, 30 Aug 2022 16:54:23 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3438672F for ; Tue, 30 Aug 2022 13:54:22 -0700 (PDT) Received: from localhost.localdomain (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by madras.collabora.co.uk (Postfix) with ESMTPSA id C3AA56601DDB for ; Tue, 30 Aug 2022 21:54:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661892860; bh=C6OUOHXNHpu4Tz4UaptT6NPb9XXLiHH4PdT77NztCmc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DUCcq1d8ezJ9UdQh/SE8sj/36RLkj5rxJvDC2d5QCVomqcPbDu4uUFFAlU210mVI/ yubgt3zROcYeo9sagpaskv3rd4rwAq0aVfPgR2ZfNh9zdP+5o9u1lSfoNfcb7S5p6q GbMsWvKV2w79zTcYWvuIBK+Aoafep/LH3lMkRUjFsDzmqdRjI3bd/EaR2ZDjZ6+ldt +b+xE8lbkvthAQ3wVRKv0VjO/nt66/Na1XvMggvOwC9xpZmf5gGdanuA/mPy6rPxbZ 9S/sO7enMNPW+RmFm7QnDJL/yy/IPdbbUAM4cMXZASn/wEhTFy3rkVQSLgRG/LrkT8 DBQ5SyBcy/M/w== From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 2/3] doc: Add remote endpoint path to SelectProperties Date: Tue, 30 Aug 2022 22:54:10 +0200 Message-Id: <20220830205411.68299-3-frederic.danis@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220830205411.68299-1-frederic.danis@collabora.com> References: <20220830205411.68299-1-frederic.danis@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- doc/media-api.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/media-api.txt b/doc/media-api.txt index 9cd211355..847f8bee7 100644 --- a/doc/media-api.txt +++ b/doc/media-api.txt @@ -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. From patchwork Tue Aug 30 20:54:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= X-Patchwork-Id: 12959870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A2CC0502A for ; Tue, 30 Aug 2022 20:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbiH3Uy1 (ORCPT ); Tue, 30 Aug 2022 16:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbiH3UyX (ORCPT ); Tue, 30 Aug 2022 16:54:23 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF9F86731 for ; Tue, 30 Aug 2022 13:54:22 -0700 (PDT) Received: from localhost.localdomain (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by madras.collabora.co.uk (Postfix) with ESMTPSA id 11CE96601DDD for ; Tue, 30 Aug 2022 21:54:21 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661892861; bh=pNHwki0Xdbw+94ZZqN1z8E/ybCNnfvHFlO0jSAeX3NI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YAwyFUHSGsyo9HcXRSbUtzNfX9QoLIuK60OFWP7HBuAWBhWUXBleWkgEqrUn9SY/I xIVMmJmU7YGKPnqUMQWzNKUM4465biemTShF6dMpHlZkZAVOmBSx+lwr+IKa79g1rk yUDqDwHQDy2qBAmDK7BdvU+Lv6RYpFmptRwt5el2QYWii7ec5uSvH/V5ff1yllwZca o3+lYB7qsMPjvyDx8dFCgxugEkfVFVfdzPIbEJ8YTvoavjwWA6Y6L2e8//RyjBTSek /Rn4N/weXT4KTggyhx7T1y+vi5EultyIwA+c76dl3rFJsQ3dxv7iT8ZLkW7F8MbEZ6 car25Dt58j2FA== From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 3/3] profiles: Fix function definition style Date: Tue, 30 Aug 2022 22:54:11 +0200 Message-Id: <20220830205411.68299-4-frederic.danis@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220830205411.68299-1-frederic.danis@collabora.com> References: <20220830205411.68299-1-frederic.danis@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This 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(-) diff --git a/src/shared/bap.h b/src/shared/bap.h index 93b00d771..b63b4b024 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -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,