From patchwork Tue Jul 16 14:21:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 813249 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013033.outbound.protection.outlook.com [52.101.67.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C228119B593 for ; Tue, 16 Jul 2024 14:22:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.33 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139745; cv=fail; b=gHYadJbAoEv6c8IGRdsmLlSKyElMthCfCObGxl28zMxiLhRCl+wsKDw0p1Himikf81kThoEyNrVn9jSLbQKwofDGK8dgcQLNa+bZdfdhRL8mV/vEj6UQ9hIfYfTpoj27rmU5kTYnhc/WfM5+96jg0DBBdY4ZOYArrKe5KM7GLGQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139745; c=relaxed/simple; bh=WFzIkxDniR497VH/kmzdXQz9vy1Bn6Xgc2BsmxVES5Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rjAzY8l3ZHdWj+BrE4VikfpPziLssItAlZY5ZnjwcXmF1vwPfVGvjdBWYBfM8n/1XiK2SVLKNIOvUO2EAxs7nCPV8Ek31b8AfFe1t+K4nSei+EzAsvXN/l3iE513uUXLOOagHoPkp3t1FtNl5E3aVwm5wzwnAbLXkSX3KpxMWdA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=mfAKdE88; arc=fail smtp.client-ip=52.101.67.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mfAKdE88" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FKtBPjWHEThBVMZK5OjbtfGx08zXiQWSS/l3h412/4MnSpJSSZlie4ZFx7iJljWuoQM5aI7ncZFoEzRuwZGqNtKiHvDNnj/gwdYSTKQ4wexSJq+ZbZQrT88qzn1ksHYrBHKRMk0lEfzEm1dTd3doa7qaFiPU1fA6zv5Mxu05ItSdX3k6eABBZrzyF0JefQp9iKJdkAILGffdR18zq4lhBCOCqzzs/4/RE0S3obTjD/zY/ObfL/FHKVyMV9zJVf930aTCVQydZHg8tlI+Y103cniWakl95wRQq36etLSQ4HLwY4dMS9FMDMY/x/Eal828+Osq08ck0uQqjyo18NGkaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AjQdyF9qsp8SunTTN/0pInmxGPJwSSavOLx3UARl1y0=; b=rhpR/i3rPqK4SWNgZdpvuY7r3OSbZ2J2tgDFEJlvfFpVJx/yWrTJDXyExnJKhLOvCMqDK3pVzopPXVRZAd4AwZTo1AN6241E8RRA+nEAyJifw5wyC+adhCp7VPI5LJdtZkyjs12p7V766s6w1WDL1jl37yzLDcislFHpPEkymOgdqyF7hgim4abxEJ6cvkSL776/TxoLtS0HiVaJRhkvUgz9nt+MIOpv7whQcVSW0FBU+0qJnzhDk2XCaeZobsyo1/Gb4yO6l/wcLi+CURYJGYaES9eBcV0Z80VsJjDo6LOmjLjU1wYtlL182xsaam3WwzaN5zdEDSf+DCTg/4Wyvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AjQdyF9qsp8SunTTN/0pInmxGPJwSSavOLx3UARl1y0=; b=mfAKdE88q3YRtioTB0YpNyySLZg621GenVO4cRD17CbJxcz0i2UjVVA8pMeYNdlHy7JtiFJ67YcA4QeIrURpK0O5+Ez/DFkRGS01IZpfRMygZweHz8ET3Z0o73pND9w5SjA/I4UVM6LJpegGfKh21JQ7ddLEvlaDn6tQZKqjJLs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:20 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:20 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 01/10] shared/bap: Add separate API to merge caps Date: Tue, 16 Jul 2024 17:21:58 +0300 Message-Id: <20240716142207.4298-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P195CA0029.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5d6::19) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 30d72e6e-05d6-4b1b-4d99-08dca5a2b3f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: j7G8tQMEAficscT5L7syKzLfyj3na9y67hc6AR12m7TKByifWVbVsUKp3aYichEMutjllqGm0quATaAM8IuHLuTZYxTinWMR565xSvlsJne+ABSs9E0yRJU5ybJv8QCWCPhw4pZNJkRb4Bv2OuQr7RF9f+LEn6w0uYbCcwA1dtWtjE4HUpSY3kFCDLK4iXwj31kHG1zcWgyDSDzAEo6xPxZeh1kAgvFsJR2RsG1gfJ0a7AgYPkxZe9ALd5l3ektDks6xU9aMSrKPOxSoxa1a1EkrWwvERsGOFrozM007TWKVzz4nIjyBGlanh/VrywBXZT+UcX2Kom+mcBCCOPNmBYqTrQv425JHQOiMie8t33RYFvInYrGewjfq5PWdHq5J3omZd5HTjpaMS3qX+yqdGAI+HNY9Ekp6fzqDwlePRDB10o3oQYZmk8bHDX6eAUlx4051NkZcYFuKl+VS4xLbJKQ3ERcq3WGjCqN+bWUWkKizZCq6A43SplwFE5+oCqBweBuNZWzBY3r0ilg1Tn6C3lHHlbhmHi8z6Dy0J6IpxtPDzxsDBL5PTbUI+BpcJysoYFP2lptjS5Q0cQbAEg7u2rFaZ9n2vXeYW2MGIez/2XnQKk+UDzNJ8hC2UoQw9KsEo6C8aNwXf4/zC1NAiKyNJUZ0R1GIPb5dAeFMwEdCEg2IFStu7C+q/WZLV1/B4DnZ2ZoBRs8/aY2FXM6i6Dxm92lAxSR9D/34ydKB4tePiM3ZB0d90Tn+duAOlVI75tHMHqxT/vMf8zobircPXxEK84GisWLvfVldOb8w9CLU5Ltpf6Qbod2GJ3Nokz8v7xqDfwWonc2eBtm4MqbEJqNVGQCjhhObl6vFCSdYVAfUIEEF8tFQPY2dS2YRwxusrznS2xuXXAz+9Rs4TrC/sGXFjEhseUv5+z6zCCf7VqIhoQtaQUQ4NyEtiZhpmC4YJ6FTGeikgM8PtsQ3aFIjhLIqiahYUPnNPxteTCATaZm5XoS/WAKEsEZrM8EK6SzN2m7B3aYAnaugpw+KIbFhMtpttRg2I8GfM3ALPrwC2mwCAPIlMm/8Ww4Z8jYuKYaZCW1EVTzcoEZDwTFyy3vY2C9JBhRWtAmFSxrVVKOarfUqKcIV58sbj3c+hXl7CGOADB624LybAjP/VSHY2t5Zgchf1z+Igy1Vf/nLglUimd8ig6vk0DRQvIBP3ntz2+3Wcur1X+onhBimcDkDf17J7LzPV1Jfzz6qyJy9HitBnn7WBGg/CQfFdbwc9xhpxRexvQtBl54ezEhmHZRbrlRke+3tj9Val4lzfA6WCTjdxW2rVKvUHcQP7KknfXyEplMYqUfGHIje6kXc6QQtQm8PE7rktw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QeKeStlIEVIiibD8oxDK0CcjQw4traPymofh0FEAz1iLA0oQVNy2t1F/qzRT3VsH8SR81sg1ufFdWa1MyIEehyEdE4d7bF6V+BMK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Y+yWcR+M0sMXk7oZxNLMAwS8ybfHhTjvpcPu8WLE9LhD2WxlYtztLH15XoTB8Mhivq186X1Kfn1XdMCe/w/9nZDVklbwlcXUfanCzAB82DE9N1ffRpF3LkDRG/VbOW+c/1aS22Mxlvyt3mJWCmyIsrRMCcwiQ18Xngh4BF/E2/SGinYT8TA0TitZR31LHR9A+FuVeDq+MEcq1UaJrCWQzDBdpStpVeNKQtwrt5ZPVsLgLpiP2NrIhqV36wuxgkQ2sRY6ZFm4lB5ULqatKQiMbkL3QslY0DNgNK9kunzeU+jqWq3mhGWuOutIUvIP+QpdA/9Njpcs3bOaEAbZM+MSTPlMsVESObs3+ttdJf9qFhMi/fc5rfDbA6iJJmk7f69GQjw1K0fs8NMh9TXF8yWze548HSdP0P/Rw5v/7HcWT8FQdAFLr1TrHSlSsA88h4500A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30d72e6e-05d6-4b1b-4d99-08dca5a2b3f3 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:20.3040 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZPkZbPcedl6LCBVZWE1MbpMVZ/cmDQrjl5Wf8FsgZnYPv4f1xCFHuHkvX8hpYPVNlQBWbcat6R43LXMDRS5ldQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This moves the logic to merge L2 and L3 capabilities discovered inside a BASE structure in a public API. --- src/shared/bap.c | 40 ++++++++++++++++++++++++---------------- src/shared/bap.h | 2 ++ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index d59eac8cc..1259ee3c9 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6607,29 +6607,21 @@ static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb, return compare_data; } -void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, - struct bt_bap_codec *codec, - struct iovec *l2_caps, - struct iovec *l3_caps, - struct bt_bap_pac **lpac, - struct iovec **caps) +struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps) { struct bt_ltv_extract merge_data = {0}; - struct bt_ltv_match match_data; if (!l2_caps) /* Codec_Specific_Configuration parameters shall * be present at Level 2. */ - return; + return NULL; - if (!l3_caps) { + if (!l3_caps) /* Codec_Specific_Configuration parameters may * be present at Level 3. */ - merge_data.result = util_iov_dup(l2_caps, 1); - goto done; - } + return util_iov_dup(l2_caps, 1); merge_data.src = l3_caps; merge_data.result = new0(struct iovec, 1); @@ -6642,17 +6634,33 @@ void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, NULL, bap_sink_check_level2_ltv, &merge_data); -done: + return merge_data.result; +} + +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, + struct bt_bap_codec *codec, + struct iovec *l2_caps, + struct iovec *l3_caps, + struct bt_bap_pac **lpac, + struct iovec **caps) +{ + struct iovec *merged_caps; + struct bt_ltv_match match_data; + + merged_caps = bt_bap_merge_caps(l2_caps, l3_caps); + if (!merged_caps) + return; + /* Check each BIS Codec Specific Configuration LTVs against our Codec * Specific Capabilities and if the BIS matches create a PAC with it */ - match_data = bap_check_bis(bap->ldb, merge_data.result); + match_data = bap_check_bis(bap->ldb, merged_caps); if (match_data.found == true) { - *caps = merge_data.result; + *caps = merged_caps; *lpac = match_data.data; DBG(bap, "Matching BIS %i", bis_index); } else { - util_iov_free(merge_data.result, 1); + util_iov_free(merged_caps, 1); *caps = NULL; *lpac = NULL; } diff --git a/src/shared/bap.h b/src/shared/bap.h index b35b2711e..e63161dca 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -251,6 +251,8 @@ bool bt_bap_pac_bcast_is_local(struct bt_bap *bap, struct bt_bap_pac *pac); struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream); +struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps); + void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_codec *codec, struct iovec *l2_caps, From patchwork Tue Jul 16 14:21:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 812891 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013033.outbound.protection.outlook.com [52.101.67.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F7EA19B58D for ; Tue, 16 Jul 2024 14:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.33 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139747; cv=fail; b=SDZxPPMbILlC5BQOGvMiWBoGdOXiMC9ZBDYTV/2hc+NLF9azlCeDG4Imi33K0+T/kKkDm6aDiU2WBEb8DRtelsHr0qjo5D5x5E9LFh6dCzsMaU3DPvUhnNv0ZAZqOoXxTrsS+1fF/+d0ZxN64Qo05e4QzsMwgHKjr/sxo3PDfR4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139747; c=relaxed/simple; bh=iPXaLU5EAwVsxn0iBVLFoaqPIyiNebTMQUK373tbAlQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LeImaF8bfyTTOqRbhKQN+MZ28kcd6Oekfjg3msdqSwJur5BWwPHZcoDMTk3abvcNeZLLL/2EgmyOPS9mEpkCNosB5DndYS5e4cTuYAh5GUPB/VcoSd0eHAgcM/y/5tEDPtmWBDf06AprPBgVfc42aEuqYaZf1BiUmtynHM8HZKo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=cGZbxzwH; arc=fail smtp.client-ip=52.101.67.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cGZbxzwH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PvGbfzNKIjNxCH/PZN1KpvPpFGBjtzDEhvlB1SNpF7PtLqoUdms3pWcd9lFsgpRK8M89b/G+Mh+/LwrNOOK5pvRF8JNwAa/GUiOyGWLd1xzwk+q3AQI7MM+9g9Xp/Szhdm+8YFBEHeCPzYd+qPcDFlfzyK4I1DgtABJYdc5JZvfiOzq2Arovq5KJz2NtyEktpOu4tqB2o34vknlbfByA+eT6DQ/pJu83riCt6rLY5xsgXQbdUz+qAZp7vWPBWS8JXE7Yc5UOl8Q8yLKpKurt3mIePcfGQ1bcKvcc+cDZTmxXxgJsQfcViihvPx6FgocXRRUVFC8RxTj/DiHfB5GiNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JizQ50A68A8iOZpi8FAJ2q902e3i4soN7UiXw+nuBWA=; b=pf/zU+lXrjuZysf1VgL3h7pznBD7l8hW8ToQIEqsYD/Eom4TDpLB//kFDhR3+eyrqbMwtb/hcRsZVGIZqPcuPDL+Zici0H2mX7T9HzMY8H6t98HqAvKDiojAzCXZHZB/DvtpSj5PJYuMjeMywKc9VraVCdKDDh7XR0RU6Tk6F7AZ2GIO5VphhgXmj7LeC4ilGBYeLYM4qmw73LHTF+9UnbgPC77MH5qO+OPgFY0s1g4rHPsY4XDJYdZwoIeUSVu34jD+JIKkpwmrbwh1PqDy1YS6UGlM7O1OxbUUouNhJRRboaf06VfJv8Uw2wQ9CApjSo83GndBm9aq48oHoGQZGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JizQ50A68A8iOZpi8FAJ2q902e3i4soN7UiXw+nuBWA=; b=cGZbxzwH+/TU29LxKnuW4A9PD+W+/Z4OUtTnU/lUUqczRmB5OD0i4u3AUY/bejirfytXK0zkky9dGrdOAV5A9YZQfdJj1P+WcE3RtPqzp4+degXHsRZlcFa2zE0t1O0IAZFMfKj+8lIsgre8+JIL/83edzhRsPSDDFzmwQ1lxnU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:23 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:23 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 02/10] shared/bap: Update bt_bap_verify_bis to receive caps Date: Tue, 16 Jul 2024 17:21:59 +0300 Message-Id: <20240716142207.4298-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P195CA0028.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5d6::13) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 277d6e31-36e9-4663-2824-08dca5a2b5e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: LUQLw4PaKoFQfGh6XipXMhyTbsXDQYy3yWGs2hW/oP+VPEgofJTaehLZX6cDGOXRqpdgbO/lPlPQPuTfRVJlvpyEWR0UoBBB/y2VXOKL5aiON4jBuIrxO4g46wGbCLOLRhAUV3PQ9yEJU1iE8trNec0S9Dc2SlXP92KyovCNinDTXrLhpb3IEuWgo9j/HYU09SzS2e2E/UVoeaJRkGK90iNHSGxHdlmkSMg7ce4CVZxlugYLiOxAX5KJyXzZmtjgMhJfhZAafyoJXbkqZ+jge98EqSiZt3k9gPsPO86fGvTcRdVsgzYKmr/74McbX7QcqENVAcXndk83SNECjvwUWK2S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IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UIRC366xBAgcs2kaCtvhAD7VNJTqP9lFHEVpRftptSaNwbldXu+qrwCD/GnKy1xTP77EnFxo+s3uLM6Tw6il/EYrDchrifwyTccar48WrI6Wb0sz24RBLHXTGrCg2xuruxkvBuqYr4KoFs2o5rCPD5/XjVYDJOiApDc1j9LnTt0NPAFR7Izv11hh90YkRtXPTwTBwEauKbjIUP0BzkCaAMtsn840IVn0c+l/0iCB19nDDifJ32HY4f6FGFtKWFM85i2pRRPD5ZoRzGr1ma4spUWQ4GGj5TZjJ5rLwt0D7QRCWxQUIruTBCKNdGgVIp76Q7MsiVYeGE7W/XyjmllVjceA3Ga/nWycxrUHqWkO+pq4CQOIETl5krmCkuTTkZk5ueOtz2FVTW6dSvQXsCcs3iAlwyYG4gAocFhXaOtl4k33mpta4RWyOi4bGYnf3+d1GYF+2hIcILmKH+hkqmJqrozKbCljmnwIK/VWHWoVrfLlpsJEsOikxcExYflRjdwGfMkfCyLlv0mz73yKmRNvaahCFY56w60IVYwu2WPzCuzrqv9I6JnpCu3QDuyrf6Fqv4QiFGU90M85a2cQMUDi2gIWIF/Kt5gR1fc5smID2C60m8Ew3ej/2LA79kv2O1F/oBKdMZ3JBm7H3oaxXSDZECte3GBjSyteaI6+HXY9o+W6by2Xygas3LBfP7UhTBCCuCA9chIGqFBcbWKNLLBg/hScGf78cokJcjRcZWVQSHXL1dfVvX4vpSG1Q+olwN711W9GL7l8icVSuu8Fh08HDptWPubc3fri53/l5jQ3qkUUM9LV7UO0U23fOZo96xyff//3cI2pbukoULHRzs/lYVJeAsGAhPrbb0KQkHpkGwqIkHYbEZGBKkFmyUedMb1svSZpX9I79st5w4GZpmkyYN9wMwyhX8jMOxqNSyxgRKD4LmWLEc7Ddphk9tbQsh+oyNT8lBcV9lfyQgmcurL1O7uzmV7pYyFdD3rmie6HUGowA7T9QwabTHNIAYEe6zwE2peCU/YMKs6x2AF0WUrb3+EIGiNWYAMdB4AfJPhv67D2wvgEDlnr2dW6uRSMaLS/Al2UWRopc+RXs60bNOZ09+jrhsW9YfW0LF7A3Ty2oyQxQce1GI7brYzyr1XN33EHgM160J37y89Px0nYtlf2klWbl8qXqtL9L8mgglon+UddFxEm2MpV10TYoh8F9EyL8y+sH0AeP29boKhgZ4/nabSQp91Hgb/Dk3xYm3ZoX4GhgO4ZrcUAF+KO44nZsD35M8ZYNMFMoAd7juj0ifH0+0FgFExDrpcB9sorzRHvLPM8oPuB5SIdEnnV3KxjoohcTQmOcMwl1vp6IDX42NZP0pj/BOhqYzFo23V9YqbxWQsh3d1WsC9QszXwkh1jeJoR8QKKZ57tIxXNaYi9Hbdz7z3MAFW1XHXbj8n7xv8M+UVQi3+VvxUFS4O9gabZkUyXDIRjsL44Wtvl4+TLYYZVIshNMS5jjKHr/uGsokBs7PSxaZ3atXzlQNWfKgsQWvlGrIdyTAZKRo6NDhYB5c/DECcvMuJ9llFsY9NXuj/yUlGqupJFXlAtfG6u5dLG8YUGgkD4roMoxEScW6a7ogobYA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 277d6e31-36e9-4663-2824-08dca5a2b5e9 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:23.6152 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z8NPXd+xaie70fMGP10XU/CpnjFfSnHLazus+SIx4W+CXAIo9nS61SRRLw2pkJtbvefJ5/LxmxCHPSRGLo0RlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This updates bt_bap_verify_bis to receive the already merged L2 and L3 capabilities, instead of computing it internally. --- profiles/audio/bap.c | 11 ++++++++--- src/shared/bap.c | 15 ++++----------- src/shared/bap.h | 6 ++---- unit/test-bap.c | 7 ++++--- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index afa938091..2f37d33eb 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1191,12 +1191,17 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, l3_caps->iov_len, NULL, print_ltv, func); + merged_caps = bt_bap_merge_caps(l2_caps, l3_caps); + if (!merged_caps) { + free(path); + continue; + } + /* Check if this BIS matches any local PAC */ bt_bap_verify_bis(bap_data->bap, bis_index, &codec, - l2_caps, l3_caps, &matched_lpac, - &merged_caps); + merged_caps, &matched_lpac); - if (matched_lpac == NULL || merged_caps == NULL) { + if (matched_lpac == NULL) { free(path); continue; } diff --git a/src/shared/bap.c b/src/shared/bap.c index 1259ee3c9..3381ffdd4 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6639,29 +6639,22 @@ struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps) void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_codec *codec, - struct iovec *l2_caps, - struct iovec *l3_caps, - struct bt_bap_pac **lpac, - struct iovec **caps) + struct iovec *caps, + struct bt_bap_pac **lpac) { - struct iovec *merged_caps; struct bt_ltv_match match_data; - merged_caps = bt_bap_merge_caps(l2_caps, l3_caps); - if (!merged_caps) + if (!caps) return; /* Check each BIS Codec Specific Configuration LTVs against our Codec * Specific Capabilities and if the BIS matches create a PAC with it */ - match_data = bap_check_bis(bap->ldb, merged_caps); + match_data = bap_check_bis(bap->ldb, caps); if (match_data.found == true) { - *caps = merged_caps; *lpac = match_data.data; DBG(bap, "Matching BIS %i", bis_index); } else { - util_iov_free(merged_caps, 1); - *caps = NULL; *lpac = NULL; } diff --git a/src/shared/bap.h b/src/shared/bap.h index e63161dca..3e68f00e2 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -255,8 +255,6 @@ struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps); void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_codec *codec, - struct iovec *l2_caps, - struct iovec *l3_caps, - struct bt_bap_pac **lpac, - struct iovec **caps); + struct iovec *caps, + struct bt_bap_pac **lpac); diff --git a/unit/test-bap.c b/unit/test-bap.c index 9dd7a45e8..4b47d6363 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -587,12 +587,13 @@ static void bsnk_pac_added(struct bt_bap_pac *pac, void *user_data) codec.id = LC3_ID; for (uint8_t i = 0; i < data->cfg->streams; i++) { - bt_bap_verify_bis(data->bap, bis_idx++, &codec, - &data->cfg->cc, NULL, &lpac, &cc); + cc = bt_bap_merge_caps(&data->cfg->cc, NULL); + g_assert(cc); + + bt_bap_verify_bis(data->bap, bis_idx++, &codec, cc, &lpac); g_assert(lpac); g_assert(pac == lpac); - g_assert(cc); stream = bt_bap_stream_new(data->bap, pac, NULL, &data->cfg->qos, cc); From patchwork Tue Jul 16 14:22:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 813248 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013022.outbound.protection.outlook.com [52.101.67.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C35119CCE5 for ; Tue, 16 Jul 2024 14:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.22 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139751; cv=fail; b=Tyd964JV5mtIWD/Pot4OHx52/APhDi8l7uJlrpzVXlynO++sdsTS/BkjZnN4IbSlY28yBcYkTLxT2oB1cFu/hwgacN7iQe7tKWncIl/TuPoi7p5RrEENMdDEbTNdDnaHrItK384ED40alIqxURAZiP1Rz8ZTdzLvsfsGGVjsGkI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139751; c=relaxed/simple; bh=4xBj9lxpm8GOXQeRw9dng/g6lY6GngQ1wuLU8l4U/Hw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EXsijr3Pzk8+TYSBxXv7/hR3VkAF1lBVEDX8f0+FEvpIRa2JYO7AGQgSnxjU3mocEdX78CQ2o7is9PSVsDfsoOyupTx2yuk3a5w31wVKzNYw65vYB249FmhXuS1F0+rkYES0N+FMc9PLnrnW/jHCmGvTcPe3SMm9DRUYUVzjDw8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=eGRaL9mj; arc=fail smtp.client-ip=52.101.67.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="eGRaL9mj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zyn8fXb90jE1HgZ10tuIlIbvleP4qao44osMcSdmb2yXRu2oUyMwmdZL98cOWLp4nCH01DGpJ6+yRW670UPghcIf0/h860NzfuL7iFofp7R5LpJwvbB1oaTRJLD7rKn2beilzIVB+2ZqQjEiAME2pKYrg2UlvcwIcXWxcoPneR1R/1jJ59dC8a0zthyKv3FWxuQrSyV2DiB0L6U4wHEzedi93ki+GYlwdYaqI3UEIH0yBBWg/BU6npYvSICLwyXzk4YvYKINKrTjGe/LRzsGGe3IbfNAXKlK9/3Z+1D9pPOjQLfGHTsVz/1uiKpEPMZqvEn/mCIJove7ypAUa34mpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fcVQkXbrYgajAMXYT97/wkR7PSB2qrWY+f7I7MFZzb0=; b=MtxFz8vyoO59YcoiFYIEGOrNcwfolXkckgZK8Aoqjqmv8wg8L9PyIOguL9Ak4R9ZTs8Ge9ZPYMvelisCh02lZ4BlVypeRjZiEju51SH3rnH33/DQdK38W+fLARTIdDSu06iuqeNzZHc/z2L1yETQVxvSwFe3Vq53cYF8ZD1k2OPDxMMg3XaINq+w6BAxVIXWnzPLUof+Ectmg58sIMnii4zRFdYxf8TdaC46cV19Gkph7TQcdazPs5DFBwdhX69J+DzvMrlsHd8dhyEHh/LiYL4ZoFjIQweffCV/xkvHrHcp4MN6n6/ECmObWcgLzgxYjLYCOcwPPG4w+94nW1RBpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fcVQkXbrYgajAMXYT97/wkR7PSB2qrWY+f7I7MFZzb0=; b=eGRaL9mjxILfv7v/jTBz90XXKvn6ttcPIzk8a2jYp3ZIzKU2zkawJX1SUxkYm/JK8orFsXZw15y53QgekXaDLsYVe6py3x0Q8MKc8wWkYNjyeOOxOrbWNEtIkvFUOPK/8TGhKglE3ItBiuQrSXYdrWJUsf8ulooTfkIqWtrHT68= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:26 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:26 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 03/10] shared/bap: Remove unused param from bt_bap_verify_bis Date: Tue, 16 Jul 2024 17:22:00 +0300 Message-Id: <20240716142207.4298-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR06CA0104.eurprd06.prod.outlook.com (2603:10a6:208:fa::45) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ce55081-b93c-4ba5-3ea5-08dca5a2b7b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: hOcligUbsg07spfgB3rD+Bd3NRNQsjoX6DNKD4qfsAnvinmKZNQe+nfs1JK2wqtj2RbfrAqDxgloA/bQ1PmzxKaPtwzJcI4dIFp5rlQ7cOSiT+AesdhGV0j7tsmZ0Oukq5Qt0E6ygVIIgm+vGZGNWdvFdymnW42r47wtNSMm4bw4vStKTt3SC/yOVnWZuvRiR1yC3YCu/IX25ZCQora59SQPj1fJKG7gMyGt6g4cE1OP0sABfxrGEV7nzFkyuuKOr3ymQSRqz61KbS+ikvU93C2+fExgt+0PIafhseMDYSqO3pmYhwbsN6UCWeVtoSEAKsmdwDf4n3Zu8mWlZtasW9j6HkDjs+0GbtzoGH9oewEteJSzEbA46WWqz/4UPhR4yedM7iDQ69VnHWIIm8XNpujK7MzKScUqV3EmHuJrrtE506cUBxS7B5hQpyY0zJWY310KkpdIwZqrRdWXVq7EVTEg+9ifM2lVG9IDsHtl8omhvshdR4f+xQQ8nQ3fP/vWrabcSqX+Z1nQ9jJH8bAweA3cKG9nHza9NfhweWBWwXbkYYB8PqXQ35zBN/fzwYqIKaEYD4PzoRpbx8aiZvos1oNcLaCMtFc+Gg15XUPkWjSTBlrzN6ek5QUz7DJc0rb9a2VUK7JIDDHICgQCj7qz90OA27a4jhyHL7oXHs3allO6KyQ+xdR6pfe1cz31VOaBQr67u75jXqisuPxQqJ6ZpklMlioQ9O1L4vetQ3KFFWrhh+GN7SCjihWT0BEHNq421SnxHOxja6RZY4yddbhPgY807EOglGBbQe4e5lMyHqK60EoBlDIkv1M6speBUTzUuS04aW/4fd6XjKb5bnMzQ+/YACsR5S7l2IRtysL9hHgWz5mfiGSqpPcSt9KcKJVB2u2aIgakEcaDa4mABL7jKL9ubyZBBDKpxRxU2odBGQ+6yfiOhr/k3Hb6EAgPXkBn22aee/i6DEYZqQ1i0g8ICytJ+nC+f2CA2kdOv3SfUKeWUILjvHL1Lr7nQ2+Ehpdq96Pq8K7HYBhjxuYzX2YhbCytSpGGH8V5OFhrqibO0wQON1WWAVBEyubGcVN21iR8ish3yWJ87YU0pikqaTepIGuerNHrm9ImSLZruNV40LC52lCoIdV+tMmwMqqmfyOgJS+UY6KRhfsXKcW3Qfz+J68kijuJUNlpmALtczat+STaj5Xfpd+eY9rr86HrILynNEbAC3zTNDXAwF+Jm2xwCs/LaRmmId25TSum0aUFop6C/8kRUPDqM/oXTnIgegqn2FCtLWag21AicmudiXACnsiayVDeaQELotdemI/GvICmPe5qtwRSH45p6/DicOIEkK7QlQFhWsCl73cxcdrhqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QjjujkUf3cSiM/7pQzwVFyKt1SBCBv5LNuEqll6V3uJr2KJCCtzvWi6gYiGiPNvzDOEVLI2GEoMEhuN7M8sIm4aeViY/huAmhBqNdYfPjFh7P8eEqICo78FFuCEuRI7JMuNjrm9zjYNBtLCLfpRIJxuVMPioAP9Ki7NSD2XbPdPi03SI+cUrnh/7juIxZglig0c4VVMtpY2URx8zL76rXQFRTav9qb9h18MY7UWvgl+7XbrviAxXtNYM1/pQYv39DJ3p8ckHYstXgNYyefFkqKJljDq7wDjBfUsIEM7DG1o07l2HgfbkfaSuPqoySTCP7LrJuU9S24tJRPOaVksQLNbPqv1bbuv6U164Y7AhQSkO2nR9YlKAMBAIM+BdxLMr5b8EV8mEBPE3KnYXvCKpNnoku87F1Dn/NQRFA3OiKnZdpW9dcLPutmEL0CLUKapQBDUnb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MmTCkoSatfwG0Ul5F2eH3Vb28TqJswZbxETvmVdh8IUe1qdjo4xQc+yBM+OgFGsTe9YI5VHGZCDQMYzSTnPK8CQeA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ce55081-b93c-4ba5-3ea5-08dca5a2b7b5 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:26.6238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +f60I0RleVQzTgvcbwBdeCUiXPEfIx2Oi68UJWlBjA/FPXRnhUbNBxosrWVU2XPWDqZ8zYQCAyO3LyphzCsvXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This removes the codec parameter from bt_bap_verify_bis, since it is not used. --- profiles/audio/bap.c | 2 +- src/shared/bap.c | 1 - src/shared/bap.h | 1 - unit/test-bap.c | 8 +------- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 2f37d33eb..6d8289418 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1198,7 +1198,7 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, } /* Check if this BIS matches any local PAC */ - bt_bap_verify_bis(bap_data->bap, bis_index, &codec, + bt_bap_verify_bis(bap_data->bap, bis_index, merged_caps, &matched_lpac); if (matched_lpac == NULL) { diff --git a/src/shared/bap.c b/src/shared/bap.c index 3381ffdd4..d2a500e48 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6638,7 +6638,6 @@ struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps) } void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, - struct bt_bap_codec *codec, struct iovec *caps, struct bt_bap_pac **lpac) { diff --git a/src/shared/bap.h b/src/shared/bap.h index 3e68f00e2..bf928bc2d 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -254,7 +254,6 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream); struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps); void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, - struct bt_bap_codec *codec, struct iovec *caps, struct bt_bap_pac **lpac); diff --git a/unit/test-bap.c b/unit/test-bap.c index 4b47d6363..9cfc8c403 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -575,22 +575,16 @@ static void bsnk_pac_added(struct bt_bap_pac *pac, void *user_data) struct test_data *data = user_data; struct bt_bap_pac *lpac; struct iovec *cc; - struct bt_bap_codec codec = {0}; struct bt_bap_stream *stream; uint8_t bis_idx = 1; bt_bap_pac_set_ops(pac, &bcast_pac_ops, NULL); - if (data->cfg->vs) - codec.id = 0xff; - else - codec.id = LC3_ID; - for (uint8_t i = 0; i < data->cfg->streams; i++) { cc = bt_bap_merge_caps(&data->cfg->cc, NULL); g_assert(cc); - bt_bap_verify_bis(data->bap, bis_idx++, &codec, cc, &lpac); + bt_bap_verify_bis(data->bap, bis_idx++, cc, &lpac); g_assert(lpac); g_assert(pac == lpac); From patchwork Tue Jul 16 14:22:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 812890 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013022.outbound.protection.outlook.com [52.101.67.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4692619D087 for ; Tue, 16 Jul 2024 14:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.22 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139753; cv=fail; b=M7NYRTnhTk5G4zIv+yFuHgSKHSZwy0eXcXWSnNmdaKZXy05EQyXBZ5yRnbx6hUgCBOvsZKDvvm4Jwru74qxLNzJ8MN0rg5Q2iLOOM+NaoqUJl7wq8TgfvQ5+2JKPQeTuUB8MiQr5uq1NhwgrJiXI04gfS1RQob1YB3Xb0mgPieQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139753; c=relaxed/simple; bh=6i2epZ8ZL+hAVJ3YxXQgNeKvSvBReBmB9X8m7TFVVTQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=dI1ksrLf6pdr5ztwjFakSPjTLJNRD41QsgXk6rnGhJ2eHGHZh0immOCBla3Ap+91rKTsvlyOp3/RaQGn/C/AoidAMlnIjKRCV7EoLdKP6cEpPgQkyGgpqAVqu+YKX8oI/kHM2Ssdi8FzhfiP7TiPnQIifEUA75s3K5xN+QIvDjE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=fkcC875w; arc=fail smtp.client-ip=52.101.67.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fkcC875w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=viPgMWRqNUbqX9wGI0kt93juZnIIWxpoNDe1MDDdaYB4xwoyDlfhPG8JMaT+Hy1w4kdM1Yin8HKuYCsQZHGOknj6xDQqeLLdmsyX5ZMVcagP8YZpGGWjane97MypacgEHWBtOAWKNugQJ0gzl+fbyVKcStEvOFMvo0jS/H61WgFFmSzINB1b6QnFrb5ptTC/VokKdPGOg9Ml6s/L2kN5GfFt63C7L8kT3c0V+yH0GLr481rjR0I1lm7LaAh3YLI2wweOF0CO1FoAhd90iwsD6LU2WsbXT0JoSu9smN9R8H4plet87QPpE2g57a92q53XKD52bo892xJp91QkXmQ4/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XBPMx2ponNVSF8LAL86XJ6DpTa+3L6KG4xaC7LiHfkw=; b=ahz01yoBD7k88kx2nLickR+cVuVpDja/oaIIRq3PRo8Yl4yAcy7Fie0AzLaDvHfTvTNCJ3s24k6XvOu6fsxE4OltZrBcc91T5mSn2dCAULtzNDTNFAoVrsv2REjftOy+ceObHkFZmNh/4OyzLm5GHuiWmOZYw3fbW9D1yvUgpLqCKGuetKin+KJ651RkFCXSIZUIfQENT5mBytjBtyQloYGW9Tn8k2321nr8N0zm9FixjNkuHJD1H0yQi9peRMdV5biRLDG5l4/t5F0mNrZTuZrGf6RY3DGwASlQdaziYZf0gN69jW+5nOXzIeeo7zsR7ZKV8vz93gxMcHvKqp0sIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XBPMx2ponNVSF8LAL86XJ6DpTa+3L6KG4xaC7LiHfkw=; b=fkcC875w+x2QXlaD7fjnhUeEeYar2qdhjKJU7DoiufzJmqc6gUG8XkVEqxEarclvOBYQdGV5bLnsAdhnTgy517JlQvOs4LtVhugDnyn+/kKP+70kEC7tucs2z0X5+IgkdQEnmdDVh41VyO9BL3o9/5zQyTiHe5eOuSMKAxFCTx4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:29 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:29 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 04/10] shared/bap: Allow checking bis caps against peer caps Date: Tue, 16 Jul 2024 17:22:01 +0300 Message-Id: <20240716142207.4298-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR04CA0049.eurprd04.prod.outlook.com (2603:10a6:208:1::26) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 70636728-a877-47b5-d597-08dca5a2b936 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: Fv9OwY+wf3Tj1/ytqof6g8CXTZh3O/+G9XNMP3zqt+cXxHrgWYBfR6FiyBYgJrvIxxeGzV95hGTT8Iqy6/kZCioghqOtAS4bhkjf4xuUMTmsQ+7MHXs2FJaXgpGoSMnxAlWwvOig0bMzBGFhJy6bpygNZBt//7+H+e+fFzEwBcv91l66JqHhdbhUrzy9MymRj2xW7ADPL2ieEQAEl6OJ17TUP35bbc5IIrf3D2Bc8UfFDYSkb16J6ue7Tsm87qATLBe/2Uc0qQ89w6ou9fMWvHCfRMBrwirBb6alJiGH99EH+qqXjt39T2fi2JZ0yYOEZ8ZNh4Sgikl9ISK3fIfCIF9eSqe7pcuzkimerLGMND1HiCVNL2WYy3ufphXK3gTN9bMgx7wAqb/iaitix/fjPe8q0M1MUU0cH3XdnO+AT+F5cxLEUpKcZjTG+DZsn2Y8V2XiD/FOYyhRB95u646fnxxnfLLBQF/Ygpn4b1iEUJvHLg5OG0P0j18w3PfFqSiP+hb0EiqLlpPyWriaJGZw0YPWe0tkO7Mgk5/WCrAGpXTNr+InPniTAPo2Fs1NTfJg+y5HCZZA3SApVN5jHi32qz9EeMfiOwvlGQaAwAjTeKfrp4hfBy4e6ocNRPVhP7NeMJCRxkXmmdjEg8paOR4RmZkujsSqxs6O6XKX2L9YU2Y+0fbiy7I9FPgS31IiImvzBPMIT3TpWsLHFC8A9jr8oondaoksUfuJP5JeQCBAo13bt68kPMxysi1kHhRmdSBuHEg2Cny/pFWHY8ukK78ax9NDCtEMq0lNj3BefOIg/ylUSXrInim7QKSBITtFFGq5WahA51L9CKnKfHKWg8jpe7ex84YrTXaLD0DZVwbPAIzj2VhsiigZtxMhiKK8aY6sitag4EJyRVDgd+7rokboVUw5xUualwEBWIZlRQNAaRqYlqqsdz5X3bnapj7xT+/0T82KpronHy8nzUtzrUhaTcWoivDWe4NgQSZgHE+MsIEHponBrgtt8Qxxh6NITAuIh9RmvQ4L9zCpUQJo2nBnibkHqiIJ4gCPBqDupKUT+ovB66bVqlDjlj57S2KeVbuoOx1c6GyD0w4WJkNVh+CBmbiEJn2C/q+id+LttHD/3h0/yUgSJS0GPTPPZyUme57M+ZRA2k4/X4pc4HtCLruIsrhOa6i+nqz2XZjuf3U7XZyWrgV9lWjAmskJqCSqbM/G0tZ4ZGuNTQ7oxDJIQ6ysBPT/HW3/YSX9N6ngmE3ZFbyGw6WkTGK9P5/QPcTWHf6V5Rw95OHAkV4sqnyPS3zYgCm3ebUFQGvQ85pia4WdkqBx/0xx1hx7YESs1a8fxg4iZzluvbHCTUpjmziW7hFBmg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RL1yGQaG3y3zuEab4QwycQS0NWnXemzqvC2uXQdS5asyqIgwCOWt8rxRZniNEsumehUENbDeJdQdfP6oK3GICIb97EuY9dg3Wu7TVHJSlF24EuowJ3a0niANxFZ3wj8cEo++RCIadnjUCC2y7LTrZyWtME8aoVqIP1q7u5Va+qCLbWPQsfN6b7MfrYgGlVCok3dy/xfEMSyCu1wbPflS768CFksQS0CcQr4cv4nAzvXBttgfk7NBmtMp1w1a7azwJMnWrUBRX6tUO/E5gpA4h3HqbF0Tn/LIj7cjFCA09HCR9bYbzpgfbDaCHYlXi1s5UWk+DuB9uiw2zCyy4lvUOvOdRzPxS9lkykRbXy8jjM+CplyySqWDKvPoPvaimWGnJ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EQiwRnIJ/olE/t371tZRuGNNDzS3vtD1mCq3iUfnj6Rka342w1enKyyulvxSFis/mEV1djvhYWq/q+PVfYwgAm5gZElF+I4gdr14xgm2ZZBNB9RGAI4ukp/L+tV5FdlSg3uI2iEKJRC2Y61Xew== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70636728-a877-47b5-d597-08dca5a2b936 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:29.1431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tk7STMhh4DCVMtV/NcjJBv1Ae3v1UZeVUNiHdxM9zeTAwns1V7N3GefKEfiCgJcZGh+7jq4Pf7aSYJKBTrmuxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 A BAP Broadcast Assistant needs to match stream capabilities with capabilities discovered in the Sink PAC characteristic on the peer. This updates bt_bap_verify_bis to check the provided stream capabilities against local or remote capabilities, depending on the bap structure provided: If the device is acting as a BAP Broadcast Sink and the bap session was created after scanning a Broadcast Source, the stream caps will be matched with the local broadcast sink PAC. If the device is acting as a Broadcast Assistant and the bap session is a client session with a BAP Scan Delegator, the stream caps will be matched with the PAC records populated in the rdb at service discovery. --- src/shared/bap.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index d2a500e48..44fb06169 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6577,7 +6577,7 @@ static void bap_sink_match_allocation(size_t i, uint8_t l, uint8_t t, data->found = false; } -static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb, +static struct bt_ltv_match bap_check_bis(uint32_t sink_loc, struct queue *pacs, struct iovec *bis_data) { struct bt_ltv_match compare_data = {}; @@ -6588,10 +6588,10 @@ static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb, */ compare_data.found = true; - if (ldb->pacs->sink_loc_value) { + if (sink_loc) { uint8_t type = BAP_CHANNEL_ALLOCATION_LTV_TYPE; - compare_data.data32 = ldb->pacs->sink_loc_value; + compare_data.data32 = sink_loc; util_ltv_foreach(bis_data->iov_base, bis_data->iov_len, &type, bap_sink_match_allocation, &compare_data); } @@ -6600,8 +6600,7 @@ static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb, if (compare_data.found) { compare_data.data = bis_data; compare_data.found = false; - queue_foreach(ldb->broadcast_sinks, check_local_pac, - &compare_data); + queue_foreach(pacs, check_local_pac, &compare_data); } return compare_data; @@ -6642,14 +6641,29 @@ void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_pac **lpac) { struct bt_ltv_match match_data; + uint32_t sink_loc; + struct queue *pacs; if (!caps) return; + /* If the bap session corresponds to a client connection with + * a BAP Server, bis caps should be checked against peer caps. + * If the bap session corresponds to a scanned broadcast source, + * bis caps should be checked against local broadcast sink caps. + */ + if (bap->client) { + sink_loc = bap->rdb->pacs->sink_loc_value; + pacs = bap->rdb->sinks; + } else { + sink_loc = bap->ldb->pacs->sink_loc_value; + pacs = bap->ldb->broadcast_sinks; + } + /* Check each BIS Codec Specific Configuration LTVs against our Codec * Specific Capabilities and if the BIS matches create a PAC with it */ - match_data = bap_check_bis(bap->ldb, caps); + match_data = bap_check_bis(sink_loc, pacs, caps); if (match_data.found == true) { *lpac = match_data.data; DBG(bap, "Matching BIS %i", bis_index); From patchwork Tue Jul 16 14:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 813247 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010035.outbound.protection.outlook.com [52.101.69.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 034FF19B59C for ; Tue, 16 Jul 2024 14:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139756; cv=fail; b=XHbixRyaUHUs4d+oEAdGdfKB6xGKtOEZvfpmAp695UrB7lxa7QprJzVewy6TOG29XTE24hdUnKr35uAEiI7B6WS23zvUlisZY0hWCCQChkMB7gwyrDEGI0GxiqceP4ot18qK/oWN2ZRFIQdtJ4/zTLJX3HujJMU1Zp+tPmFyHbA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139756; c=relaxed/simple; bh=onLgu641JE7ygo61FgI8VekD7t4a+DnjpKIFcCmh1oU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=KNTiqG/11lCjFm90pXpE/OhSDw0vFnEl8X7eJnRJsNGmvOnqVHX8Y+Oj8JVntTZbL5STXGgQwdJYI+Qb/dTw5S3jgFBQtUHfkscd4kyP+Nsk3sUwWklJNjT6z9msNTl1JPN0PWSMYqskhREL+JSaBJm2qu6BZPWO1VqzSshcpwM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=jCiDN0uK; arc=fail smtp.client-ip=52.101.69.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="jCiDN0uK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O+CraWrYXvDY1PgSGWVNXLQosDiXl1UBgBB/k58wK/HMAWsrqVy2xyHd7Q91jEUWfbnibDtBo101pws3fgnPpYwd9lZyhTRiURYfZ8ysRIUQG9M7OvztYL7lkC7ogdjbBfxPgsu2iajwPFMVyK4B3xVIuKD3/wDWg0J3N5bGgh3Z+lT1A0jEILSKtZ40hKLHPpkyq+GpOCm4zH4kuewGfwkAbqJJL7Tbarm4Gcu+31Zc+6bvhlkMQyxTtWZQWN5nueC6QBwso0bgdX2JnQ8WlQ3F1Cz6aeqEH6fWjk54Z9QXwHHedCZ1AQtxQeUD1eEo+kZuMZfH+pvXDMMXx9LdmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sFgyzhAb03BfIUEM6GMJrdQ+VNxyyremilFUrgwpB9w=; b=HmqGpXX7CuINGAUQ4oT4XwCKHAr4vrVDAcQKe1M5kZqugCK7zCaOGVQv4f5ze16nvzGF19Uiv8vLapqOxSFqBCGJF4vG88MLR5Y3rG9mfik7cbCAabo3p7qHkmnR4oT8zxqx7JSqkQln9mMw6LnKjwfQdX05tpUmgnpsTg2HDMYnjR38/8W7XjgD9oYzDhrGaNlJQHZGsMyeOT0iFeAQfVmGPkDY7K10PCUUrEo2MZwVUKyRW8Et4V2edIONo50VoUeNbgrMpRkRWh+L9EuL2Og6GVo9EtxmNZSZhI3EvUZsHYAVxERK+cjtZ4GXq8zt0CeQ29KImVSTxuyJXv9MEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sFgyzhAb03BfIUEM6GMJrdQ+VNxyyremilFUrgwpB9w=; b=jCiDN0uKMTyDHYgCMoO8K8kCWCUBhILfcRC+HUW6Ft0Z1W6r7r//HyPTuPoybceGqo8QZjkZwl3LL2uldtRwKXGSMhfX0ur+NEtHwF4Tdgs9zviC84CTLQBlWpCPWQB2a53JUuR0SdwqTh6WV1lS0QH7OzdTHGt34gKb0aL/oF0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:31 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:31 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 05/10] shared/bap: Append bcast sink pacs to Sink PAC char Date: Tue, 16 Jul 2024 17:22:02 +0300 Message-Id: <20240716142207.4298-6-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM9P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::11) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ea4958c-f222-4b91-a3b0-08dca5a2bad9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: ZT0G0oLIFUyaXAYIPZfbeYgCEhnlPhnthf79vu44k1PcahL2vKPe80zAy8aNA8NDzmIxQz5Kbi/QlXdQ4EwtBabN9bjKe4u/wYyMKRAuxOM3D705g3U48pZEHty1B1UkUTrwr4oriQYq2vzPKe+VHpAehhpzloqNFitpsK4d5nFbTiDu2NY+P5W6yVea5ZymP3pc53nFaHBesRWEC4qaLs6nPru0V5mGxdIoq6ZGacePsOJH16RAzrUOjBT0dLWkCEwh6JNjsOOoSTX99uOTt5zCjku5WXnTMSqpSQoJGxTP7lgVbnS+7CWQl8Hscsq7wotfZ5k7jBMndb1TxiXJRyF2TaNDZ0iTodhmnr0vh5f7CrLkNPfTWiZtLNAsu9cwklfUFJQMQUmPZpBRfh37XGyy5AMBcfWgneIqQ7K0OL2bCU+bnBmAh7RimSKSZY8kGRDkFbkWFlwq5pNRl0ULCUyFJ/wDWeGw7fb7at95/+HCxGkdrGraSENlZ4EfA/MXZoMA2/KEc5F8bazkdBlKfPXHTMzSkyE4lJfBPt3LVNnYQM9dQF09weSoVkiNVtGcBtvQNkeFI/0Roqv4uE3+IbwW2EBQ23ScDcdXWsOSSLXy8Du+ad/hTSopbQvmzgkEs9ksApzfqoXXW323UJPwJNxtcwVpM8CWoXoOreHLJctBZsuqoi/eE8NT4nc2Hqe3f2VVOfMHDUfLwtZ4l4dY9kIw00ElsRLjTXjuiWGk1pm/Z3QISoZtCTkfWpZEgXyO7V4d10wWBaYqKWdvjGrOgDAvkgImmnvz6VeGLUhowpkigO/Ja0PzOF78gfxv9uCksQReWeeAKkn6mToS0sdvrP07Onv8FY6LWQ91OmST3Viw7slmz1OoiQz4psXAYATzcdQ9Adj6I4tjhL1ie5PG72v13LhQZNZQ9m4KWMT+iUd70yQGY4q8UHGHKrRAVyojJbywGHo55yUq9XIVoN6QtzukH7bfbL17b80c9DD53+/Wr1AR2P8zDDxCXTFBk2BDAdtmHdjwWR2xQZlKGs8Wbj2Ka7W8sU0+NHuDJTPnh/TYRtVhI08MuNbslcPOMqx23iLxYfOqcz+EtqBB0eYNNaIYLW33/JRh2ErkQSt5TTERAbgfgEZtIw+WoKSq4ldqx1VBRFfJTqCmH+PQTFVDuvWe2ycyvJ3PgBnYUvq3Q0bS61Ltl64bMJi85VKESptyptbaqXoTuiJczg2QSZnPJEL6Yko5GNgv9d0SbKs80XAM/WqdJYHYux8U3x5ecsPI3nL272fwI/8jzlHkBhYlDimQUIgWmMQeQC60MbHopgeUB6N3/iW0IkMGLhdnulgM8e3BsWM5EAMwEwOaQgyxHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pSS1C+Pa67xEN7iRcq9PAEXUIZp2jhFT6wRNqrt1PHlIsNqrIoVTouEEHzniJA0e62uqDCJAA91B1jACRqdYJu1pvnxqht+vxzt4Bvef1uEfOXPkwfXzeqdpRQtKAoAemvA2QXYte+P4aT5nsF5jT8L4PEQzhr7hv1qhe/+XZg8qbTtC8GAfE0dcTGh/RxuBUc5bZH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+JUCgCHCsHxoYt9C8eOC2qUBN0P5Dw1dZsTbGYUWBEX540rTUk4VAuzNBmusouXwVZmOEv+y1A2/nwG6ZXT7yvKDrAmJjffb6eg8E07lN5awCukZeG6hvUlTo6WKvSDjAw9iq8uYr4axIyPQN/pVlMCvF+IL3ExKUkc/1Ljo+uYF6cCaCNzsFCYtic7P6A+Jqn5OXuGy7nz+O/VbgaMwunc1q+ElDfFH7JEwUJ2B7gPG8B7FgOLGD0VDDRMlSvUqSCF9LaJskRSFGWQUbWvXfdgXG0B+zbnpNqO/PnpvUQgNDFaAbw001lEbxAb+RmEBCsqkvT6XHdeWEvMucp4GSqhW/c0qqQ3j6g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ea4958c-f222-4b91-a3b0-08dca5a2bad9 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:31.8585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jApaQjXTYS0N5AJ/ZpRIwetqwuFYiKVua4YxnoYUGZkhhKl1w9RgzrhaLzX5exwuGF1penySkN0AzYC+N/zWog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 It is mandatory for a BAP Broadcast Sink to support the PACS Server role. The Sink PAC characteristic should contain PAC records that expose supported audio capabilities for receiving both unicast and broadcast streams. A BAP Broadcast Assistant acting as a GATT Client needs to discover the Sink PAC characteristic on the BAP Scan Delegator peer (BAP Broadcast Sink), in order to discover supported capabilities for receiving streams. This commit updates the callback for handling read requests for the Sink PAC characteristic, to also append Broadcast Sink pac structures to the read response. --- src/shared/bap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 44fb06169..0aa89c278 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -441,6 +441,7 @@ static void pacs_sink_read(struct gatt_db_attribute *attrib, iov.iov_len = 0; queue_foreach(bdb->sinks, pac_foreach, &iov); + queue_foreach(bdb->broadcast_sinks, pac_foreach, &iov); gatt_db_attribute_read_result(attrib, id, 0, iov.iov_base, iov.iov_len); From patchwork Tue Jul 16 14:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 812889 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010035.outbound.protection.outlook.com [52.101.69.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C90919B5AE for ; Tue, 16 Jul 2024 14:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139758; cv=fail; b=IhFF1oE5NjKd6JL20zU9JCvkb75Dl5isZrKmUJ8Y5JVoM8/wc5Qag5plNeRnUbDEzpktcQO5k0OfHByNhrNNfQumPjkWA2ROEfsZlFwneBkMlRvPtPKJzLGAWYPVTtgGGDQ0s5jS8+hrG4VI4BdyoRTmzc6ibNd9R3TPxqWFp0o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139758; c=relaxed/simple; bh=GUUF7av6dbKZyu8XBrUZDf7DkAqTDfnJrL5HRvVoB/A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fLAJx2OFE/EC2vwaB9NOkcY7mgLftxzoSEsdsNhAm0ZPao5CSB2FasBeB3iILf30T4p85dKn+kcW5pTmIJHdUp/RBb9B0w9vj8MD+nvIGtf5RbPTR6iceWhRHI+nPr5eHUhIHjufYpBipcK4MqoTqCKaLVyS6/8jk8vB/QqNKEA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=ewJ0inIJ; arc=fail smtp.client-ip=52.101.69.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ewJ0inIJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Efyq9Ra1p5JuS7QeunJuiOVmtKqA6eYdfEiiVbGfwfFFzBB6xjSwyLmTuPkXwegeatHkoRutxoPlSRh7BqT8ktsqv1vj+PL7tDICk2udExK32hNNkVZaMF2jyn5aOxsHjens44VQM/DcIZOO8rEN6lBEzfgHFLJMxJpEAsZ+dbmhb07V0j39dCSBP3bn09LDz7YwAunp7OkC05sFWh41kck5I9HCBsuuSqsG+1EddaOiUF1FwC4Qc/Py+MSGFSTZYupnxXX4Zu7SOfNYIjo2zveFjXasfmQ0icmt1gNHDzOqdltJnCtQOnOfVSdCAMc3MFvWYuaZoEmyB1ae3yZhrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RV2JczZSktyO6A2ZB0wvMJSXmHDOXH38xn/Gt4tuV4I=; b=QgVaijbH0/2GOwORwS/X+UmtJcr2T3p5IJ2dYXSPvLY3XkvznRdE5fyrEjdJVtsy+4bRiqMzAgSFs1v7JnXedYJcW+G1WfGU7bUUWX5+i6hbT3g3edASHUEJWd08KGTD3rBJ10NKRXQpNmJ3XT5bUVL3IDkOlQZtPUp7cH/rVDypEr2yduuxtv9TEYfld3XwT1F/GCiNEOl6KgYaBOjxSLbosXcPFia3xrLsLGlZzlWnLlYc2wZ1GXmlUCbmCTMIrorW6abdgPAVBTOOHgcVIQSAwB6ZZbNft172g3o0TfssgtXZpaDu8sz5n1/sXuw7MBiNRWhvDg3VjhAh5/j2SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RV2JczZSktyO6A2ZB0wvMJSXmHDOXH38xn/Gt4tuV4I=; b=ewJ0inIJMC1zkk3tHGCYFtGQGK6GqHXeT6Dxn//ke83kAe8pUGySk57XTM52ZnMUdBDTIpwx0gg+RCoJpU8epUr8ljaGW3Z8XK1O9XRKM5a9h4kVbSkCZvih9WYVQ6+uDTX63ETuO5+7MMf6v7KpgZtRlDPGmer4oCLzWHSrIZg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:34 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:34 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 06/10] bap: Add API to get bt_bap matching device Date: Tue, 16 Jul 2024 17:22:03 +0300 Message-Id: <20240716142207.4298-7-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P189CA0057.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:659::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: f2bfc509-e5f1-4602-44d8-08dca5a2bc62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: jLotAzywPfION83lhYETXgvmE7GMync4t3jjFkvAMR+KVtjkW36Mx85x0g7akaw5guNsEPLNLVJ6Mjo6LK6iQT85zxKwv8LRFsLzcQf0knMFqPST3ywCcZe+Tmk8MgWjLdmKKOCb3sUyJ5lyv9MFBrw18Iwfz1Im94uuaqZOcO18zx5LjsqkcP0/Ca7DZQNbAQn9BuxJjlc41r/XSdLF61gT7TrzXcnPN6360PaGj7QyiX+HSojuGyM7opAKs7v7JVNjEA8O/h/RGtphiy5LFthIDO7VDC76G8g6zHiJPfrzXBUIrX18bh5hIt8tZ/N+rVKwzgw12Uz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Y:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZTWheWnz0fsV3QQpXVuuLGz6fb5qFzlbCuDFkQZ5xFG6CgTam0csjiQDeXfFfdbFlu1m+e9bsWlSwFu/onPJdZYkEufkKBYfVPd3GUtAdjLKaCK5xeqE/cl2KvdrXqsBc5v/ZLNJ944BV/YLb4UV+e+j0PcpXywrr1g8ZhY15ptvfaKXPJ0/FZYHIVwUvvFX5/Pk7rNerZBgeEoKRxpMF3/k21i18y28BVEAj2z1f+hSCEeV01eK9oWmsEyUWbi78Y3Fme0fVLOMrcz7jXXFrsw8E2mDCmOLeR+pCYAyNAkI/WJXmneXVXFTScmOKIlb6C6wj6gmV69k+Z4ji7oNDSHWg7FJy9wp3/392XLbsEq56RiLNRK9J1j5v2Y6bX9vrUy0VychZlOYWr/TLVn4qvOl+ErZaVYxyoBXdg4e4R3pP0oTHuwYxxOiI59KbOmzW3sokeAAC/C5BiXP8C2ncvCqOoZ9ksVCrN7HtiOIGhHCr7NO/oLy5ONVdzeuNrLkXpxqfPaEPwAd1MsGUwa6nBMyk3uSkwAyk/fkhBBgaxPbWRGrpGUxYbULfq+R0o9mj2undKfa26+l7n2RUjLbLKi/KIMtZgEGWibqn1twfms5Gu4Z/nhc7gLYhOI4lhqxyHyU0MLeACQMjQjBLhe8Riz+88BPQ30dxj5LLrgiVrls3t6t234uxXeOSygNq357UJU/7/E2kxpoxM/RebZScruE1ADkn813uffvq1njMdZfjt9BMN9NTkqNFTBQO+fwLVGEwulZeWKY5DMIW2E6YRN6I5d5SPcjiYIaaUxtbFINiXHpFxkyT53rYg0/FRG0f4jV2TKkiUjga8nyAmrL+W+qlHiyhYViJM2WplrND62XBGJOa3hOlzPhQFZFCJjrECUZ+ZdY3Xlaxkl6qAgJP+EwLhlToLbE3a11A7Ag1MWpxW+LTbZXEgioeU/qTUI3KqfRiAOx+SRByW3eP1vDEOuS6ujQnxnN6t/XGqWGtcTfss2/B4ezBDgkP6ZaNFqWOJI7uYT8tIwETc+eVduhEgmXIuOAFzF2ctJs849L1aM6XA5h2fAbXwASOPeZTCQCywMtEuXzBiLXNGa7FzEZlgvJwGHK+orVgYbBsy8zS5E5E/VbQUx9Mh6Hv0VJr33Pkv6WW/cjG1zHe8Xjb6seaO0O0ix6s9S6N0DMx4FdBAOpWW/zHpT389Gd6H3ddJfpZanLxOFLtITg1aQyo9uh7qtRxl0pTDp8ARgTF9ssQ1MRacpfi8dumYpPnjzkmtS55tg5P/UZdjdgGuXOy9wJa0s5st1p4i2joKCYdVWLeASs5P16BYlT/4dfHWKm7jbchdELZA0CjZ0jP3GMMFJ5PoMAISqvQm+5thnz6u0jB+0dgPgd5PZXgwe+9Bpq3ubaKiTAB4jnZCLlerKiw5UrGKU5onwIOUsvhUrcu97sGtOY8BPog9JkmkVe38vSa1AgQ8ZWyMrXQeGwwlxzP9wQE99R7dQWgUGTzRs+xnG40rvTJhsXfigwBu0pKe6+d0IX6YZrloKxdNS4dRbkDfuD0eFhBSVVThIixagMseNVEcschd67ojp/lsFkrzFoV5wMnqhpUZakyOCr7ElIxUl/1A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2bfc509-e5f1-4602-44d8-08dca5a2bc62 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:34.4806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bkm3Cpj0C3QPLpZHEtj+l0nUwf2va7mHRA122kTXuGzBIqg3LEIYRZ+2RuYnH4D28s8ewyZjl1yeWmmyny7yJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This adds a public BAP API to obtain a reference to the bt_bap session with a peer device. --- Makefile.plugins | 2 +- profiles/audio/bap.c | 21 +++++++++++++++++++++ profiles/audio/bap.h | 10 ++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 profiles/audio/bap.h diff --git a/Makefile.plugins b/Makefile.plugins index 44fda4536..9dd8134b4 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -115,7 +115,7 @@ endif if BAP builtin_modules += bap -builtin_sources += profiles/audio/bap.c +builtin_sources += profiles/audio/bap.h profiles/audio/bap.c endif if BASS diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 6d8289418..fe5390e6a 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -56,6 +56,8 @@ #include "src/log.h" #include "src/error.h" +#include "bap.h" + #define ISO_SOCKET_UUID "6fbaf188-05e0-496a-9885-d6ddfdb4e03e" #define PACS_UUID_STR "00001850-0000-1000-8000-00805f9b34fb" #define BCAAS_UUID_STR "00001852-0000-1000-8000-00805f9b34fb" @@ -2751,6 +2753,25 @@ static void pac_removed_broadcast(struct bt_bap_pac *pac, void *user_data) ep_unregister(ep); } +static bool match_device(const void *data, const void *match_data) +{ + const struct bap_data *bdata = data; + const struct btd_device *device = match_data; + + return bdata->device == device; +} + +struct bt_bap *bap_get_session(struct btd_device *device) +{ + struct bap_data *data; + + data = queue_find(sessions, match_device, device); + if (!data) + return NULL; + + return data->bap; +} + static struct bap_data *bap_data_new(struct btd_device *device) { struct bap_data *data; diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h new file mode 100644 index 000000000..66f8db887 --- /dev/null +++ b/profiles/audio/bap.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright 2024 NXP + * + */ + +struct bt_bap *bap_get_session(struct btd_device *device); From patchwork Tue Jul 16 14:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 813246 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010035.outbound.protection.outlook.com [52.101.69.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21BE319CCE4 for ; Tue, 16 Jul 2024 14:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139761; cv=fail; b=KOGtnjRMXZTF0EqHHMn5d0AXvAnTtxxglNpc5qQwKCX47uZqoY0c5D0nTCDMIoe28XoRo7LMD5VzIy96K0uQSGItqFw05G3ZKd3EA6UHZAxziJV4RJ+CCABIUPlIL6S1amnvmucW3L4WMIJEN3Cw8XRWvu2U0pd6b+/93as6VyU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139761; c=relaxed/simple; bh=nQEWzxtRwgqCugh2NLKyYYz2Yd6l7JfB5kEl9aqvIfI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YMqRrGaQCejumn2vWVS75xXzCi2Ht/6+bzVSlYiq2LZ6wYJ6wvIYHG5+jVjRyEZS4opAB/q6/AIvV20FYTNxxCskg16aT3ll0yg7x6f+0m4nfy/vSuKTNdXL/JkFGH3Go0rr9D/QrIrksECYko/sF1F6mpZJZ7uFsSgEAQ4WsIc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=fkDPvnk8; arc=fail smtp.client-ip=52.101.69.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fkDPvnk8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b1wp15dz/jCLKNwu/nPQ6D97SK8a3Za+ScdZfskOkzywMKp///VjHm4CTS87vmh3cpaehnLWZLMy218ltDOayLoGecOB2YLoGH81Y9qLAXSBlPsYYAiI1wdr77n7S3VPg8/oXw0giTxAaOIe3tHfYAkpxbBNOzcogzmkY4LVsUYEOD/88kG8aBv4ZnRZH7qv68T/rNx5CHIqIRXn4x4MMUQ/eJRaD/JkUO35zZEtzbIU8lAK8CQ9HZ8DFWWqj2ebjQS9dYwgEN8zqszvGlQ9IYEHBfF9JGVB7oQsrjxA8RH3e6yE3sdRIFbbS3St5u+yhCj7GZndQ08cK1BIPxaScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1iW7okl0Vhw5cpPMCyNpN7kcen5M/3cvalRuK6PkM4Y=; b=H+jsT+HAz0vIkPc2EtFfM4hh1Fylg0Yg4cEvPhkuTqYO/wVY0MvNWO2mv5x6i7d6XFeMZUIm0ZX+qJVqyfD+nFlELTO+hRm789qMmVsWwxl5PmCKxdTB2vEVDswsIJPgPa0wq3Zp9m+6+PfEN46DJcXoNlCf+OjHcmtHPHc+4oOecGwWCN+8XyX6aZubb2jEiYrb7/JqV8kHgwhn6cERONCubqaw/GJ+qVMIscKNy0InFAA/e/qX0+W6B6DqtkkPiJhZsOhTFr2/5268AIxx53NJ+BLam39vXsHDn0mF+sF0HwvYR1qXbXa3cVPMWs8FWRG+QDVla2wqHhWLEtIQ0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1iW7okl0Vhw5cpPMCyNpN7kcen5M/3cvalRuK6PkM4Y=; b=fkDPvnk8rvMaoTx2bnFHNnyD28y+eUe6NVKbXWqOIWLQCgrdVUKoo2gxS0Fvg+aGg6kDS2Lq+xgK9+qFWpyPhW8HmXkN9IMPq1Xba2kWd9n16fgvIjt5S3d1Xrcm6b44TGjgcvSSYqD5R9BniwFr4mBZCxroPNma1AgxsMl8tyk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:37 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:37 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 07/10] shared/bass: Add API to get GATT client reference Date: Tue, 16 Jul 2024 17:22:04 +0300 Message-Id: <20240716142207.4298-8-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR03CA0075.eurprd03.prod.outlook.com (2603:10a6:208:69::16) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 112a1193-70ee-486c-3e4b-08dca5a2be2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: /oS5jQwoyxTH/4Aw2FgQu+LPcpqop+iWttztfXfC7yZbD/LNmvyJZUFRYXmKdVv5EbCKK84ryq4Nd3Lp82nNWzdrOJQEGS14BYl4q/gYcK/Be6Fh7HMsedo/5Glssfosmm+AueK6tqt7cqr+MOQgSCEB9o/LB5o3dqlY61LvBBn5YG4BJ4gApaaRIhpMBIWz/An1YSj9VRda0DKUkjtd+nso9ThP4K6P3BS1vTQVF29cuTGjEQpeG7KxE5K+Y2tKW1mmxTbIF8MpBZeg/SywV0PmKUEdYo9L4xHIUS0v75O/QnEV8ma2NuYUb2DSdd0PmIPARste3hP8yhx4rPIJsQzD8tUqQSdtXGO6ODdTIdtgajhYb9pTWcDpQNMXMWt2qagCofiDkn2/jYoSsQopNFts1UFcItrWZfR88cI8vUdIWjpkRyIaqJxb+ag1VbZa/LvP5Z78MNWQLBHIIlfglRlkTd+SZPOqP197ZPdwyrlkioldY9zrEUqQY7/G2QFnmQlrxOP0uqOnexj0AMDwTrYEpXlDaJnhwzShJpw++7c3MU8pQwnp+HC3ZlycMafGcLqvNuwJHCUSC3+P0NwVA2l202gEjC2zsQf/mhYdxII13tUG6dqPSq9o7HWXpX00G6DAJePR7gwwHU55twNzO1EY+v3g9AfvjL8f6WlxkTGSlwLfJQ/QM+OK88fuzy8Sx7uHslGvrH+510jf5+Mi5fRzSYNDDYMykTHGJfNtVrnRAkRuKLmFcpArvoDRpXtFf61bXURox6FiR6ZzObUUervP/jwB2THG31MedzVjMRDpE/bTohe1H20gEAbwH/uOZtom2tBzsXIowig0PRAjOIwyumEA2IHAbqryKH5uCuRjIX7itlV7As67Rolt7IMOa1a4DMxTrvuvKKTHWmC8EiA1Zesrm0uBonir+5JJxz12BdguyX53xAux0JOJ9aY3XwJdw6G11VzhfmA4BuUr5Me/V0LkzSwyCfLFMyq3kgLk5MawxIrwc4hQAZhQlBfPLEzI9QnZ54KcIHY3P4ptd9LkX6HfGKQAHj+hGNBhjDyYY7KEA2usZ0rWgzz3VJpsR4ovxVAsjmw+gZd9FwrOy2JhP/lpZ4wWxX+irTWXs9U1uXm2tiHnApb9JxAAJM1r1/TiwV5bDmeHjO5JQPDG7+vOov1Y376Zasop8GN/oblB0SR7D4srIqNZlTLu4hxgq6gfV38gObyceVS1QuNT79520P7kmlDHPAnDO7cTTVI/D3A1p1Hm1FINn8DeK/XLL1djK0VOzaQU/PEtdPw9pF+mLtGWuJjUnOgtdETHqUNS3tFh84/QCpXrDEhhawWQSMzcqApHWBNyuviNoYMq0A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 63d6jxCmgp4d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8lLPUx28rVmUcsbW8mmv65hopxvJw7++bBZjTHldVgiA0IaUNQ2otlgsWlYLp99mmp8GWmwvjTlwwfDTH2dea2SMolT3QIWN1EMEszNxNGarieSPkP4Cy3mMkoVM3FqtY/Wi9LVEglb2BZHdJ4XR4XxYtyyrVumZWHvX+T8LAo5eX3SpQp7gPTX/mFCPIRqnWbzioNJ8XIgi8eUri8ZA5BPDYYG1+7SXfldEN053IEdDZc6qPmpqw/8CQR3xyA112+FmPEs8bHTGR9FzfZ/SbrqTC0SSAejADuTBx+bFd72N8kjv7FPTZp1VTgHYrlaWXjCs3gO5ANpR3wNP4yYf3rkXE2yBu3Gam7UrgFh+g92D823HCu3cjS7ZmbtnW+AAwpE68peedQGnnjuQwcrC6reKQXQCz4xdZPbx5qTuHIURjsY/YXmHpcLLwVZJG8ZGsxr/Z4540sWDT/H7aA5R0sD03mtApqs3sQuTI/vH7ngqO/FNt4Lu4uLHSOSlbnUePvId33OjylcqFQgUqFw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 112a1193-70ee-486c-3e4b-08dca5a2be2f X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:37.4776 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x5mw65LlTHryqeaYbXza+UhjG2us5qDeIHprpcEBEpk4gCumkZ7XQHTofJafkkgFMefcKy87pUH0Cx6wt2PaBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 Some use cases require the BASS plugin to differentiate between client and server BASS sessions - for example, the BAP Broadcast Assistant role only considers client BASS sessions. This adds a BASS API to obtain a reference to the bt_gatt_client structure attached to the bt_bass session. --- src/shared/bass.c | 8 ++++++++ src/shared/bass.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index d82c043ac..268e3bd86 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1683,6 +1683,14 @@ struct bt_att *bt_bass_get_att(struct bt_bass *bass) return bt_gatt_client_get_att(bass->client); } +struct bt_gatt_client *bt_bass_get_client(struct bt_bass *bass) +{ + if (!bass) + return NULL; + + return bass->client; +} + bool bt_bass_set_debug(struct bt_bass *bass, bt_bass_debug_func_t func, void *user_data, bt_bass_destroy_func_t destroy) { diff --git a/src/shared/bass.h b/src/shared/bass.h index c4b5b76ba..1674146bc 100644 --- a/src/shared/bass.h +++ b/src/shared/bass.h @@ -121,6 +121,7 @@ typedef void (*bt_bass_destroy_func_t)(void *user_data); typedef void (*bt_bass_debug_func_t)(const char *str, void *user_data); struct bt_att *bt_bass_get_att(struct bt_bass *bass); +struct bt_gatt_client *bt_bass_get_client(struct bt_bass *bass); unsigned int bt_bass_register(bt_bass_func_t attached, bt_bass_func_t detached, void *user_data); bool bt_bass_unregister(unsigned int id); From patchwork Tue Jul 16 14:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 812888 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011053.outbound.protection.outlook.com [52.101.70.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA75E19B5A0 for ; Tue, 16 Jul 2024 14:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139765; cv=fail; b=aEWckkK8eUIj4oMnjO/y6iGiE2jytpXLlY2nacJnVMBIuG/KTRr8doI0H+MqzYoVeq+S8zi/tx1uaijJakQRLPF74BQDjrCG19aLvRVPZR/+LZm41zrrF7/PIegu4mWovysm5/pQMc0nkW1qlakhYaCPyA8kHlYvBTNyKynfkvQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139765; c=relaxed/simple; bh=KmB6s0PMUX1VDKiTzq7Zqx6MgglffuCE/KedsxpxH7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=j7YMeCFNWxa60NPLw0xKPltT0Ca/kIaIjHcmMFtl5O0j+fQvWhsTBXDdGbeLsDies6CfOG8YtFf/Y3Tv8xzHO0lj0dqNA1evPidRSeGl7JEdxr4xXV8JfdnIYiVALkZA2s5Gr88BjPDR2wcxv8f40hKum51y46DUtiJj7blZef0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Jmd/D8ZU; arc=fail smtp.client-ip=52.101.70.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Jmd/D8ZU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JTFr+WOMsS6LJbo+eyrCb6F4VFbnR1S38IhahiFOQS/d9Ob06Bjjxj9mgnWX4zVOaHpZXqWDvtedfU0ioHefNpUXH44yVo4foLk2O36Q+SQUst/TUDehrbnghKMumMXQ3qOQjed9a+/cN4YFfnQz7pe2Ylzl+/hvs2dWtIk3QtHZ+MoKuCU1U/14hydAIdTMwlvmlh9ZC3W0g3fkuHfWGsYx6VsF2/5LNWNVbFP3OFoOoUCWemPKSiXaslaBdqByR2eZrpArDbVNuuqYJNhDTnYC7fTJEFicIZMA+RPn4F+6hM+txdKBgdtGgf9+2wWblDNYVyEGL3gWA0p14B3FOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WAhAgbUq4RYQ2ObacC9nDZUA6hE0rqcgrhTOdHxS7LI=; b=d3nnU95daN70n1S+FFA8QXVUFFkRsfjIpkuRZJtVfBWHWhKlfF4Lk5b/5R6f7yNWaxZ5DDKBTnYX/+k2YVUkO6+bsE8o8W5yQvHNO7acMJRtYkZAN0U6WHdHcoNUS9wE1ffAeeoqbeIfL6lnW/KuNOt5vdwm4HzKolHAWS/75CLmHcfyf3soBIuPJs58qGV29mxhJgf03nO2uiW7IHoQwZ5e1fs4TY33yRbyojWt67T3A4xEZLuTnPcigMXjwurqVZt5Avq39IqG06rceQgLA2en1eB77jMlVBV6mYtzAfmv37iI7AcRio5gZxpAp5x3PHL2HMWOf0cypCGqd0qL2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WAhAgbUq4RYQ2ObacC9nDZUA6hE0rqcgrhTOdHxS7LI=; b=Jmd/D8ZUeUA7IbM4IcZNDH+y88nJyqrBa6mvlF/2ThSKljitw8zJzBpiBjQ02Hr2y3ceW8T6uyT7ZDZwTFXndTjdO+PJ+ItKq3BVwQ0yfKsklR2gfuI/FB26HelQ2nNwbsVTxKVCKK1b3t19ko27Zj+3H9mAeX9GZ705YDpSfA8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:40 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:40 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 08/10] bass: Register MediaAssistant objects Date: Tue, 16 Jul 2024 17:22:05 +0300 Message-Id: <20240716142207.4298-9-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM9P193CA0008.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:21e::13) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ce33688-a5a9-4a70-6004-08dca5a2bfc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: dMs8QOi882Deu8wEnN4MPWSOPlrcvQs50Qy8EpYOr5u7sC+RgCwOrZ6pbnjwCQE0GrAY08TdmkH6jVblu9kOyTVP5+TnbR9iJ207SWOfezGBjTLjUwm5WprbVBpYROppBQuD602khEPHAwocGW5xHIDCc8+yn5z61e2j890qX0SPeElPfjECOaVetdISlJxGqVWcQWVBX4l2CHQ+Bq/G7sQ3Byc0jRW8pRccfPL3HUtlpe+gPHS2uX0F3TBAPfXYr+4rJYSyXFrEN00cTerjmg15n9M2akPRQinutk4HvQtS8bkMPZo4u4ESigx+5bbttUDqhGncHiajZacVWh5Q5NnhgheYLLiqfQO57Ck8nteXdxJOTYrVktVMoeSkbqBYrei/AxxesT5PGb+xVz2a6+HSDsacrCah6sqlk2hAoyaKDwGHylKrj2jfcrtTkKJUriRVh6Wh3ytUkmyo3QQQAEIEfRf74n64p7l20Df5oW1qy8+pj/mKZ+j16CbZcWEPnWtE1Fb8p46s0yZHyFd33H7P6FRqAmNkyGO2WwkqWkYTWU2dFGYvkej3qde3PDJppDqitj23UFzkD+Z8INDv0KWqG+/uwxIFsTFAyIUKPoJ+YsYqezewSvYeW2IXwHtCm2SgYyycRGzYvru4sIsT51Yr/zvyF0LJbQYJ8duo3MvkepOdcV2vavDdaCE2XMVFO7NlHXymGGXOqh0YodNOX9uT1PCPQ8PogCiqBDlQ+mTwbVf0nISliDrdPdPxk7v9q9aeMAEKDdSgd839FzEkFVtj42udjasSYuQbuZJXNdf6qQTtwq3jIjeRdlk8UjcWBOjPwbKk3bMvhQzzYPfXgpgn4wDNdKwfUeBfDUsva8mqk+rSYBVbiYlDidLJFjFKSjTPPF0inCGkXPO7NPGKlZ3E4k3aUkZCERH88V0z6e0r4UCPZmmhLIuDkqQPF5qG18/93onnhMitd0Afx+61Y0ikKIZnGh2AKqGt4NHGWvbag6zy2KfwOn2nysCz9N99kO02/oHB6E+B6YlFI7QIIdNxcyXBFcQ7v/o2kUlPps9wF6v6YGU/TuTcKa+twRs7k6Am3DiPriTXhZAoVkpEhqo6IPCo2CvmiLimxxfxQlKYpY4uomY94dn9yAAzxH2rlgCZi/sOz9+a9r7v/okBEsGw5X/zvPSVcYL2J/mQHp94umbCklOhvjNVTuiZEu725KtGCnB98gPHMHRE9jvlngbg8tVKhMUUdasIvyu0GG0Jy0zXbJ1oFojIs06FPFQYzmUtPksOPyrUBanxdwDG9Ey5HT50fdAC57Gohmzea3zciNnEDWCRX7TrlPCbLpx3a5SK2g9GrranYv9am5TLEw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ed1raFwN1MwB8E/NQRpwaSN4cw6B/18xJSl3lBq3b0B7MdKJqRsbHjmMhZAwzSrag6twKtl5pe/s6moRQr7I/NDJe8fVdtILP8IqfrbW+YFNj5vcTDTMFPCGc/7Pe+xmiUr/7AdLM4QNQ5Cx21voM0XDv6KI33+JgRHtt0akk0wAMTaN1c47gW3053uu/yBzMjiFJlCoURrxyz7tYdku8pNnjw/7wbP8VtEZqv+L9SEqQghu9lCHXy1llrc9UY/NonZyQSdAD2V7oO5NY2ZWpML/CVxCoHFr1b+mbFpW6KDVeJ6JWjqTERD3u5gc7LVbV8zmbw+AWW87sZLI5dElvUApPGbmk72hjFrHwuK75Sc4/VTs4zhBPaegZdCZjbC2yunspo3svQUASitJ0VpDOKFNCxepVddj6SE5jjR9drYdMgsJ6En2lYd/sA1kCjsX1AN77gk/81wyhwCdG6fSdt1HDdcfpMau6nfgQvz1lKQEpaomYj1zxWh0Hhqg4FuA0psKexf7h2RJs70W1P6W3AYosZHxbVHiqUrPzPWA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OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ce33688-a5a9-4a70-6004-08dca5a2bfc2 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:40.1496 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fLD5X7FvCDdhQ7drd6ZoQxBeGDo1BK8r6WECAdKUdiAeDvBDaV2DDiI7G8Z8cRXZqXYS/g6rRjPQ6IlaOBE76w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This adds an initial implementation of the BAP Broadcast Assistant role in the BASS plugin, by introducing the MediaAssistant DBus object. The BAP plugin implements the callback to probe Broadcast Sources and parse the BASE. This commit adds 2 BASS APIs, that will be called by the BAP plugin to notify BISes discovered in the BASE of a broadcaster to BASS, or to inform the BASS plugin that a broadcaster has been removed. For each BASS client session, the BASS plugin checks BIS caps against the peer caps, and registers a MediaAssistant object for each match. --- Makefile.plugins | 2 +- profiles/audio/bass.c | 257 ++++++++++++++++++++++++++++++++++++++++++ profiles/audio/bass.h | 13 +++ 3 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 profiles/audio/bass.h diff --git a/Makefile.plugins b/Makefile.plugins index 9dd8134b4..9da29a3ce 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -120,7 +120,7 @@ endif if BASS builtin_modules += bass -builtin_sources += profiles/audio/bass.c +builtin_sources += profiles/audio/bass.h profiles/audio/bass.c endif if MCP diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index 7952105c5..083988358 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -39,6 +39,7 @@ #include "src/shared/gatt-server.h" #include "src/adapter.h" #include "src/shared/bass.h" +#include "src/shared/bap.h" #include "src/plugin.h" #include "src/gatt-database.h" @@ -48,21 +49,265 @@ #include "src/log.h" #include "src/error.h" +#include "bass.h" +#include "bap.h" + #define BASS_UUID_STR "0000184f-0000-1000-8000-00805f9b34fb" +#define MEDIA_ASSISTANT_INTERFACE "org.bluez.MediaAssistant1" + +enum assistant_state { + ASSISTANT_STATE_IDLE, /* Assistant object was created for + * the stream + */ + ASSISTANT_STATE_PENDING, /* Assistant object was pushed */ + ASSISTANT_STATE_REQUESTING, /* Remote device requires + * Broadcast_Code + */ + ASSISTANT_STATE_ACTIVE, /* Remote device started receiving + * stream + */ +}; + struct bass_data { struct btd_device *device; struct btd_service *service; struct bt_bass *bass; }; +struct bass_assistant { + struct btd_device *device; /* Broadcast source device */ + struct bass_data *data; /* BASS session with peer device */ + uint8_t sgrp; + uint8_t bis; + struct bt_iso_qos qos; + struct iovec *meta; + struct iovec *caps; + enum assistant_state state; + char *path; +}; + static struct queue *sessions; +static struct queue *assistants; static void bass_debug(const char *str, void *user_data) { DBG_IDX(0xffff, "%s", str); } +static DBusMessage *push(DBusConnection *conn, DBusMessage *msg, + void *user_data) +{ + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); +} + +static const GDBusMethodTable assistant_methods[] = { + {GDBUS_EXPERIMENTAL_ASYNC_METHOD("Push", + GDBUS_ARGS({ "Props", "a{sv}" }), + NULL, push)}, + {}, +}; + +static const char *state2str(enum assistant_state state) +{ + switch (state) { + case ASSISTANT_STATE_IDLE: + return "idle"; + case ASSISTANT_STATE_PENDING: + return "pending"; + case ASSISTANT_STATE_REQUESTING: + return "requesting"; + case ASSISTANT_STATE_ACTIVE: + return "active"; + } + + return NULL; +} + +static gboolean get_state(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bass_assistant *assistant = data; + const char *state = state2str(assistant->state); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &state); + + return TRUE; +} + +static gboolean get_metadata(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bass_assistant *assistant = data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array); + + if (assistant->meta) + dbus_message_iter_append_fixed_array(&array, DBUS_TYPE_BYTE, + &assistant->meta->iov_base, + assistant->meta->iov_len); + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + +static gboolean get_qos(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bass_assistant *assistant = data; + DBusMessageIter dict; + uint8_t *bcode = assistant->qos.bcast.bcode; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &dict); + + dict_append_entry(&dict, "Encryption", DBUS_TYPE_BYTE, + &assistant->qos.bcast.encryption); + dict_append_array(&dict, "BCode", DBUS_TYPE_BYTE, + &bcode, BT_BASS_BCAST_CODE_SIZE); + + dbus_message_iter_close_container(iter, &dict); + + return TRUE; +} + +static const GDBusPropertyTable assistant_properties[] = { + { "State", "s", get_state }, + { "Metadata", "ay", get_metadata, NULL, NULL, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "QoS", "a{sv}", get_qos, NULL, NULL, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { } +}; + +static void assistant_free(void *data) +{ + struct bass_assistant *assistant = data; + + g_free(assistant->path); + util_iov_free(assistant->meta, 1); + util_iov_free(assistant->caps, 1); + + free(assistant); +} + +static struct bass_assistant *assistant_new(struct btd_adapter *adapter, + struct btd_device *device, struct bass_data *data, + uint8_t sgrp, uint8_t bis, struct bt_iso_qos *qos, + struct iovec *meta, struct iovec *caps) +{ + struct bass_assistant *assistant; + char src_addr[18]; + char dev_addr[18]; + + assistant = new0(struct bass_assistant, 1); + if (!assistant) + return NULL; + + DBG("assistant %p", assistant); + + assistant->device = device; + assistant->data = data; + assistant->sgrp = sgrp; + assistant->bis = bis; + assistant->qos = *qos; + assistant->meta = util_iov_dup(meta, 1); + assistant->caps = util_iov_dup(caps, 1); + + ba2str(device_get_address(device), src_addr); + ba2str(device_get_address(data->device), dev_addr); + + assistant->path = g_strdup_printf("%s/src_%s/dev_%s/bis%d", + adapter_get_path(adapter), src_addr, dev_addr, bis); + + g_strdelimit(assistant->path, ":", '_'); + + if (!assistants) + assistants = queue_new(); + + queue_push_tail(assistants, assistant); + + return assistant; +} + +void bass_add_stream(struct btd_device *device, struct iovec *meta, + struct iovec *caps, struct bt_iso_qos *qos, + uint8_t sgrp, uint8_t bis) +{ + const struct queue_entry *entry; + struct bt_bap *bap; + struct bt_bap_pac *pac; + struct bass_assistant *assistant; + char addr[18]; + + for (entry = queue_get_entries(sessions); entry; entry = entry->next) { + struct bass_data *data = entry->data; + struct btd_adapter *adapter = device_get_adapter(data->device); + + if (!bt_bass_get_client(data->bass)) + /* Only client sessions must be handled */ + continue; + + bap = bap_get_session(data->device); + if (!bap) + continue; + + /* Check stream capabilities against peer caps. */ + bt_bap_verify_bis(bap, bis, caps, &pac); + + if (!pac) + /* Capabilities did not match. */ + continue; + + ba2str(device_get_address(device), addr); + + DBG("%s data %p BIS %d", addr, data, bis); + + assistant = assistant_new(adapter, device, data, sgrp, + bis, qos, meta, caps); + + if (g_dbus_register_interface(btd_get_dbus_connection(), + assistant->path, + MEDIA_ASSISTANT_INTERFACE, + assistant_methods, NULL, + assistant_properties, + assistant, + assistant_free) == FALSE) + DBG("Could not register path %s", assistant->path); + } +} + +static bool assistant_match_device(const void *data, const void *match_data) +{ + const struct bass_assistant *assistant = data; + const struct btd_device *device = match_data; + + return (assistant->device == device); +} + +static void unregister_assistant(void *data) +{ + struct bass_assistant *assistant = data; + + DBG("%p", assistant); + + g_dbus_unregister_interface(btd_get_dbus_connection(), + assistant->path, MEDIA_ASSISTANT_INTERFACE); +} + +void bass_remove_stream(struct btd_device *device) +{ + queue_remove_all(assistants, assistant_match_device, + device, unregister_assistant); +} + static struct bass_data *bass_data_new(struct btd_device *device) { struct bass_data *data; @@ -101,6 +346,14 @@ static bool match_data(const void *data, const void *match_data) return bdata->bass == bass; } +static bool assistant_match_data(const void *data, const void *match_data) +{ + const struct bass_assistant *assistant = data; + const struct bass_data *bdata = match_data; + + return (assistant->data == bdata); +} + static void bass_data_free(struct bass_data *data) { if (data->service) { @@ -109,6 +362,10 @@ static void bass_data_free(struct bass_data *data) } bt_bass_unref(data->bass); + + queue_remove_all(assistants, assistant_match_data, + data, unregister_assistant); + free(data); } diff --git a/profiles/audio/bass.h b/profiles/audio/bass.h new file mode 100644 index 000000000..5bef92946 --- /dev/null +++ b/profiles/audio/bass.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright 2024 NXP + * + */ + +void bass_add_stream(struct btd_device *device, struct iovec *meta, + struct iovec *caps, struct bt_iso_qos *qos, + uint8_t sgrp, uint8_t bis); +void bass_remove_stream(struct btd_device *device); From patchwork Tue Jul 16 14:22:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 813245 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011053.outbound.protection.outlook.com [52.101.70.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7345B19D066 for ; Tue, 16 Jul 2024 14:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139767; cv=fail; b=t7Yed10xNooq2oYmY8+gJB6bbkhBfB6aMF8baBa1u8zeAY/mD/2bf235DC1x53yeUaenPbGD1ywZ0gUhERTWEhy4nPUTulXqrBMPDxHJOa45ActMn3tUAVYNOQJGPKhE4rTOnkcDScfAWEEVnVY1GSytqVoxir4FaYH3DP/+HwY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139767; c=relaxed/simple; bh=ua6TblhuyBNkZjJRXDYS5Rgw3QcQoCZR93GLPanq/MY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aGQKxMlKFtQt3PpAw+0BIjnJfpBdAITWVRzt0UW5QPgRIboE2zRpNCCRlBDZcoQ3MHOSdWX209yjRzVnFZ6lsqX3NXQ9j1rxwrqft2WTJp1QMYia5O2zpHQ6HfDSkcBA1tMPjq6dVQPLUhK8k0zIIYrTlfpO8a0kpnTbT/SBBak= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=A7WAJY6P; arc=fail smtp.client-ip=52.101.70.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="A7WAJY6P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TsRBCEnqbbLf/Mnc0+pWBuhKxMV9KHlqrI+S+vSNqfYeTgrx0Nh1nrAOQGtNzLehMzVLNl2vvREIcoh4gK8MbQyFDWrFkvjAfTqLwXehr1uhj6ZdQ77/uHYh+y+EW1ABcER0VZmadc2nLXhuPlgg+tlKxvRLXxFKfhty0C41QI3cMKthr7/QDoirlexdYVJ/+xbjcqrHQ8yTpLtb5Lxwz9xvlLUdE4DBRWWGrt5k0hAcnqRsi59GLIm7HpbMX2Hh5rcKfpkBJ4o4VoQsoBm/pXemkdi1lVp5+HCiNnWTJ+99orJzKqRCJRQjY3QB9RA/3HF/JoNjxS+kwlQzJPPYUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9XRJsCas1pQ3rbGAdecb7i7y3ClDA6SyRhcxHysd11s=; b=MnFNqXax3NHO0Y6uGhPMlgFjfl7QtCsGTXm0rMEUGVRL8qQUw8LMXTkI+GaZxzn0L4AwThtktGIDKEZBdN8EM2KyluAjjt8+GThkMle+/utsOHdlsdy72owc9qhFCfLOhY61tvZ53E63uIrkHmKq3/XsDj5PqgtFrj1RclfCdSvgxuUfF9KeRF2gvt3FBv0Mq9mF1z2YIVFdomtRdQQIgia2SEbItnijeCCHi16TRVtzRVHd5+qbIftbvemxw8uy224dFKMNkq7EXsi1EV0WKNZ3wvH36ow5rwZy0knRC8eukWMCjBXSAD1utUbk7OEZ0jGDvLRUDK8XhYzvmo05NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9XRJsCas1pQ3rbGAdecb7i7y3ClDA6SyRhcxHysd11s=; b=A7WAJY6PXHy9nSHlZAZ4tKUw9vGVV9XhBX2SYXHZojx6bSy72MnX/C9giowxbRQ0s7f30zGyNHOaAxBGqX2bJhYcv/GI7tJzJQ1VQqTvXCqgu2GyLKvQ4cMAmEo2wmrKhPxbzvr0fmlhoA+/bg6rBx/Nh/znEjkwAgqKISL/Dkk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:43 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:43 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 09/10] bap: Notify scanned BISes to BASS Date: Tue, 16 Jul 2024 17:22:06 +0300 Message-Id: <20240716142207.4298-10-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR03CA0075.eurprd03.prod.outlook.com (2603:10a6:208:69::16) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aec88e0-f893-4f3b-85c2-08dca5a2c16c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange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c/Pl86i2hUVcMZWZbnXtawfCudNH/pxd9i2OU2sSthBAGc4jsetBwPfSNMtqFrsxukHax6pyMsDpxMzn9sFM18esA0KTTJrtArTAPVvBOn5UVcMboK2kow7yOVm91jt1Qng89p9IPIEQ6jaWiyZxzbGf3g+v0KYTIipU1fEs9QPVE6weqBkrxICOABWqN5iVsxWFQA4hn4/UdJiZg5u3nZBcX9xyPHuJStNyqmCe5YRNJ6RayZlkUl/byoPtf0VX8NlkJIEW7R3l2ZEksHkMggsCvScuvsiZChr5ysmF0/r7W7xt4wO20mSPwC1brWcMfPLmUxXsJBe7uNM4GR7lXI5JR+ILBgid+We7/wBnow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wKLygoVH5QChw0dqJ8vbIIzXem9hrlACokUo+HG0tMoRxiquUcJKRqBdit0qs3lg5uZ3JKpcv6z4zYax0zLn3G0u11wpFpX2AeYoDkhNY4ha19yeugfhJvnonr/PHKheSgsBGDnrnN+wRdIotiqoVRGuMCnYy0Z0SCPJnaI+MiHK95EwK3mE6rhFHdF3E3J0RODLD6Me5ZBzL0w0JsQyqyM6PLhq+S6caw6YpmASwuSUWYtcuAzOoauszZHFBprswTjNEUWq6mKZ0tiqZM0rcTKTFtkrkOsKJD3WTEl1/l1KgbeEbXZOqA7OjbwCqZeMNL1OLNTi0aNuJ4jolyc5UEd7pnMN/jislEQiStKipPTIUt+YFgQD+3qQRaoL6spflEmTCeLf57JJt61yKoePMNVt3Sjo2g0fuTxYBfM+uP7kzJB3QmLfcqTFs0kxvcEw+Ie7S6Wyo3TJgFmI4F901/dDdlKN2OFTTuazjTNYomOYjsBsgES1xRZUItb3BHZvJi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BNopwgFx9yO5+YR9Ym3Hnanw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1aec88e0-f893-4f3b-85c2-08dca5a2c16c X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:42.9967 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z4etfJ7V9rc60NiK3UpgWYo+QxHVCq5+U0ju+iWiLvayp4b9yHeVwKhcgzd2KkoEwZEwJJNSyOtCJv2OhoAn+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This updates the BAP implementation to also notify the BASS plugin about scanned broadcast streams, or when a scanned broadcaster is removed. This is needed for the BAP Broadcast Assistant role - the BASS plugin registers MediaAssistant objects for each detected stream that matches the audio capabilities of peer Scan Delegator devices. --- profiles/audio/bap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index fe5390e6a..50a68f27a 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -57,6 +57,7 @@ #include "src/error.h" #include "bap.h" +#include "bass.h" #define ISO_SOCKET_UUID "6fbaf188-05e0-496a-9885-d6ddfdb4e03e" #define PACS_UUID_STR "00001850-0000-1000-8000-00805f9b34fb" @@ -1199,6 +1200,9 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, continue; } + bass_add_stream(bap_data->device, meta, merged_caps, + qos, idx, bis_index); + /* Check if this BIS matches any local PAC */ bt_bap_verify_bis(bap_data->bap, bis_index, merged_caps, &matched_lpac); @@ -3227,6 +3231,8 @@ static void bap_bcast_remove(struct btd_service *service) free(req); bap_data_remove(data); + + bass_remove_stream(device); } static int bap_probe(struct btd_service *service) From patchwork Tue Jul 16 14:22:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 812887 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011053.outbound.protection.outlook.com [52.101.70.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A26519AA4D for ; Tue, 16 Jul 2024 14:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139769; cv=fail; b=IKqzbTOKxqOTmlyhEoFjQKvDhh2As1CKTgkEiaOmBUiDD7KZmmDgzlc3kYM36TMlsrv71rI7iHQ0Ce784YyCkgRRN92WsukyRHGWh8ryja+ua3MSvHJnlLe5hrHTFdtFnPASVypuZByC9Cf785484I82fxc6bt04YhKPbrioVQU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721139769; c=relaxed/simple; bh=fbSwkjuxSckBhgb+ghvm25tRRtGmKSTLwW1tQF4KA8w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EvYyqibN9ArI/MhU7z0NpQmAt3SEPkP0HOTDnm4bsLpT5rNQN0/cTYACV9MKR0WJOm7dEStyPz05/l/gxPXyq4KOMSd6uoGz0G6wiGPbFUEb6EaL0UxIVLw7GxP+0TrUDA5zHrt/ak0TwyZYIU0eD5+477V3xlpTFQohhLCy70c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=hJQcljFo; arc=fail smtp.client-ip=52.101.70.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hJQcljFo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QTJfGIw14H9WSEKHeuyEg32qb8PIsC94ppH2xTOAW4ZDzP7iTV7n4RZ5Iffyf0wkB4B8+hoWobRyQ/akYIuaXOaCViUrzQzZ0FR7ac7IUen+XiTcEo7YLb6Y9nQKMgx+0VRGkcjRHyX2q7GKZ59b6BKn0LV8XFx7Fy+lLF6IUJzolXVzPaQ79ILzcn5x8iA7A1Ys4mwR5YwPj/ucUcV4RtVawvYBTNEf1F6Hi60xva41siWiLCJieUjHqPegcU6LqFbOexGPM29n8tCyarC7/iOU2Ae48n8A4CjdzoiIud1m1zFUufo6F919nKyi1CBT8u1oTo7bhkLcRb6lP61rjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ou+7jPv1RdpPQobPgvQKt48iZEEpbZF1S2YT1Oj2jwM=; b=tcyLz7+U+VRa0vgxy9CSogEL+B973F/5PlyvCK54I24Na65ynPkiIW9Ggs43Ki9HHbBCx7M2RXC8CrXEsamlNt6ewj/Mk5KwlFgFi7xREoIf+BtVJOB0pcuL3bBHx67cB6XxeoiXu8ip91yAhQx9o6t9Mv7VCHrZkR5uWKGRWRHoN2n2isHhQZ9f2Kfspqa7l2GTCUQ+gRwLGQLqGiM4sgR+uNV1YLmwFxWMMuR8hdmNN8Bfe4vXn52lwuT+toEBT0RANScnBpnja2xW9LX0Em7LPU+t211Su+CELY6bK7UoUtrU7PDzgsY0AZF7Qr7d527Z/p2VMcNR05tCPqdxGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ou+7jPv1RdpPQobPgvQKt48iZEEpbZF1S2YT1Oj2jwM=; b=hJQcljFogLoHQUsIb8EGdx1S236re/d2+qqZ9FqsV7QElluMo87CyHNOHqSz5L9iLfQ0Dra7gOl/6tS6tIdJ1i4K8g8ZOmR8HkaXj97tDEp+O+GiozVQqTv7glOZ/C7JEztFTVFM76R0SpoEo8Lbt+XZH4YQUT94eN0WJNNZ7Zc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM7PR04MB6789.eurprd04.prod.outlook.com (2603:10a6:20b:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Tue, 16 Jul 2024 14:22:46 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 14:22:46 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 10/10] client: Add assistant submenu Date: Tue, 16 Jul 2024 17:22:07 +0300 Message-Id: <20240716142207.4298-11-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240716142207.4298-1-iulia.tanasescu@nxp.com> References: <20240716142207.4298-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR02CA0138.eurprd02.prod.outlook.com (2603:10a6:20b:28c::35) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM7PR04MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 822725aa-7262-4c66-c329-08dca5a2c33f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: DD5QiwnPvdBLlxndW6rrKBT3+qPHBxwT3+PdDLEFZk6TcbAmZ5l+cYMw8y+Yj+dNsHGsOThvhSyDBK7Ijh0F9cF3yTXSzaglR7SIVq9/cw4b86Rns/5U+fSCDOwo3exGN1R13kAUAc5WG7aTQ4uYKKSTsREzq54iExW2ts6hIVxxAKwwwnU5JRE5CVRqfWuZL2KKQNUS+jQWmrW3Lo6Fy5MTHv4wePDDYNv6mdtk4+H4Sv4JtRCR/HJBGmhdFWrScAQFG9LpukahhxLZCHu2odHeSsObPKf4AAd0QvUj+gxvMxjZ7Qcs1uMYQkAuN6x6TMYZFbIgvwx4NoDnrsgg4H9wpux1PCOFjrmTQZ4NGn8yB9SaBOxnaEj5NLmnA2T7r2M2vdKWK1FVDOV+r9P1v3RgXJcnPd3fQqXVBEcCoqC+5h46tw1rtr/Cg20tlAapM93fnUtx/p/TWx8MYWs0kJECw/kaycvM791Udhmjj+6y/24BGrUAiU8Dkm7ksuDBLqDmBUk9ApocuRnTq6pNpEQateNKX8/r/wXtixtpmBYw4On9mKKnVCPp90vPTLO6wN6vKrNHzdjLQZ2FcFXrObDWOwbeXqJPtDU6cN7I1EeJM2a1wDG+2S16Id3oGaS+QHA5KtM9pVIZh5MEcfMlxd9ntT9VO3WEup7ipBr9H3W7IDxKYlecuTH1pMLkDnTbsu0TqrxIlsY/A/EFQSQ+cha173HOJRVJuI5fWV1DIXJvtHYn2YrMGwDJVZoSObnQV9hoUZjhLCf4ZINr05EfNRM2SewtgMssWjAxbfk6GR+3P8wUiJAZzFq70xqrUHF0OdPzbG1Akyz7dVxUyDSB5hg/AzKcaZwJfG7B6lOb2Ok6oHzXCXiwI17ppsCqZp0mQa/7wMoB5H+32RZfAmoeMrBirDJ2zGU6MU9yRLOHDENwgUdeuwes8aNY3eY6dmxujYl7EZU6lxxrKjciYvzTcINP+Fg/9uBqZmi2LEcIW3edXcI8qkZbNwbUre27qRkAO3s78poV6ikXnC8GXINcfLzrI7BuaX42eh+ESkYD0Qr1skffiqi5j5zXUxDgC8J/+nmMGMHjCa+XYhJRiY3ZNB6NEtQpJMdt3q8KvEgIwPXSWjrBY069gmBT2XZryxLQ/lbhGjEYfqJPTRaItwjN0Rtpb1h/4gspctqbLifKFkcs5PdloIqIC6embL5PDhwRHrX97SNjFStIr154jVscsTpNXs9r5W3Cfn6cHUKLi1bjQ1yaKCyPOYzS63khC2IZT4qDMtL+60cFXxU9CE4srFhyfoDLBgSVg2E5OtjsmBKQ9yyZ2BJTEBNxKscRPMX+qqjjmzXcuz8xzoGomS4Btg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8898.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n0erLgckzfLUVsjqn2tvrMveZ1+ycps3y2BaExV6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0v/gRlGooJybQL7FpHGDOjK0q+ApphkYZ0G/vlc2ejvA2QsFQPS5dj1mxoLWpbjIb1QtHRhwQxK5nHH3cEejRbG1BRcgZ8De/4x/KHxpHeFDk94gv5VOkV1wA+61wtMF7KAtdp3OzR+eljsJiK0Z5BudZ4/X6vbKKX/soCNrYtZbbZX+ep8IGAFXun21xtLQJmO/l4oYgs1EhpJs5GkXccmwwJNDmpzzNbX8UReKCGT/o2JpMrk+/BEZvDZqPJFhYopF4oIjAMaCZDSUnTWzus5IXyhVL7YLDEFlUf4mJVwxldBuYNoIJDKX5FWN+df7DruoPiRRoDNqKlv9f8p/qPPqsAUJKMWMF2MoeyOgKpxM3NqVEp2EF35Au6kTqLY4GedTTaIQRR1I59SViHrwNPHobQaK87S78Y524AWGtDeZXIPE5YlpepVl0ByPbCzDV1gOcLveaBGNVA30A3mlN7+6kCffPAWtE35WXg8/qC+0wZNv+kXlrUxw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 822725aa-7262-4c66-c329-08dca5a2c33f X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 14:22:45.9721 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CM+SxzlcuHwA3vzV5D86r4XW5A41h75TZZn4ocYPqvVSg7tBW8T6x2Cu9xlv9Oi2FFHkpe5e6diV9m9ZEoijUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6789 This adds the initial implementation for the assistant menu in bluetoothctl, to detect and print MediaAssistant objects. The current BAP Broadcast Assistant implementation can be tested by running bluetoothctl, connecting to a BASS Server, scanning a Broadcast Source that is streaming a number of BISes with audio capabilities matching the capabilities of the peer device, and noticing the MediaAssistant objects being created: client/bluetoothctl [bluetooth]# [CHG] Controller 00:60:37:31:7E:3F Pairable: yes [bluetooth]# AdvertisementMonitor path registered [bluetooth]# scan on [bluetooth]# [NEW] Device 00:60:37:94:A6:A3 00-60-37-94-A6-A3 [bluetooth]# connect 00:60:37:94:A6:A3 Attempting to connect to 00:60:37:94:A6:A3 [CHG] Device 00:60:37:94:A6:A3 Connected: yes [00-60-37-94-A6-A3]# Connection successful [00-60-37-94-A6-A3]# [NEW] Device 15:65:78:B6:52:F6 15-65-78-B6-52-F6 [00-60-37-94-A6-A3]# [NEW] Assistant /org/bluez/hci0/src_15_65_78_B6_52_F6/dev_00_60_37_94_A6_A3/bis1 [00-60-37-94-A6-A3]# [NEW] Assistant /org/bluez/hci0/src_15_65_78_B6_52_F6/dev_00_60_37_94_A6_A3/bis2 [00-60-37-94-A6-A3]# scan off [00-60-37-94-A6-A3]# Diovery stopped [00-60-37-94-A6-A3]# disconnect Attempting to disconnect from 00:60:37:94:A6:A3 [00-60-37-94-A6-A3]# Successful disconnected [CHG] Device 00:60:37:94:A6:A3 Connected: no [bluetooth]# [DEL] Assistant /org/bluez/hci0/src_15_65_78_B6_52_F6/dev_00_60_37_94_A6_A3/bis1 [bluetooth]# [DEL] Assistant /org/bluez/hci0/src_15_65_78_B6_52_F6/dev_00_60_37_94_A6_A3/bis2 --- Makefile.tools | 3 +- client/assistant.c | 164 +++++++++++++++++++++++++++++++++++++++++++++ client/assistant.h | 13 ++++ client/main.c | 5 +- 4 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 client/assistant.c create mode 100644 client/assistant.h diff --git a/Makefile.tools b/Makefile.tools index 679c914bf..f4f9e82dc 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -13,7 +13,8 @@ client_bluetoothctl_SOURCES = client/main.c \ client/gatt.h client/gatt.c \ client/admin.h client/admin.c \ client/player.h client/player.c \ - client/mgmt.h client/mgmt.c + client/mgmt.h client/mgmt.c \ + client/assistant.h client/assistant.c client_bluetoothctl_LDADD = lib/libbluetooth-internal.la \ gdbus/libgdbus-internal.la src/libshared-glib.la \ $(GLIB_LIBS) $(DBUS_LIBS) -lreadline diff --git a/client/assistant.c b/client/assistant.c new file mode 100644 index 000000000..69a955c18 --- /dev/null +++ b/client/assistant.c @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright 2024 NXP + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "gdbus/gdbus.h" + +#include "lib/bluetooth.h" +#include "lib/uuid.h" + +#include "src/shared/util.h" +#include "src/shared/shell.h" +#include "src/shared/io.h" +#include "src/shared/queue.h" +#include "print.h" +#include "assistant.h" + +/* String display constants */ +#define COLORED_NEW COLOR_GREEN "NEW" COLOR_OFF +#define COLORED_CHG COLOR_YELLOW "CHG" COLOR_OFF +#define COLORED_DEL COLOR_RED "DEL" COLOR_OFF + +#define MEDIA_ASSISTANT_INTERFACE "org.bluez.MediaAssistant1" + +static DBusConnection *dbus_conn; + +static GList *assistants; + +static char *proxy_description(GDBusProxy *proxy, const char *title, + const char *description) +{ + const char *path; + + path = g_dbus_proxy_get_path(proxy); + + return g_strdup_printf("%s%s%s%s %s ", + description ? "[" : "", + description ? : "", + description ? "] " : "", + title, path); +} + +static void print_assistant(GDBusProxy *proxy, const char *description) +{ + char *str; + + str = proxy_description(proxy, "Assistant", description); + + bt_shell_printf("%s\n", str); + + g_free(str); +} + +static void assistant_added(GDBusProxy *proxy) +{ + assistants = g_list_append(assistants, proxy); + + print_assistant(proxy, COLORED_NEW); +} + +static void proxy_added(GDBusProxy *proxy, void *user_data) +{ + const char *interface; + + interface = g_dbus_proxy_get_interface(proxy); + + if (!strcmp(interface, MEDIA_ASSISTANT_INTERFACE)) + assistant_added(proxy); +} + +static void assistant_removed(GDBusProxy *proxy) +{ + assistants = g_list_remove(assistants, proxy); + + print_assistant(proxy, COLORED_DEL); +} + +static void proxy_removed(GDBusProxy *proxy, void *user_data) +{ + const char *interface; + + interface = g_dbus_proxy_get_interface(proxy); + + if (!strcmp(interface, MEDIA_ASSISTANT_INTERFACE)) + assistant_removed(proxy); +} + +static void assistant_property_changed(GDBusProxy *proxy, const char *name, + DBusMessageIter *iter) +{ + char *str; + + str = proxy_description(proxy, "Assistant", COLORED_CHG); + print_iter(str, name, iter); + g_free(str); +} + +static void property_changed(GDBusProxy *proxy, const char *name, + DBusMessageIter *iter, void *user_data) +{ + const char *interface; + + interface = g_dbus_proxy_get_interface(proxy); + + if (!strcmp(interface, MEDIA_ASSISTANT_INTERFACE)) + assistant_property_changed(proxy, name, iter); +} + +static void assistant_unregister(void *data) +{ + GDBusProxy *proxy = data; + + bt_shell_printf("Assistant %s unregistered\n", + g_dbus_proxy_get_path(proxy)); +} + +static void disconnect_handler(DBusConnection *connection, void *user_data) +{ + g_list_free_full(assistants, assistant_unregister); + assistants = NULL; +} + +static GDBusClient * client; + +void assistant_add_submenu(void) +{ + dbus_conn = bt_shell_get_env("DBUS_CONNECTION"); + if (!dbus_conn || client) + return; + + client = g_dbus_client_new(dbus_conn, "org.bluez", "/org/bluez"); + + g_dbus_client_set_proxy_handlers(client, proxy_added, proxy_removed, + property_changed, NULL); + g_dbus_client_set_disconnect_watch(client, disconnect_handler, NULL); +} + +void assistant_remove_submenu(void) +{ + g_dbus_client_unref(client); + client = NULL; +} + diff --git a/client/assistant.h b/client/assistant.h new file mode 100644 index 000000000..418b0b840 --- /dev/null +++ b/client/assistant.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright 2024 NXP + * + * + */ + +void assistant_add_submenu(void); +void assistant_remove_submenu(void); + diff --git a/client/main.c b/client/main.c index f012ddd43..a96a42638 100644 --- a/client/main.c +++ b/client/main.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2012 Intel Corporation. All rights reserved. - * + * Copyright 2024 NXP * */ @@ -34,6 +34,7 @@ #include "admin.h" #include "player.h" #include "mgmt.h" +#include "assistant.h" /* String display constants */ #define COLORED_NEW COLOR_GREEN "NEW" COLOR_OFF @@ -3205,6 +3206,7 @@ int main(int argc, char *argv[]) admin_add_submenu(); player_add_submenu(); mgmt_add_submenu(); + assistant_add_submenu(); client = g_dbus_client_new(dbus_conn, "org.bluez", "/org/bluez"); @@ -3222,6 +3224,7 @@ int main(int argc, char *argv[]) admin_remove_submenu(); player_remove_submenu(); mgmt_remove_submenu(); + assistant_remove_submenu(); g_dbus_client_unref(client);