From patchwork Fri Nov 15 10:38:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876074 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (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 7409F38DD8 for ; Fri, 15 Nov 2024 10:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667121; cv=fail; b=oPmf3Ahfl3ttnCrD0KsJXxBv5W2mhzD0nK3T+zHdtLhLgFfDRiek++ZumzXj2jFH5EGRZVL9DrIEB8QYHxVpMaROapRmOEgQaJKzEogcxkGN+gV6X8Zq6pijJPNdBCxGhPglbZ5rKBjktzvrZ8WMOan1rirqOQkdjedKl8kUH8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667121; c=relaxed/simple; bh=m28VM6DA+DilLnVF6Lk6E9AEeQHfliCXjOU7SrY7JEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jD4u+Iusp5WIQLQg5iUjhM/+vxYVHBb0y2bxDRXAfTtFLJLMUv0qOheH6UJM22W3UxC9ZIxQa0PYTjYiab38zGk04mk0UnuFOMMTqpjwhpQvVtgp8gGblfv3G/4S6X0A5pkd3BJodIgzhhYKyXd9bQxieADlKlFE6cycXWwfs3A= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=c/POaCuj; arc=fail smtp.client-ip=40.107.249.40 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="c/POaCuj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qtb2yEP8tRI5FWMcHITaThdoLOPZ5rX+Z9aGFkjtAYhBOyEjPHpazzWdZRp0DfCrthK8EnKz1iW7tHepJpQi6kF3tfdZwstAR+Pr8KwHb1uJCzy8X2iLBsrQZTIVfeiqnFkdTmoJRhlMjw2UOXl6mcGexRYXQ9pk2IUDoOY2c7OkwAPdnLxNyMv5quQlvDF2DAbHEq0wKE4rzUUboqowv2XzGzlgNAQl+R2bQFZ2CSmQSPtN6C46OqW7rZbCZTS7K9laX2BWq7w1Oi64vjbPadWg8lkLOURNGq/EbDOn/q7bRCdEKm62nmsO+gjY4ZmXbZzaWdDQQ6L7l8bKigEzPw== 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=1e6yq9wTQl0b4bwm84/QNH7vvqpqKKqo/ggy/t5EbRA=; b=nZJBKj9JPvWVUYd7wm/VXV3LWSLBtEvPq5AcYFR05Uky7jN1mWGC9SIZ9XYNMs6I8G9fDKcPBxX5Nwq8e50xfdob64FyeLeBgMBJ0XStRNpLFM2pUlYzdodOGD6dbcKNfZCjsN7NqswiHZMgHZCIeeyQFDTFWJ8joJVQHFmP5xcygMD+GqEER4mMfZcCCEpNspKrIoKrcQxuOkQAFOSrKLBMTWu95KanKlMazJD4n4r+Aqpkc3v9RG1EJ/Z/eosDQ3p58wTYbpLm3zpM0wBloQ+d80OdIeR4YPu1VRRTE7NXS5+IU167LvrsI+g0S/w9RdjTZNT0QVirzV/VLWlp4A== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1e6yq9wTQl0b4bwm84/QNH7vvqpqKKqo/ggy/t5EbRA=; b=c/POaCujHMUrm2CLPgWyJ9yJGqjeFiw08n5THF0n8Imv03g8wOLTcZhejDe7e06MzchvyqLz/VNyEFZcw8ON6VVfbJyH2M0g8gDbJv8POAtTo82s78JyQ6KJ/TmRSuozYvGxV3IaFD9Dd8H0H1AtLSzDBgSsg2xJmCTVdvOk477ybJRiRTMYFPxmA1JGYOY/93kWqNBYi1dCXRWJ41H7LV/JF2d0fYQMfCd4f6zuHu7doVbF4zPDd5Y3i1ZWKvn6F/ugv0OcBK4pfzfkFc76KXReVc57M1kvHumSUMoe/FbjljO5gnYJoKqgEd6YpIACP5DCTscWgJtA3Dv121xPGA== 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 DU2PR04MB8776.eurprd04.prod.outlook.com (2603:10a6:10:2e3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 10:38:36 +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.8158.017; Fri, 15 Nov 2024 10:38:36 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 1/6] bap: Rework parse_base Date: Fri, 15 Nov 2024 12:38:19 +0200 Message-ID: <20241115103825.19761-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR02CA0181.eurprd02.prod.outlook.com (2603:10a6:20b:28e::18) 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_|DU2PR04MB8776:EE_ X-MS-Office365-Filtering-Correlation-Id: b4f013da-519c-4546-6d0e-08dd0561a917 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: 90IlWOk+6wnhVZE/2cmiiYpmZzVezxdJP30nJmeYheEHtnEkWI7M7kGCrYiR0762GJRvrIUKLKhLhroKN3Qa32XPfivVR4ejQz+Szh2RzlE/ZeYyqrPdjicnKRJHOCJ+OacJyvgO3kR2bGgKHqKlBEWHuyAl1XoDiebeykqmX91eV6/gDk+e+3IVbERCfOc2XBrFgRW965qr/S3WyGupp0X280JqKcfjASLL9qHQP7p8Zwc9XYBRDMOa53zUC9UwRXY25TE8BElHhaqUfvZsZisTD6OQNUwomYPwwezfyWLDhnMuUDJvO88kWWtT6HvnxewFchbX8tVIyKO76Jh8W3nTDn+4GGWDehYepZZoIh+d/kjMGUCACbEVzB3J/2fld7aC9/CxQU1lmAjYwI2tscc+mvETM/Ht1+r5WU7lzYcfJCfPwUN6Pz/fVN/76tF6nLBWKNDPi1OgHoXGkbKA7GdmgvbfUMKR3LEG3NeUXqyzGfq4g1A/JYJhhG0wLRcWLtQXMuWECDWWrXBZTHKCEVZi6LKhSBPXh9c7YbnQhb3pOWkgpTZ7bZStxY+UQ+D8xSX297xQc/z5O+8m9LhVZyr3sjPswVaCWeHEEV0uVlXN9S+vz4j5THWOaR5N018qTUROCmfhV7BkjPbxNaOcLPRdA2NBgpGKdwP/FHS3zV/P2hPl52T29XVe6PwyPsih/QxajRzF94iIluIOzB8ybRlx3IO2CgC6u+nGaPDtUtlvplfkT1/8R7zGix1Wt64YnZGVMwi6Kf3ByI31ogpgefeUkPLwAWjQnBXfwhtjSPutDTWdQeCGFxuyIcRNgsSWRV8fQ42577Uwlue6Z9l7imJ0LAUMeJnUnwYKIBRNSrktyEc02c5bmPMKCgA8eIC+tBqQYNzZJVD+LE/HNFCJBi2sFEbGqgZyEqM6hrvtxyackVvVmenl0/3GL4xoACxhUmDqaDuHyU6FwFlpodne7HksdGHPSioeRZpKYnbHIynOZaF5p2oCXtA2ZpmHzt/MrjGXGsRI7yTjy1lJ19whwoBHxNHVGjCNzDBmbH0iAteCeot+d7NJkmROPJzX5TEpZ1kLDiQmOvnFtWpHCSRPlcUhutje/jMyrZmLnsV1PYfRg021+IvpCmcHTh7HeBdE282mgWt2ZvlJh2Ti5tIt7NPLtBh47gM6acdZn452ANoVTvqRJZd7X1wdLDxKJjvYsTza5pTHn9jjh6NJ3pLvSOUAcAzd+IactrJ2OvhQayaO2ZQ6ZY2sdq+j/J+vOIuOCa/FqmLevZbpybKFdidF+amHL4upJ8FAFFsA4wbfgBr+owc2wMJJdx3UjN6sq2td 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)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x1LFwky0jrWUmY/vS6qbuFVc6JCtzZuVIFs8yWeCJRz1P7kLWuCiT38fvtWEjUIQpK572qkRGEougaCu8GCcv0BpHRQOoTd4Nr/rxyH7TE2EQ1k0RDyfWtlnqcsjECk4WSj0B2CXBT2g/3pouqdWTgw0gBWXyUJ5BjG9BRybWp2fSm6aZUAY9+Nwkw4ALcHeFKCmrVMJTiUgfdRqYbwvcU9unPDIG52AjyObwnA7npX5WJfWMS/RrMOXqdS9knbUwcgt5xgwdfrieUfYeSLC176Imici3gucv9Nya6Ak8suK0tHBUYvqNucnu86S9cQZl20CsJOGfJ0urfHFE9AJv/93YwFB4fW2zL6pfAGVBV8rsIFgZvzxQNfRXXsSWZ8WvRapaNSlCaJbLaL8iGuNWU9vKuIiyOJ2BoS/Om4w9bnbUFgcqnXZJT/KVB0zsmpqTS+OtpQ+yNYIC4uhqTps8iJBxFxlL6xa4e0rHmAOra/jVNsTMxElvpoEt642+ltIDdeTDQUEifhJDOJDSMqPm8ZqWaeP/uPMdhuCRYEJRrtAWU/n/1AJBu7JSyLil3u9kUuxithHhjh2M6yVMnTd3IXxWpabkj12PrGvR9vIlnObKpqnlXdEV74ZeJ6ZBVSUpm/WVldGfYdmFOdLgcqHXmnmgTbZuhmXZc7bKEh997nO3nVARsEBwg5O0fmtM3ytCMoRMT3UIq/qbXtBxVNUJfOxS6V9vzyiEE/4I/7tHG0W6q7afVQTx+NAZAxIrfU0nlgdjwoA2vTfaS0bc9nBgJsMec6zffbhiTKkpPw2TDmwMjKusfilT0Py6q6QA1irhAuaPHOuWxwWirP5hrzmFuJqyvpxXEv9+a7g9MJ08pqEvsWmwi5bEibW2ykCZoJJBouBR+VE/gxXPqwf9ugvyEIKxUdM7t2slKGiAwznperr2opi0ua2VDvfWZ165Y1bLIY7KJqgFJNhNms70SXcCu5qNNUgg6mzW3XMBsiZ0bMmiqD8aSEuA999DThlzLS9sPJdzIOgLxoR7YwSxCOuW8l+N2yw7ylDVephzNd9b6hQ1RFVDDxPIvKRQSLS/5HfIoVgytvCfpT/OX0thAocZ18lxx7H/J+QxWWlj2YzzZf/aySv3l743vzy//5ewHIRbwz+YtB15kiawNfEQ5ZIVauiiOuSwrgRqoigttZNxIGlpLEAfTir3X6qVmoYYQxTYdhkvnc/0kS2Ipnhyt/lSfKi4RosNuNXMQ74MXvjHAx1tQGuncXfOkeq2bx9rEqm2UehPLNmPqfyxbZF8NvY4LV+yAOyTZeS8dbiZ657c1/NvZnFB5toOoxmwXxusDY6rBfHBHP7NL90lk+ssnISXAVoIkoexFjSRYv7CINOWZEhpb05i7xBTwfs7ySo44Kr1bGkQCAGg/e3NSHys2f3s+JEYfyzYTGjNB44RrcNbbfBUt8jmzdFAWhmhGGPIRTMbC8+LOcMHIKWoSKobMba5Kb6xQT5uEnrTvGrGKmcO59sV9qlgzkTGOQzJ3Gp4iDHdX7lxmKMXQDylUNEj+dbfw8AxWi/Sgfw2W+ERhSQ3f1CTJl5KS/kQa6nw3iigTDlfJhE/DYOiuKgg9H/nQ5iRQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4f013da-519c-4546-6d0e-08dd0561a917 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:36.5333 (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: scBuPT8umGHTS39Uahb/yGi91M2Up6V8PGRewNsOvWe276v4waNADpqC29qLF7i9LFCSzf3qHIA6pUpIEwmtwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8776 This makes BAP parse_base public, so other plugins can reuse the logic (BASS should also parse BASE internally for the Scan Delegator implementation). Since different plugins need to handle BISes differently, this commit also reworks parse_base to receive a BIS handler callback which will be called for each parsed BIS. --- profiles/audio/bap.c | 78 +++++++++++++++++++++++--------------------- profiles/audio/bap.h | 8 +++++ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index df685c6d3..98b28f15a 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1086,8 +1086,42 @@ static void create_stream_for_bis(struct bap_data *bap_data, NULL, NULL); } -static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, - struct bt_iso_qos *qos, util_debug_func_t func) +static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, + struct iovec *meta, struct bt_iso_qos *qos, void *user_data) +{ + struct bap_data *data = user_data; + struct bt_bap_pac *lpac; + char *path; + + bass_add_stream(data->device, meta, caps, qos, sgrp, bis); + + if (!bass_check_bis(data->device, bis)) + /* If this Broadcast Sink is acting as a Scan + * Delegator, only attempt to create streams + * for the BISes required by the peer Broadcast + * Assistant. + */ + return; + + /* Check if this BIS matches any local PAC */ + bt_bap_verify_bis(data->bap, bis, + caps, &lpac); + + if (!lpac) + return; + + if (asprintf(&path, "%s/bis%d", + device_get_path(data->device), + bis) < 0) + return; + + create_stream_for_bis(data, lpac, qos, + caps, meta, path); +} + +bool parse_base(struct bt_iso_base *base, struct bt_iso_qos *qos, + util_debug_func_t func, bap_stream_cb_t handler, + void *user_data) { struct iovec iov = { .iov_base = base->base, @@ -1167,9 +1201,6 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, uint8_t bis_index; struct iovec *l3_caps; struct iovec *merged_caps; - struct bt_bap_pac *matched_lpac; - char *path; - int err; if (!util_iov_pull_u8(&iov, &bis_index)) { ret = false; @@ -1177,18 +1208,12 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, } util_debug(func, NULL, "BIS #%d", bis_index); - err = asprintf(&path, "%s/bis%d", - device_get_path(bap_data->device), - bis_index); - if (err < 0) - continue; /* Read Codec Specific Configuration */ l3_caps = new0(struct iovec, 1); if (!util_iov_pull_u8(&iov, (void *)&l3_caps->iov_len)) { free(l3_caps); - free(path); ret = false; goto group_fail; } @@ -1206,34 +1231,11 @@ static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, func); merged_caps = bt_bap_merge_caps(l2_caps, l3_caps); - if (!merged_caps) { - free(path); + if (!merged_caps) continue; - } - - bass_add_stream(bap_data->device, meta, merged_caps, - qos, idx, bis_index); - - if (!bass_check_bis(bap_data->device, bis_index)) { - /* If this Broadcast Sink is acting as a Scan - * Delegator, only attempt to create streams - * for the BISes required by the peer Broadcast - * Assistant. - */ - continue; - } - - /* Check if this BIS matches any local PAC */ - bt_bap_verify_bis(bap_data->bap, bis_index, - merged_caps, &matched_lpac); - - if (matched_lpac == NULL) { - free(path); - continue; - } - create_stream_for_bis(bap_data, matched_lpac, qos, - merged_caps, meta, path); + handler(bis_index, idx, merged_caps, meta, + qos, user_data); } group_fail: @@ -1299,7 +1301,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, /* Analyze received BASE data and create remote media endpoints for each * BIS matching our capabilities */ - parse_base(data, &base, &qos, bap_debug); + parse_base(&base, &qos, bap_debug, bis_handler, data); service_set_connecting(req->data.service); diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h index cfe633311..cf2593db8 100644 --- a/profiles/audio/bap.h +++ b/profiles/audio/bap.h @@ -7,5 +7,13 @@ * */ +typedef void (*bap_stream_cb_t)(uint8_t bis, uint8_t sgrp, + struct iovec *caps, struct iovec *meta, + struct bt_iso_qos *qos, void *user_data); + struct bt_bap *bap_get_session(struct btd_device *device); void bap_scan_delegator_probe(struct btd_device *device); + +bool parse_base(struct bt_iso_base *base, struct bt_iso_qos *qos, + util_debug_func_t func, bap_stream_cb_t handler, + void *user_data); From patchwork Fri Nov 15 10:38:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876075 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (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 CABC11B3921 for ; Fri, 15 Nov 2024 10:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667123; cv=fail; b=HScsTXLm0z5eTk2nmszm9C8kSoBomECEntue5rchMzwP3ksdFXEfS8bRQmjKNdBlKurbvg4WCUF8OD4Y6bxFrZjVM2jOwxl/2+7NI8ChqnzSO7RLL9rA/LVy7LoJ5WttU+ABKUjpdQT7+qA0ILakkxbJ27y7DpK6V/rXQ1c9PDs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667123; c=relaxed/simple; bh=ORIyVquidOZMpGSPVGSBQyLO4+6IqpxPVwrm+cUTi/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=RppZBfjp3OKTo2RQGoDsVJfYStR034V0/gBiHD+uMoZ/BBmTXYuFHBp+asQoBhJrp4kyXp2005niUSY4KPGgjJJy4JEwwNOwO757oSoHI6vDqnovodwGPSUB5EwZcPR1g7mbfI01CBd1jX9Rd1+NsydMs6Qm0/OSO7Js5U7LXLA= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jkBHoOWd; arc=fail smtp.client-ip=40.107.249.40 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jkBHoOWd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RpiapO5frP5KxXM1UtL+ELCmP95bsYjlWhHfa/i52IWdfJ4R+nIov4+O1OdbvyKC6x+98CqRBqf/5O5WIFjLXnf6cn+I+7Owjf3pIMz4zbXG+rpctTBok9gqvwT+NMuvjvSAA0fCn+vc0akq54b5UC0s6ogKCoAbML33yhYSXNhgZfcI10aA4+205pIThjQnQso1nmyox72/G5RvUH8wQwZUm6wwwk9VCoqqSbeadZ0BBypt1jQfIUYa6bCTHPIVgT5kaIqtpRH2fmon73w1tn09+afZwdwEW+bTKVJ4hxBVVyfzSCEv5IqGdO2jMjkQ0XqXf3rMxAn5M3ryD1CBVA== 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=ptKvC9TgbCdy729sgSCIx6PPwcWTvfoKcwCRf2GInT8=; b=nksxLZVDSgemBp894o8uD881kN3bpgexRxFC6Xo2BxjsJbcGY47wGvsty4rpNsiMygkXIgtx0o9/CNfeDA4TEpnGtIXZbvtqH778bfPx23Lja0rh9vOfqp3TQw5/xHK4jx6yC62EFMKUJXvnITRMAYO9MXm/fkGdfBVR4KRC7vLA533VeaPb1QxOTGtycQu4Xi2FU9bEQ6RJXHO7W1gXaNVKBuXCzpTWFt+gXk+kE5LYDHt2tBaQwdf3rEkYd+bZunohroF/c3DHHM11vmjuVoO3yLOltCNx9HnU/3RMgNhw1geE2tRurXFiNTPdyu8doHAiO908IlL9foE/kiVmVQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ptKvC9TgbCdy729sgSCIx6PPwcWTvfoKcwCRf2GInT8=; b=jkBHoOWd1CCRiZ3nde5s68oKqA/yLzhgVY8JQarTKGMt8lVNMBHIfeW8/NF1Q+BxrUB31CF/ay5NsiaxTi+U4ungXFvFi3taP5G+cvcg/CgBnymUeJa4wjKMnmRqyopxRz+7j4kO0VKlH8I3xCp79gvHIzLhhZh+DTDnnwlmcuNrg/6LAOTJlWLd8GtdRUlVuqED1dGuRbokAn7yQcT6x5Oyzta5CNz55hJc//Ty5d8qFZwPrzPqUP+JJ/NbvnIV3BAvSnY5w8VaRcJJr9QlszuT1f9ErpolZZRCFALhUf+oZOnpmm38W4uAqrTvzAQizJ4MX5kPGFLzvolP9JDTnA== 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 DU2PR04MB8776.eurprd04.prod.outlook.com (2603:10a6:10:2e3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 10:38:39 +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.8158.017; Fri, 15 Nov 2024 10:38:39 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 2/6] bap: Make default PA sync QoS public Date: Fri, 15 Nov 2024 12:38:20 +0200 Message-ID: <20241115103825.19761-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P189CA0019.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::10) 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_|DU2PR04MB8776:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bd7ee3a-e98e-4fb0-f35d-08dd0561aaa8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: bT/D1O4JRbc39ke5p5uYFlabFRaR0N/HmoNQY/b00w4f3MmjXDLHBlpfo8VHwJU8liPaZbtq3O9zol+8RIn5xjw4BUlXrBuCudjTGRV2toqa2d6tHZvJPqbwddoiUshbf5frQC4X00Lxl7OcFBdJnZMMjLwsGVGHXObF0nvriRGuox/uqfpAuu5Xi6sxBFJHGFvl/66kw1rNi5iyeXo+KBZ8wD1zVKp5d2avml9zw7dDQrx647aIElwhvmRaW5hyLhIOXkn/VzgKJzwZrBZCEgCK95/jUEV9h8eUf9bW19TdYPVOO0S5lONOntpXep3PZ49XvQzTGCUnace+eXs9G6g7HafvGBZRzYtFMTQ/mrAD2gZl36NRB2SlY1x9cD76Q9oxaknw5dr6aPy9A132FvcRIycEhZC0R9vG4nNmyClY5BJD1+EuJAe9Uftd7Wz0W3OBTwfeNYdrLs8fSsj7kRTppdCzhIsjIg/0VhkSyiSDxMGulm60XZrXDm+SyIbmDYZmh/4nfyd2zZVE0Wjap+38TTvhiDiQ3FxVY9Lyol0RG5WY4ZBrQgxap6eCbCCUjfGg2aj3S5wba2zjzv3ZQY2uWChVx8l6xjlbSQ/tTlS4AMy3tBEXhp9LkFMPI3+6p9QcE5qHSfQ0nQBHrkWRjh6T4RdAnX1qBxTJsV2SpGxPI0byHVdL5nk1mB1T8iJMqSIZhtQsToiRUkXwZhq96SkS50MP/4Uks2RGP6fj5ruPtY5OX3+SrNZbB/MuVmebKeOpX00QZs2k2QIqnE0SkOkwzAoE7KDGE+3h1rn5Q2Wldbkv4/bbpwKfQG/ss0d552pHpIt1GsiVrGJEZBa8U0k+mnfivuoabZUc7NTjQv1TC7h63vsMRUlgw0bcq8jmB7WpcW4M/oV56p7pRvAMCHMgnr+x1A74PgdguzSsfR1B2+/gGdScLab6kofotJkrVVCNDACRIZqRsiX5ySebJKMmFg9jKgPNqdt0qgajakJi4tEn4D/LHFDyyPyEgLKCsK6AFAuPabujrFp4U0l3NPj2BGxgdF2bY86mm8an1GSc2dynbaASYNyaJU+hxgEhOM2TMB9gK+PZtkGwFABjpMZgCRMw95B3sMUTa/v7gFaoJZmo6GaHClSerrjymNkx3DSaPZ2G7xIVxxeGwllQCE7UnIMm2uWczjI0pioNGuxKWHGOVGSclD7AVgo5bk2GzEONHfXc++7b79lf6ew5hz0VCxZnQO7U67D/RaeLGAbREpgLA8IpqxZ2Z5aa292VKT2dv9OhfZ9ca514MnQBhC+Fe7msS69b3jZt3949aF9/pQ3ruIpovGsclWiaDIpD 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)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JtglrmGnMBZ4J8JA8qInjm7ApyG9INJ7RSRsfM4FwwNyeLKUYrpeQ3jcXGgJVejz8Us+HKyR3I+CmTP8DD3hfSZltiARIGC/7ISdUSdQni50Oigjf+VebSJmY/82stRoInu9KJsQhKqmpOHCSoXysx2Kx+RC5tgBkZtKooS4T+IsNt8umo72nTmTDB2NoSi6nugUeJKN3061TWzEqr+8bR1PN+zJtOofVt1BJgnBCVUhqgr/Y+QgT2h7IN4j7EDjeQogSnpU59c4iuJsnIlbBsYil49QZGg4FzW25Y9B5Ll+ykh/gVPH3ZlPwxuOJ/VDZwAeJrKruIVChMwb5xAYNTGjEGkq0vOOuOdYNkamclxq9b/XD/5vNOQXWKzjYrz7jge1vsS0zGgXD4cEgCJpUnNBzQyDsq1gIsPFNExEsGmBEoRJVQzreqf5gy7vbesnAWwWUtMrTBhoxdvdYA2MSsE7c7SYEHbWh7yUjqWXhUP0UeNWLTs1rVIs0dkf1kNvxHLEnt1TTpEHKHxlrv+OENUvMa/A02kVKTh7Y00U4t4Q28/c7/ZtqQY9ZU9OUrUeRbG+jFR/NDfjLpwpFg5oys6QnvQNHktgHk0j03FP2Bo07o3O8rsf4cMa56W0p7DEjqNGQIhnvRg5fgS2AZvdFrDcWcLUlOuO6DgJuQQY0J6dZ6r8E1kQJkPFSA11pBUuy27tqi8mT06ZHrBkW70k55PNcQ4oDgV/BGk0xVvGufeH4QFKOKQhrEnnqR15yMJNYLcw0hgzAM7uG+rTNfVG9eicT+OU90L2wSZSGgOhRybLiFhuLyvwZ4Eo1umcAEUXlvQVzq8VrklntKAu2OaAMawIXj+ZNgTZcTOYbWsRGRw7fP1jmNpb7PzGm4NlBI62d1wHyw/N4oK5MLfVq31Zvn40VdfOSBW2qdfA/ktglBZAXbEog04A8EQtIO3ArLV4ULYdTGA4cx2FlKITJaLLToJeP3+MnWOQeZSQ9OcRooWxVuekzd7RvUvkpuiOciAXneiZcXH/Dm7gadxo8YNB3LFZuhZueM3XhYZimxisjqmI09awwfDLrdnL/7aH8vkzdUzmWhqe6sRi9dntfZud7sMVxbrTv0EaEL+18PvBR1I9jbhaWFQfs+yAS+UFrEvZEgbO2ldnRZ/dHv9ztEobdMrKyadfMUuKavVKS9gwJdhNPjmv+s1yV3r/Ewxj+A7yu2bSXAGe/e2FoaobgvKztDZwrKhY5J5ivnDg0akFzsT3aOAJG9GmVK4zi5OI3c9yN4MoaGoV3G8pRpeD+GsX/jIxikeW0IUs/oJzi6s8K0Qg4PFFYRhfeqYDerjg7Vz+vAgJmaC2zgPTJTyPS/vClvOGwVKrcr25Ag+kJHTn3sKUsZ+2KEi9y9ZnswAMKNKTayPL5FU07K52PrVG631/YKwCgeADEOtO+Xj3gyNDXPzWAJFi1ERroIiRPpU/rTwg/VLIkiY8DLMivUCTKYpKStf5FqCkG4qmJya4txToSZ39VfMiWM5yU/HyKeWCMFvQztpfs50KMmjf4Bjhqp77zLcdDB+Fbg6/NLPSMZk8FYwufjKslVwpVRdAKFBpfqqCtIYakFENeBDFoxJ3/B5HVg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd7ee3a-e98e-4fb0-f35d-08dd0561aaa8 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:39.3570 (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: yXKEBzoQGWNRqbGOqGHiqr90Qptyj8yorWjC0nw1lIH9KCLou7JuscyHIvSNtzgoESUfLLDWPv5ut4LPEVgSWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8776 This make the default BAP QoS parameters for PA Create Sync public, to be available to other plugins that might need to listen for Broadcasters (like BASS). --- profiles/audio/bap.c | 2 +- profiles/audio/bap.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 98b28f15a..dbea59776 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -150,7 +150,7 @@ static struct queue *adapters; * The full QOS is populated at the time the user selects and endpoint and * configures it using SetConfiguration. */ -static struct bt_iso_qos bap_sink_pa_qos = { +struct bt_iso_qos bap_sink_pa_qos = { .bcast = { .options = 0x00, .skip = 0x0000, diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h index cf2593db8..98bea558c 100644 --- a/profiles/audio/bap.h +++ b/profiles/audio/bap.h @@ -11,6 +11,8 @@ typedef void (*bap_stream_cb_t)(uint8_t bis, uint8_t sgrp, struct iovec *caps, struct iovec *meta, struct bt_iso_qos *qos, void *user_data); +extern struct bt_iso_qos bap_sink_pa_qos; + struct bt_bap *bap_get_session(struct btd_device *device); void bap_scan_delegator_probe(struct btd_device *device); From patchwork Fri Nov 15 10:38:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876076 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (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 E5AF61B395F for ; Fri, 15 Nov 2024 10:38:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667126; cv=fail; b=VyZYzEanTkRW8nrMd0zpKLSn1nBr9hgIN2irklXv2ZtTtwo6O08l9PTAAF+uzGBgU3DUPQwNB0a53RdV4+tb6wRQyjGYFHiPS9TFZdGSzoCFbPCTHkKYIhxdgjq35SeWDbLATIFcRiLbA0f7Ih/zE9NBaJybtTNpCPK0jS2WV4Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667126; c=relaxed/simple; bh=X2xniRXMkv+9g0J+1c0zuZqK7CNSU/MD+HHm0GgBMz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=hFrlEmBpxbsVpwg9J4kO+dtRyEeOn0+FfVtEL0ngxvsJIqd7T29qoRfvVp/bc/e/j14Vp61XpVeSaZAYZfJFw/RwV/VGoKzV5PeTItVCgCEg7FNkAy4kLa00593jG9UK1VBAJVB/e3dI0NjBPv/F+7lY6egDLJMIa/l4IZMg6do= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ANBi7pEm; arc=fail smtp.client-ip=40.107.249.40 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ANBi7pEm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gZi7deLh8eJOTCp02MjJzKlS5WZbyrZpBAsCbQM87EopOebydAxOO5zHme8P2JSuBurGIEKhzOkaDkx8SqSWCzLm+kCtprTwGGJl41Y+h66bCXJlq0apWKwcd5trSlhp/A2ybT/P/CyU24l2WyQkc4kQUg0aKA2cWZTm7gZO2vC2zt8uqa/XpXMmuwtCwn5mwcPZvWTfli4o2gHTRnvq+cGQPSFGGZCGHb7iS6TCGFmnP97436sovw7mwnoLy3IBzDrTOjoz/Tpbs/MA4VLAsGm5r8mh/cNiij+HhWENHwdf84Mjh6hWf1XqkhxYGwVSoMhn2QS6+PgIPQPtPjg/Aw== 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=mcrZJh1RhZ+GNE7Doep2ScydcWMjfplntHedbZn1P7Y=; b=M426Zi49ISB9xXCXo4/f87bHpjni43LNJ8NbEuFzTFvLzxChtWMGFkxRlEZoEalr5qp1UL52/TRzuWGwa6D24OQpA7jPpIa0+woTiJyl24wrLAQur5BIpzxs1QW7K7kmW2X7JPOIUFyzQimnBCv0LyGWSfG3HI2aAJAilRlREfi/l5ivGgxY2oOUSvJ/vDlWryrhYD7xQO8BjkNMjrbv5ROaLK1fSgN+ZFVfHzqpS5EIsOEaW7Zr5506U5zD2xo+zEaRyR04l786mbfm4ztPJa0Kloq1+ioe4E5JsmAVBS0C3j/28eZxoHeyOnpNxDIuL/kr371qkMXMMFOs8587jg== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mcrZJh1RhZ+GNE7Doep2ScydcWMjfplntHedbZn1P7Y=; b=ANBi7pEmDHL/4Y9TRX5a07eqQvNJWfRCBwo/X4/JdHJLjrlX91euoH4i8GoUEVX+cbg7sGUuskN9EQpq9MDUAvMla19AkkIxcPuMaSDMXWofLyDnupK/nnSZvFvRzmprCTAW977AG56aFFluhg9BbTnrH+oWG3iVatWAxW4yR7XvjQxMg8lEoyjTTlbIYjMoDhvp60Mmrv9rwFBoVr75/aEE8pU1RgwOF8djt7KXYfLt6bhQ34rrb3xs5KEH8cFmDG35CLzYippBxjJ7iaQNhcc0XF0lmtjQBaxZY/2dF9YxwXygFhUYpYcECeyCTp/vBuivttuRUZy03TCqkP1kDg== 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 DU2PR04MB8776.eurprd04.prod.outlook.com (2603:10a6:10:2e3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 10:38:41 +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.8158.017; Fri, 15 Nov 2024 10:38:41 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 3/6] bap: Add helpers to convert iso_qos to/from bap_qos Date: Fri, 15 Nov 2024 12:38:21 +0200 Message-ID: <20241115103825.19761-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P251CA0014.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d2::14) 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_|DU2PR04MB8776:EE_ X-MS-Office365-Filtering-Correlation-Id: 231e932c-5d4c-484d-2db4-08dd0561ac23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: q3c6sYoabQa/BJ6PBp44EPAH8OTmiHjSvB8VZ5QkavuFjneMybAILFey5YbhzvVNKyJkOr8bUS3l09OJVyTkTL5fV9QmcsZlEFPXC1byJpQFq17B777+27PILYoG5Av9NM1PfsYFXNmObjZ7UCt2cOhrPzSj+KBLdG3VDRZGJKBu+WJdV1PBmDIZhcnlXQfcDFKcckzVxMSH6SQi2KK1/jfbcP2T6lsYPP7zpf9zx8r4KnnXF8/XRbeZd7ZHHTQ1zXXBrFlXpHIB97VwD//98pbrLTxLgjXBmU1d5uD5dAGmaa3KBlOSvQ9GbSGdxPjc/AI9QAuvgtnXu2aivbIGg49UUK2FMGb5rba+hf5L3V+0PBFnkkTt5JzFgweVa6vXE+M/RCehEtMu1NHGBB5w4C9y6xkM2DZ8Vsd//RLksC3f2I23vs/bu3Vs/xgkd7sHcpVRowhaLpXpaDrgtlZUOf2L+8HbgmZRZRPs+rgROTbEjx2jG+9Aujj9AgcfcKX0OotWt4WJorsnIT5bS8SUx1u3ReNpNlI7sBzxEWn8P+3zI0uMxc2G6DM9ymvjco4efhskJIwOrwoONrSAvS6oz4x3b76A4y8aDVSTS4V8gW2X02wJ0SpxbWKyi2LcEjHQWH8K5CbMKmVMxgKmrNEExTtEIiUMg36zXvN/Rdc0yGWadacgcxFeFUffdsI5jdDDr0I8zL4yip1le7dFDRk7xjettGIZK9wivBuorqzwcEKlQMmc3BBUpzd4O5aBJQYJMnxIuX+TxLHF+fPBf2wGy8A86B57m0xYVb+ZEHiEuIjWy6Ai7Fzj3NN0xrTNW8Zqz57JNXZCWEnGmK15zaoJTJwnB6lkBBOjwkRuuXYLs3f2XVaanmfqf9gRwYQkKSnforXrsIiK3WZSYBUoA+u2rJlDU1grrqW35kHD032WFAEToCsmHyJZAiozpwoNIZZx9GFXBYdZpoIYzd8QpEuXxqzIc8iP8ufbkc3vneLsOuGm0PQM1Z45Qg+RFcGVZuKpqdymFiN4O45+9RYc/vZS6TYUMQkU9WG2Ggyhx3GOexld8bZVM+8ayRiSAPe+zxMhMys5jZcaB9L208/BAYIE1D9c20V2B2Yxtx1vzwwfcL4wLG4lGzwuRQEWgn8mGJXXrbzAF8S40y3sGPP8KDxd7RbSO9L82lWGzYH6D1yzZy7qcflub2I++ZpQQj93SdEzsQS9p7GyDv+KJhBRVaM9PcYCTpVRg53CbLWcQxZWqViQaMHuWwvvBj2Is1/d4D9+R7FXXrvbIlDNbKpMXQeNqAIQOJkLD5hrfTVvychYpcUK8xlSB5kkjGApF5UcZsXn 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)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mae0fKFq1Ai7EwCYbXoEEmoEUMD/+o2B2GuV9TVVYB2bjR0nHEjbJFxajL/McWRFZrBQAf8NBimiYm2QaJm6osVnTl6u4gP/aUghZM/uxv5FLEgGNQ06iPBqcz3NfC+eSorC4XP9UJOrhvOdvMO/kvEdPDLVX4EAoxtYdEFDIp9p6fyOfJDscvi1GwMQXvh+xsQHnHq3cK2tXzOkjEOLVtUvEbZFz4z9ayRWNobUF1PL5IKejje9CcyLKjFtNHFmAlgvK5l00itGiS/0uAblZ4G2IMrDp1F6Ug/q/P3ITnHfrQWTsA/FGLI0lsV330Uyu7ctt06bKYjhheb+YiaOO0HBTWHpRv35R0xem2TzXa5A2xv0xQx8Gz9cBdl86vCUk1rvktLh97oF2Yn0RdSvjdc9HeYpPtuBfnO9hXEMIaDBwlK5qGceDRpTAurWFHIuAmkXm+bO5IbfD+zmWHPjV6UqEIBQZyNANvrYYtRdzucx/e7apj0+Kliz2J8ApfnVtcqdn3dmw8MGi66VUypFdOs9wqo4FqGj/p64BRZ7bJoX7H99YbsE1M3gYLf5yl7WVRSDrIcVfUClLpqkzDmvHtqHMJuMwkYfWtaMVZozVZ86J89+sq8DMMUX/4GI8T/bnfB8CmpqMwldYBu3mHozotF0iH0b4uRoN5JP/EE9eLIEmFCB3P/kvNXzH/c41ZLfGF1IQtg+G0K739IIDqezMINdsmHn83HKY5NQhUk263HOlKTEMdpRrEihaxFGcbxUL8jzbwT3XgHxD6zihYNoYynQqHxzMBp4N+3Wy6X5uA66pIJF5XG7TVFmmj+o0o7BajfX/5H461gprqc9MKZrFoefgvsE+Y6lTMiHBd8DQvENsQtaKFPhsmsHWwI8Dp2YZHi8FDibVV0XxBVIb7KYi/kQvlSp+cnNhVBUfnb7pXKiNlMD01YmYLEqKVASmg9BP38dXBSfmQlXyqvh4NTpydjTAqoKyumHqUkwZWh6wUB+rXvVscc4PmYKP5vfLyQo8H3WfgIiNX5FrQOKS/SKEJUUHfyWp9YozIRNAZOldODFVeibGJVFHNyNP3KJTopKpSzeRYrKgBCpun2rrnd4HmCEArAOg85NuVDuyBFysEN0mIlN3De5nfn4yS3I3eUNSpNgZij1yFukhR3vbRaQqdpsmM7u6FbH8NvaeoLpE16jCOwtNec9fITty2eyV/ttqd5dcyVC1/phRwLPmJySry1tcxcdIhR+oYB2JMCx8o+BXbuw0sFx/dspAPyJjqRqzTN/YbK6yZi8gVbcxsl+xlIqfq21lQ2Wn7Ik0OxdfQT+x95LBLDo3aZr1YngNFjjDBKpJse7NZVLeLpcC7AxoYUmJNdYIjVCiLKRK0X9s3Kk27jOIAhTB49irj0QlZqYtJK9WUa/yzpRqcGTxQsa7TaGl7IV1iwpMprxjidyfE2zh+ytAtN2ZJm70yf3b2wKI6cyQZzSAAfxDCr6isb9H4PY4s77s+JOHHKdDbvASCHZK8FDCHIVvIGUhbCsYjEjap8wNu8BrpGhyvo/TvAXtoyBsO+DkZnPuB3X+uS7e4ED39FCBO9sPiMGDG05myJdwiLukRJxn2JRkJ/QyHcH9A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 231e932c-5d4c-484d-2db4-08dd0561ac23 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:41.6904 (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: A2pc6ToCPwjXdct7J82gT01GYUWEz1yGlhct3Fn/ZJ7hcau2q9ktvWKktByy8x6+fZ+lXiXt1CAs7xPJeQDqPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8776 This adds public BAP helpers to convert iso_qos to bap_qos and reversed. This is needed for the BASS plugin to handle the Scan Delegator (BASS Server) role internally (to create/handle BAP streams when receiving the Add Source command from a Broadcast Assistant). --- profiles/audio/bap.c | 93 +++++++++++++++++++++++++------------------- profiles/audio/bap.h | 5 +++ 2 files changed, 58 insertions(+), 40 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index dbea59776..8635c383d 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1041,6 +1041,57 @@ static void print_ltv(size_t i, uint8_t l, uint8_t t, uint8_t *v, util_hexdump(' ', v, l, user_data, NULL); } +void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos, + struct bt_iso_qos *iso_qos) +{ + memset(iso_qos, 0, sizeof(*iso_qos)); + + iso_qos->bcast.big = bap_qos->bcast.big; + iso_qos->bcast.bis = bap_qos->bcast.bis; + iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor; + iso_qos->bcast.packing = bap_qos->bcast.packing; + iso_qos->bcast.framing = bap_qos->bcast.framing; + iso_qos->bcast.encryption = bap_qos->bcast.encryption; + if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base) + memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base, + bap_qos->bcast.bcode->iov_len); + iso_qos->bcast.options = bap_qos->bcast.options; + iso_qos->bcast.skip = bap_qos->bcast.skip; + iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout; + iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type; + iso_qos->bcast.mse = bap_qos->bcast.mse; + iso_qos->bcast.timeout = bap_qos->bcast.timeout; + memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos, + sizeof(struct bt_iso_io_qos)); +} + +void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos, + struct bt_bap_qos *bap_qos) +{ + bap_qos->bcast.big = iso_qos->bcast.big; + bap_qos->bcast.bis = iso_qos->bcast.bis; + bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor; + bap_qos->bcast.packing = iso_qos->bcast.packing; + bap_qos->bcast.framing = iso_qos->bcast.framing; + bap_qos->bcast.encryption = iso_qos->bcast.encryption; + if (bap_qos->bcast.encryption) + bap_qos->bcast.bcode = util_iov_new(iso_qos->bcast.bcode, + sizeof(iso_qos->bcast.bcode)); + bap_qos->bcast.options = iso_qos->bcast.options; + bap_qos->bcast.skip = iso_qos->bcast.skip; + bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout; + bap_qos->bcast.sync_cte_type = + iso_qos->bcast.sync_cte_type; + bap_qos->bcast.mse = iso_qos->bcast.mse; + bap_qos->bcast.timeout = iso_qos->bcast.timeout; + bap_qos->bcast.io_qos.interval = + iso_qos->bcast.in.interval; + bap_qos->bcast.io_qos.latency = iso_qos->bcast.in.latency; + bap_qos->bcast.io_qos.phy = iso_qos->bcast.in.phy; + bap_qos->bcast.io_qos.rtn = iso_qos->bcast.in.rtn; + bap_qos->bcast.io_qos.sdu = iso_qos->bcast.in.sdu; +} + static void create_stream_for_bis(struct bap_data *bap_data, struct bt_bap_pac *lpac, struct bt_iso_qos *qos, struct iovec *caps, struct iovec *meta, char *path) @@ -1050,28 +1101,7 @@ static void create_stream_for_bis(struct bap_data *bap_data, setup = setup_new(NULL); /* Create BAP QoS structure */ - setup->qos.bcast.big = qos->bcast.big; - setup->qos.bcast.bis = qos->bcast.bis; - setup->qos.bcast.sync_factor = qos->bcast.sync_factor; - setup->qos.bcast.packing = qos->bcast.packing; - setup->qos.bcast.framing = qos->bcast.framing; - setup->qos.bcast.encryption = qos->bcast.encryption; - if (setup->qos.bcast.encryption) - setup->qos.bcast.bcode = util_iov_new(qos->bcast.bcode, - sizeof(qos->bcast.bcode)); - setup->qos.bcast.options = qos->bcast.options; - setup->qos.bcast.skip = qos->bcast.skip; - setup->qos.bcast.sync_timeout = qos->bcast.sync_timeout; - setup->qos.bcast.sync_cte_type = - qos->bcast.sync_cte_type; - setup->qos.bcast.mse = qos->bcast.mse; - setup->qos.bcast.timeout = qos->bcast.timeout; - setup->qos.bcast.io_qos.interval = - qos->bcast.in.interval; - setup->qos.bcast.io_qos.latency = qos->bcast.in.latency; - setup->qos.bcast.io_qos.phy = qos->bcast.in.phy; - setup->qos.bcast.io_qos.rtn = qos->bcast.in.rtn; - setup->qos.bcast.io_qos.sdu = qos->bcast.in.sdu; + bap_iso_qos_to_bap_qos(qos, &setup->qos); queue_push_tail(bap_data->bcast_snks, setup); @@ -3160,24 +3190,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) queue_foreach(setups, setup_refresh_qos, NULL); /* Set the user requested QOS */ - memset(&qos, 0, sizeof(qos)); - qos.bcast.big = setup->qos.bcast.big; - qos.bcast.bis = setup->qos.bcast.bis; - qos.bcast.sync_factor = setup->qos.bcast.sync_factor; - qos.bcast.packing = setup->qos.bcast.packing; - qos.bcast.framing = setup->qos.bcast.framing; - qos.bcast.encryption = setup->qos.bcast.encryption; - if (setup->qos.bcast.bcode && setup->qos.bcast.bcode->iov_base) - memcpy(qos.bcast.bcode, setup->qos.bcast.bcode->iov_base, - setup->qos.bcast.bcode->iov_len); - qos.bcast.options = setup->qos.bcast.options; - qos.bcast.skip = setup->qos.bcast.skip; - qos.bcast.sync_timeout = setup->qos.bcast.sync_timeout; - qos.bcast.sync_cte_type = setup->qos.bcast.sync_cte_type; - qos.bcast.mse = setup->qos.bcast.mse; - qos.bcast.timeout = setup->qos.bcast.timeout; - memcpy(&qos.bcast.out, &setup->qos.bcast.io_qos, - sizeof(struct bt_iso_io_qos)); + bap_qos_to_iso_qos(&setup->qos, &qos); if (!bt_io_set(io, &err, BT_IO_OPT_QOS, &qos, diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h index 98bea558c..ab35a3775 100644 --- a/profiles/audio/bap.h +++ b/profiles/audio/bap.h @@ -19,3 +19,8 @@ void bap_scan_delegator_probe(struct btd_device *device); bool parse_base(struct bt_iso_base *base, struct bt_iso_qos *qos, util_debug_func_t func, bap_stream_cb_t handler, void *user_data); + +void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos, + struct bt_bap_qos *bap_qos); +void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos, + struct bt_iso_qos *iso_qos); From patchwork Fri Nov 15 10:38:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876086 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2069.outbound.protection.outlook.com [40.107.103.69]) (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 AEA5918FDDB for ; Fri, 15 Nov 2024 10:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667134; cv=fail; b=BSy0/w/pQSBMjEpfACALbd7DyFK6Fzx0beiIYHKmUDmNNbUOwTUbb662nAaR/F64tIEnX2Dwt8rjfL2yeTb4Ue9lO3t3kRA77vsrRcVtfR7V2O4VNu6P5bQJOUvgbeLwRH/RWXSiZLYJ3qTzLlrI54tb5RNtIMsUmiUOnvgvz6Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667134; c=relaxed/simple; bh=6sfnvi2UZ0xRsZkgqHHQvSmz09FVKeSj1ApvrOnSEBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Bq/WmdzlIa+kJMNaMuve7VchMoHl0WBvhdctjy/YksZZ0/+aauApcL+1GJn+yCObQacgbwisdoUxcRpCck5v9U0/kZPhu3FE3piE4Y81n1DbUZx1R9nlHK92Zwjh9+oehhbAu4sLOxYZmx61vhdCzJ/CQvgEHqSHyGHpvAlUv+o= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jzK1CXnF; arc=fail smtp.client-ip=40.107.103.69 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jzK1CXnF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bX0AhwgFpfXPAxCf9gVDJft7n7VeKtcZ3Xh5pPCN0Y9qvr4iNl6euQaFQt67I1gzhGQ1jwkIdJS+uwoV22X0/8wFjdPIs0peN600Aw13P7S5BbV2SAN4E3UC+rV1Uswbv7mDtyw/KYPx9hoiwCMU2YeAldiXXn5ofxpNrBcBOV+WZ/CsKGrqDtgn6NKuPw3Bs5sNvcFjfooTHjqKmF3FIyjzxkiEEAvtRkEGh3sP2KHkxR2xJr9oL7Dx/vFORfHtgg6viQFipI/3vLiOkKxzVfx8s3W+0klV88AUeQ5tDQ/o/sxeLSXLXV48+COzz22vNlC7nl4I0B9JI2agEclrEQ== 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=k4uugzXthhrM3auc+WFqqLF8g8zQF/FpSguKSElC1JU=; b=vxmPTy+Bm7T0pqmpDRVB6JB0K0hTwUu7SO4yvNkOtIMe+k2Z05WO/Kw+B//CViQF07yoyjyJrNgUY0CaUHG2iV+U6QKmEsum+x6RccCqqeON3zvX4WGaV4PSAMDZqNO3bde38ODJuuQlKEj11P9LPMRcniBUNTOlK4Al/rHfIYlBq9AJB9Bt+rtH22vyDOg795xOcWL7Bq3xBTVUq9Tkjx2fJvfak1gRzWZLepN4Db0kkgoBWiA0auGI3hMzq8pYyojklmKgnEkNTX52FGX8+7OEJGzKloTu1i/x+Y5ZBsQrkF9f3N/VTY3HdddewZ+vrsq/SDEthHONgllPvq+LDQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k4uugzXthhrM3auc+WFqqLF8g8zQF/FpSguKSElC1JU=; b=jzK1CXnFQNKpwVOVcWAKraz27Tur+dcZkI47k70Mz0HWIYwRLQyQmvPuyvIC8xoKjNcpVxveTtvw4AN0TLJRHxVjtBVaHtqCVX6e/iz3w8loWT1mj2pEgWpNSyF9pigrA/E/v+jo1+MoHicCvzypg5NhjpADa7+0Dxm14xKhY+fvMQnwq5nE/zvk/ycxVQDqUwPmA7no/cBaNhI4eOy5yDs5ErvEqoFOfhTPpe3DGfD2pXPEM49wbS6aifX+5YOZtha5J2UwISJfmVzhfobyIhUEYH38T7ClD6t5pa9ECDfmsxB0tRAxe2OZREgeqrQmfaf+R0b2SysqNXYwfFVIjQ== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Fri, 15 Nov 2024 10:38:44 +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.8158.017; Fri, 15 Nov 2024 10:38:44 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 4/6] bass: Rework Scan Delegator to handle BAP streams Date: Fri, 15 Nov 2024 12:38:22 +0200 Message-ID: <20241115103825.19761-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P251CA0006.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d2::15) 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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: db17b700-eb63-4fb4-c0fc-08dd0561ad93 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: grDarMHsC1s30I2iewWu/SGFVdCNHy28eTOueTVb3BAlyqLP1v7bnhg1iIBSw1qQGNzxVZpk7wwCaQAcooVTIBbikXYpzNzHa/MVqjGYdiPRxH6/Z6dxB0sz4YGt0E63AcRlmtLhZ4n2lo4KYMFV+lc7QrkHGCmAV75XAnkOKyktaAbjXd3Vr1/A7GYiOYISJrElCSjXcKXG+GKOV8tG6lU2M3QIsgg0SaVTOMi8PyDYbvwnwPfjC1fQSKQ3f2VyVztylboP8YG5uS+Qxb1jir5GxPNYtnp7gsz2zthcWXLqKBN5KqHQ+hE/dPdsHF81XydO9pa1KPN08b2ThZW79mRIDGjsRUfhtZ6ostJVLoBKnG6Uj2GmXA594lXIll+832ax/1qzi5GdQb7syN9z8moT41ZXeIKriDDccRxIcA8Z/DuvqYSb1tY9bi0d+BSRRg7LT4Uoq5HCZ68a4Nr3VLelt6kJmtW/j4Wvv+orrPzwLsRq8Y8gvQFpqU8Hy/t7PEYbpVIGe9OubVUV5GAlEc69+VckR8zCPo08bUqSvk23elNojhCyP4P5f4GnqToK62VqybbYt48uI3OtRK4hWFKxDUOnthXz6+j6W1/DGhseFNwE/RMvHt9JziKdCvmCHlK1FT0mXPVZSam8lUifPRXbs7zwEtRoSbH7zj2LI4+K5KBuqM9tIpO5N6QoIZ+5IYui5sYLevKJK0ovAOOyv2Qpm9SWJ1t0Xv7kXjsOvZ3uCTuQdhCY6HR1Y2zPcEYFhhERdN8HvOV4l+iBG95LC59QTuQ3cj9Vuda2nDvoXFJbMWGP4aDGEnt8PqvSkOdbMQ78Wk4K2FnMF7NdjIsu+Xaq+tbi9maovvOjzsrPrS3zM6gl6haUCsVA7NFNzOqlhgCEfGGbSgJmpYOjQm5NNFM2TqKTFiTryhiK/bnDmCOV1lhRaM2fA6rs/cpDIzkfcNlC6brwZE8keT+AGprvJExcPwdudYigzFmMRwQ4oVO1u6BcITw0wfZCwusGXFYdxKZ7e/iE2poUPM6hcylxCzxlNUidThCePhCOhSCfx0liXkiB/Y7BcosRWZlhanHXCQRC8QCZkMMNp4hAYplEtw/iGrsVfC2CMCFIOmAF0OsUFY9hIDjjysaYFiHFlWNPZg8m7dfmrH31Bdw3NeXkjh7CtuJI6REBTgMZ8etLHPEMleYZ27hRZ7jFIbUjzL6Q9+fgFf4MNAx/WTgJYHbSr2ZpXPlZW6bpiVmMCMCa8yTPUJ6WPs9GW9/icIOx/WUhQTV0l97ngqoJtF2/y+rD+DcwJfTLKCr2+/2t9B5HsL/UvokanV8VOd9TrzTTLv0d 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: Y/NoeF2Taa7HCCqSHw3SvrdKHitolJTqgAQu2ogwB0KY+SX12o7UUwbQ4N14Oeg7JqGG/I5xCqAv/9kxmpiESlpq3A0eFX+Q3ylQDX9uGZ9P+wcwGR4m44R3/iw9HBNVAX0vqVWBDWMf3wlg20Ulm3T9O28b/M2v3GMDy1b6zLMO9Tj+v2b/lQlbM+yXryInsqxfqoPdG1YeuA3jp58bEVGPxC51DH+xZ+phfIQrHLlAfh7d0ZgrmxeIHfdXO7Xp8SYZPosQAdJ6pm8Y2013xUw88PgnSWUhoEq1UoTF4Ql6VU2k71E4I4zZNPaztcTQrQeRF/aWvW6uIF7oBPVEnDJl5eiqwTaeTsR/SnaRiNvtPbtnqUiF/XKUVR0pQkpRzIghzdmui3tdsfbgJWOAlnDboqMf8hkDCXfs76eNO9s54AvtXPhlW/EzsYqsKOdo3Xp19ecoC5wogeL+cND0GdRnhVphdIoiqlyx2BDzTZ6w5AjeacCdKEQsR5M/haeE/jpTbdjbQFkruC9Xj4sJLUL7CQw6wLcoyE1wNHkjysP2DEtOsJ5YzsH/Ccc9MkTgNsRLyvrS6z2fE3gTF/hggNFRBdbf5CpjB+YO9a2zKLfeM/9htAqGJKq0wGUKsWnEG1Olcsw4PX/J3PtK3HkqLJeQZIaa/kw0JRzlEC00Vwrz29Xzz48rKoqhPpkqGXlWZCwbsdTepZaS+RBQyW0xnWvhk7vMEkP9hVxGmMd8RX5Xo5j2C6YC0IRHRrYjs8OR3fajA5WxikFKGC76Ublf9SFkMX7pWkSt1Kw7PUIj9tuWTklRrPTS547gtDr1qEAvgQj0k8uQwZ20+yf/ZtTi2X5COeRa6kwVHJWXcBRV0EkJNEFhK72dkMvNrjObC5AfXL6EMWCw9GJ8u+n9Ab/qPAOyFTStdKVMvdb/UFgoFOwijS6jhZpQOVOJws1ztzI3uyjFi3DhP3cVs92jKCwDO89Gxv64HeOtVB5mHrayvRIxyTwM93iP8IzDDgBo0xV8yEHf+C9QHw3U5OfcNSwKtfgZTVoYlo3z7Md9mSQ4tgEFTDuXOFemPHGsXLF3LWk2uT9XiQn0iNbjT1/Gfkz0Z1VUDnmf8/VHHQdeDSIOUUdF7w9W0U/wHlV9hH22d7nXhCZ0PmrzFxVHrdIOclz+GVd3QdKbJS3soivmXU1c+1/NnONZCQu5x2Ogl8wrLP+Pop9VCLyRufHuIQeIOuEEeQ6wAjnJj2m8cD6N6zx23w4rdmOjX4qqSkjW9cEkXLfyM2ExuKExH92dXBinRwsn5a1cugZ7EOWUxYOOlwzTg7NZUKbhftfbkobNP0rGV1KGgphAlfhZfRVmAv/uzkHfw5kbdLTHDjpr+eVWgIiSpga61/xGx7cYqfgmzYdetpfl+RKVK27/t6aSorMtjWzq0UYxftJJ9AAWWNOa+MCV4BXnMR0t5wpUpkak/TRa+kzU5psS5fA2ZyKvnEHyqRAubR2Gwm/mBSs+flgxDM8LVXnD8RsYgqy2K0GXpfw7euqI/JPebcUsl7EHWlzaTChJSuxEZIvESbpR54ZdOHEj42wgciU5OPDjhMW7d/FYamWqLkxyhy68ml/k4BJcQxxYnQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: db17b700-eb63-4fb4-c0fc-08dd0561ad93 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:44.1702 (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: nJw18SHWkWHW+BrO8hj+HoInh1GLcEdh/ebJNT8HaSo79IsuY2FS2BKkWl+ZipXyQvS+1zHd9blmv29o7aYYOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 This updates the Scan Delegator implementation to be handled internally in BASS: The BASS Server is responsible to handle Write Commands for the Add Source operation by creating long-lived PA sync, parsing the BASE, creating and configuring BAP streams, as well as enabling them. --- profiles/audio/bap.c | 18 ++- profiles/audio/bass.c | 264 ++++++++++++++++++++++++++++++++++++------ profiles/audio/bass.h | 4 +- 3 files changed, 237 insertions(+), 49 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 8635c383d..6e6d68b57 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1125,14 +1125,6 @@ static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, bass_add_stream(data->device, meta, caps, qos, sgrp, bis); - if (!bass_check_bis(data->device, bis)) - /* If this Broadcast Sink is acting as a Scan - * Delegator, only attempt to create streams - * for the BISes required by the peer Broadcast - * Assistant. - */ - return; - /* Check if this BIS matches any local PAC */ bt_bap_verify_bis(data->bap, bis, caps, &lpac); @@ -1325,9 +1317,6 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, g_io_channel_shutdown(io, TRUE, NULL); } - /* Notify the BASS plugin about the session. */ - bass_bcast_probe(data->device, data->bap); - /* Analyze received BASE data and create remote media endpoints for each * BIS matching our capabilities */ @@ -2729,6 +2718,8 @@ static void bap_state_bcast_sink(struct bt_bap_stream *stream, return; setup = bap_find_setup_by_stream(data, stream); + if (!setup) + return; switch (new_state) { case BT_BAP_STREAM_STATE_IDLE: @@ -3276,6 +3267,7 @@ static int bap_bcast_probe(struct btd_service *service) struct bap_bcast_pa_req *req; uint8_t type = BAP_PA_LONG_REQ; struct bap_data *data; + int ret = 0; if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET)) { error("BAP requires ISO Socket which is not enabled"); @@ -3329,6 +3321,10 @@ static int bap_bcast_probe(struct btd_service *service) bt_bap_set_user_data(data->bap, service); + if (bass_bcast_probe(service, &ret)) + /* Return if probed device was handled inside BASS. */ + return ret; + /* Start the PA timer if it hasn't been started yet */ if (data->adapter->pa_timer_id == 0) data->adapter->pa_timer_id = g_timeout_add_seconds( diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index 6237f5acc..e53241a1a 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -29,6 +29,7 @@ #include "lib/bluetooth.h" #include "lib/uuid.h" +#include "lib/iso.h" #include "src/dbus-common.h" #include "src/shared/util.h" @@ -42,6 +43,7 @@ #include "src/shared/bap.h" #include "src/shared/ad.h" +#include "btio/btio.h" #include "src/plugin.h" #include "src/gatt-database.h" #include "src/device.h" @@ -101,12 +103,16 @@ struct bass_assistant { struct bass_delegator { struct btd_device *device; /* Broadcast source device */ + struct btd_service *service; struct bt_bcast_src *src; struct bt_bap *bap; unsigned int state_id; uint8_t *bcode; unsigned int timeout; struct queue *bcode_reqs; + struct queue *streams; + unsigned int io_id; + GIOChannel *io; }; struct bass_bcode_req { @@ -218,18 +224,58 @@ static bool delegator_match_device(const void *data, const void *match_data) return dg->device == device; } -bool bass_check_bis(struct btd_device *device, uint8_t bis) +static int stream_get_bis(struct bt_bap_stream *stream) { - struct bass_delegator *dg; + char *path = bt_bap_stream_get_user_data(stream); + const char *strbis; + int bis; - dg = queue_find(delegators, delegator_match_device, device); - if (!dg) - return true; + strbis = strstr(path, "/bis"); + if (!strbis) + return 0; - if (!bt_bass_check_bis(dg->src, bis)) - return false; + if (sscanf(strbis, "/bis%d", &bis) < 0) + return 0; - return true; + return bis; +} + +static void append_stream(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct sockaddr_iso_bc *addr = user_data; + uint8_t bis = stream_get_bis(stream); + + DBG("%d", bis); + + addr->bc_bis[addr->bc_num_bis] = bis; + addr->bc_num_bis++; +} + +static bool link_io_unset(const void *data, const void *match_data) +{ + struct bt_bap_stream *link = (struct bt_bap_stream *)data; + + return !bt_bap_stream_get_io(link); +} + +static void connect_cb(GIOChannel *io, GError *err, void *user_data) +{ + struct bt_bap_stream *stream = user_data; + struct queue *links = bt_bap_stream_io_get_links(stream); + int fd; + + DBG(""); + + /* Set fds for the stream and all its links. */ + if (bt_bap_stream_get_io(stream)) + stream = queue_find(links, link_io_unset, NULL); + + fd = g_io_channel_unix_get_fd(io); + + if (bt_bap_stream_set_io(stream, fd)) { + g_io_channel_set_close_on_unref(io, FALSE); + } } static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, @@ -237,31 +283,54 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, { struct bass_delegator *dg = user_data; int bis; - char *path = bt_bap_stream_get_user_data(stream); struct bt_bap *bap = bt_bap_stream_get_session(stream); - const char *strbis; - int err; + struct sockaddr_iso_bc iso_bc_addr = {0}; + struct queue *links; + GError *gerr = NULL; + struct bt_bap_qos *bap_qos = bt_bap_stream_get_qos(stream); + struct bt_iso_qos qos; if (dg->bap != bap) return; - strbis = strstr(path, "/bis"); - if (strbis == NULL) { - DBG("bis index cannot be found"); - return; - } - - err = sscanf(strbis, "/bis%d", &bis); - if (err < 0) { - DBG("sscanf error"); - return; - } + bis = stream_get_bis(stream); DBG("stream %p: %s(%u) -> %s(%u)", stream, bt_bap_stream_statestr(old_state), old_state, bt_bap_stream_statestr(new_state), new_state); switch (new_state) { + case BT_BAP_STREAM_STATE_ENABLING: + iso_bc_addr.bc_bdaddr_type = + btd_device_get_bdaddr_type(dg->device); + memcpy(&iso_bc_addr.bc_bdaddr, device_get_address(dg->device), + sizeof(bdaddr_t)); + + append_stream(stream, &iso_bc_addr); + + links = bt_bap_stream_io_get_links(stream); + + queue_foreach(links, append_stream, &iso_bc_addr); + + bap_qos_to_iso_qos(bap_qos, &qos); + + if (!bt_io_set(dg->io, &gerr, + BT_IO_OPT_QOS, &qos, + BT_IO_OPT_INVALID)) { + error("bt_io_set: %s", gerr->message); + g_error_free(gerr); + break; + } + + if (!bt_io_bcast_accept(dg->io, + connect_cb, stream, NULL, &gerr, + BT_IO_OPT_ISO_BC_NUM_BIS, + iso_bc_addr.bc_num_bis, BT_IO_OPT_ISO_BC_BIS, + iso_bc_addr.bc_bis, BT_IO_OPT_INVALID)) { + error("bt_io_bcast_accept: %s", gerr->message); + g_error_free(gerr); + } + break; case BT_BAP_STREAM_STATE_STREAMING: /* BAP stream was started. Mark BIS index as synced inside the * Broadcast Receive State characteristic and notify peers about @@ -280,17 +349,79 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, } } -bool bass_bcast_probe(struct btd_device *device, struct bt_bap *bap) +static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, + struct iovec *meta, struct bt_iso_qos *qos, void *user_data) { - struct bass_delegator *dg; + struct bass_delegator *dg = user_data; + struct bt_bap_pac *lpac; + char *path; + struct bt_bap_stream *stream; + struct bt_bap_qos bap_qos = {0}; - dg = queue_find(delegators, delegator_match_device, device); - if (!dg) - return false; + /* Only handle streams required by the Brodcast Assistant. */ + if (!bt_bass_check_bis(dg->src, bis)) + return; - DBG("%p", dg); + /* Check if this stream caps match any local PAC */ + bt_bap_verify_bis(dg->bap, bis, caps, &lpac); + if (!lpac) + return; + + if (asprintf(&path, "%s/bis%d", device_get_path(dg->device), bis) < 0) + return; + + bap_iso_qos_to_bap_qos(qos, &bap_qos); + + stream = bt_bap_stream_new(dg->bap, lpac, NULL, &bap_qos, caps); + if (!stream) + return; + + queue_push_tail(dg->streams, stream); + + bt_bap_stream_set_user_data(stream, path); + bt_bap_stream_config(stream, &bap_qos, + caps, NULL, NULL); + bt_bap_stream_metadata(stream, meta, + NULL, NULL); +} + +static gboolean big_info_cb(GIOChannel *io, GIOCondition cond, + gpointer user_data) +{ + struct bass_delegator *dg = user_data; + GError *err = NULL; + struct bt_iso_base base; + struct bt_iso_qos qos; + + dg->io_id = 0; + + bt_io_get(io, &err, + BT_IO_OPT_BASE, &base, + BT_IO_OPT_QOS, &qos, + BT_IO_OPT_INVALID); + if (err) { + error("%s", err->message); + g_error_free(err); + return FALSE; + } + + parse_base(&base, &qos, bass_debug, bis_handler, dg); + + return FALSE; +} + +static void confirm_cb(GIOChannel *io, void *user_data) +{ + struct bass_delegator *dg = user_data; + + DBG(""); - dg->bap = bap; + /* Close the listen io */ + g_io_channel_shutdown(dg->io, TRUE, NULL); + g_io_channel_unref(dg->io); + + g_io_channel_ref(io); + dg->io = io; /* Update Broadcast Receive State characteristic value and notify * peers. @@ -298,15 +429,64 @@ bool bass_bcast_probe(struct btd_device *device, struct bt_bap *bap) if (bt_bass_set_pa_sync(dg->src, BT_BASS_SYNCHRONIZED_TO_PA)) DBG("Failed to update Broadcast Receive State characteristic"); - /* Register BAP stream state changed callback, to keep up to - * date with BIG/PA sync state. - */ - dg->state_id = bt_bap_state_register(bap, bap_state_changed, + /* Register BAP stream state changed callback. */ + dg->state_id = bt_bap_state_register(dg->bap, bap_state_changed, NULL, dg, NULL); + dg->io_id = g_io_add_watch(io, G_IO_OUT, big_info_cb, dg); +} + +bool bass_bcast_probe(struct btd_service *service, int *ret) +{ + struct btd_device *device = btd_service_get_device(service); + struct btd_adapter *adapter = device_get_adapter(device); + struct bass_delegator *dg; + GError *err = NULL; + + dg = queue_find(delegators, delegator_match_device, device); + if (!dg) + /* Only probe devices added via Broadcast Assistants */ + return false; + + if (dg->service) { + /* Service has already been probed */ + *ret = -EINVAL; + return true; + } + + dg->service = service; + dg->bap = bap_get_session(device); + + dg->io = bt_io_listen(NULL, confirm_cb, dg, + NULL, &err, + BT_IO_OPT_SOURCE_BDADDR, + btd_adapter_get_address(adapter), + BT_IO_OPT_SOURCE_TYPE, + btd_adapter_get_address_type(adapter), + BT_IO_OPT_DEST_BDADDR, + device_get_address(device), + BT_IO_OPT_DEST_TYPE, + btd_device_get_bdaddr_type(device), + BT_IO_OPT_MODE, BT_IO_MODE_ISO, + BT_IO_OPT_QOS, &bap_sink_pa_qos, + BT_IO_OPT_INVALID); + if (!dg->io) { + error("%s", err->message); + *ret = -err->code; + g_error_free(err); + } + return true; } +static void stream_clear(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct bass_delegator *dg = user_data; + + bt_bass_clear_bis_sync(dg->src, stream_get_bis(stream)); +} + bool bass_bcast_remove(struct btd_device *device) { struct bass_delegator *dg; @@ -317,6 +497,17 @@ bool bass_bcast_remove(struct btd_device *device) DBG("%p", dg); + if (dg->io_id) + g_source_remove(dg->io_id); + + if (dg->io) { + g_io_channel_shutdown(dg->io, TRUE, NULL); + g_io_channel_unref(dg->io); + } + + queue_foreach(dg->streams, stream_clear, dg); + queue_destroy(dg->streams, NULL); + /* Update Broadcast Receive State characteristic value and notify * peers. */ @@ -895,6 +1086,7 @@ probe: dg->device = device; dg->src = bcast_src; dg->bcode_reqs = queue_new(); + dg->streams = queue_new(); if (!delegators) delegators = queue_new(); @@ -903,8 +1095,10 @@ probe: DBG("delegator %p", dg); - /* Probe device with BAP. */ - bap_scan_delegator_probe(device); + /* Add Broadcast Audio Announcement Service UUID + * to device and probe service. + */ + btd_device_add_uuid(device, BCAAS_UUID_STR); return 0; } diff --git a/profiles/audio/bass.h b/profiles/audio/bass.h index 257346374..f299ac029 100644 --- a/profiles/audio/bass.h +++ b/profiles/audio/bass.h @@ -12,11 +12,9 @@ void bass_add_stream(struct btd_device *device, struct iovec *meta, uint8_t sgrp, uint8_t bis); void bass_remove_stream(struct btd_device *device); -bool bass_bcast_probe(struct btd_device *device, struct bt_bap *bap); +bool bass_bcast_probe(struct btd_service *service, int *ret); bool bass_bcast_remove(struct btd_device *device); -bool bass_check_bis(struct btd_device *device, uint8_t bis); - typedef void (*bt_bass_bcode_func_t)(void *user_data, int err); void bass_req_bcode(struct bt_bap_stream *stream, From patchwork Fri Nov 15 10:38:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876087 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2069.outbound.protection.outlook.com [40.107.103.69]) (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 760AC1B4F0A for ; Fri, 15 Nov 2024 10:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667136; cv=fail; b=X3+la+ZT0M5+kYHCREZ0pzqDg5rA7Wp/K4ncpE1maQYTkkkVuBA72y6MrHwcOlb1A2mVAObHSPVcvqYrjc7/GZWVRnvqybS6pt86/ukLzgYXl78hlqwZMe62n1YSkTLK97pRRnrxWuahwlIbtgp1XNVQKtMyFp54xXtVLwxh8+k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667136; c=relaxed/simple; bh=8VRRDDqWJbHZdqKdE8wHxfNNEAtsVAla0U9wt1vAy/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=fxM5Jzof1PMjO3F+b3ZeKOjuR/deN59mrlBtxKz8r3GnmTRSWbXPzsa2iSEBdrZeZS2srKJLt6/MwL15Cbg/5Vn8duGVflPX//NBJ+ubLblMy9KzgRmLhLqbQt+I+zh4wEufL59kadZYvl2yMgdxgVrCvM59AAkF8oaGI6s04NM= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=DjiEqWnz; arc=fail smtp.client-ip=40.107.103.69 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="DjiEqWnz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TKekTL8f1vK66e2HAoO4v7e79YFkq5BU7DB2WRYiB3k4TpEDrbLX3VZV5SlObLY5v23OPXvNhYKtIeiXls269U9nnqmA1/0R71iGljMeLZHLA0xUDD4XI3vyYkyEXbP01J6gbxa5LbjbcGr/GVYBhT18AqQ9574w7DHbfgHXZpVTcWGeqSqEhrbL24DkMY9L9uYY9b9TOEIvUdtPOjQojSG9G+f6kvVoqCEJWwYNPpS7qUd5jHG5Z2XKzg1QN9VIn1ROgW2E7jHBWzJ1fRfqgkl0QNr97tFziLtzeycbXXA/l2kHEPwVSsUcUPN5s10HCDE0lcVb4+AzoLNeddSfjQ== 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=ufiPlQTYggn4c0tX4VUTv5Gs/X5GrATCzSRQjzKg3RA=; b=hKHh/xXCUzNe0GDGMPw2sM8pZFXjJU081mR2UaBZ3VMomeKG8YiDTKh9FwXYcZ1OwKFDWWFY0BzZA8B9gXGE5wu1rUbnYUtrsBY3kZXypZx2tT0NRNHUnMByUd4YXKoEFBsN+VP8bCtq1IKrf3duFfmYdVzkuXhaDhvKWh52PpCrPwnAkZcmzfTomYVUWr4BKyv1DCl0FbwiUr8KvzvMBz6mKdef6kUFQLsXDj7B5vOGo0c0VbOl+yH08bJo+5OJnvo8U8hQvlCxYy3/fW6zyr9J3FzQOxxkqaSJqLuPJkpOPJoAiDtqK0yPjAojBFRbXi7u4oktc6X9PbLhDOMdtA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ufiPlQTYggn4c0tX4VUTv5Gs/X5GrATCzSRQjzKg3RA=; b=DjiEqWnzNM0ugV2U21K8BVX4pS3DzYkxjvWph3xPXg75c06JsZ1ewyIl+CRbl9PK8LxaDi10VrA50CPVIx90RW9javg9bejtoturk698t5dzEOVsWUGhpCB8NOcRYpcXu0BG+kxnGMKynXnPk0BF1QnBVJhav0oh7+6qDVgrUdOnulTnyeXNVWfa1UGvFsOD6JPG0faUEQnM8cCEaEmVKzGthhXh6odo8euL/+G2i0tuZ1e6oqL9IHgJW3EY5IVzvPJXxuiYFPKDBLegfUSu1FhX9j1Y80tQ723CNk6xsZKLw5jAhRNHEZcIcz+mha7zS0kV9vj797T2DNZIKFSB3Q== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Fri, 15 Nov 2024 10:38:51 +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.8158.017; Fri, 15 Nov 2024 10:38:47 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 5/6] bap: Remove API to probe device from BASS Date: Fri, 15 Nov 2024 12:38:23 +0200 Message-ID: <20241115103825.19761-6-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P189CA0025.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::15) 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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 817bd181-6d31-40e2-4bd4-08dd0561aef0 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: ofwe1jNVBX0UChbGdfCtqjMwCM17qMf0+lCkHK9KzSkHfgdxoBsu9nZO0qdiuKL4jwOglTv9F5lU0alG2rQ+0M/V06T5D1pi4po+dVumowjVWMPJtxpjxiKnFmsh6+rAvo7jbiHDo24T4cdKIXxm6godcigDJ64mev7NQ5FoaRvcE5FBl/ZV8k3IrjTeexgW13izbtRA+bXTEHgFS7j6FwjmXRPmJTtcHHwdBejraIFyjVLIIh/aqLkSaUZtZhI01rUOMz+iivvgPcDshDa1sTDyr9tkOsEJnbf2Ap+B6XZCJMESjgRNwhWBbUYMws/an1LxPmOVrh2nWaK4N8yvef4OUC/lJRoZOobaF/h//MuyOwyTAvtSTsbdppU2RTaBFz3trIHPPKBpTNfTwYk+q7p9hfFwaSonhPknh13IgFfQCw2Ga7fA4eIjPVDgh+WePHmLq27luPTb3Arzml+4GY8LHotxQdVSfWfyN+8pmXaU5W7jh68Pxua842lEtMwRcluc7xplXX/0OFp+pgDs6dcBfys3iW5s9IATNRgPIhfzMUjaon/3uyJcgRfjTW7yMLsWlfnPy86GwK2wrPLDd6+VzYrDxViqp1jSJS09hLNO+O8zIVvUPaEDXJNWTwCDNfSVdbuexWyJyDNbQ29c8xzy1d93liKNLnf8zcg1FKxqmyhAJ+T3iXPJfeYHUULiOrKScJYRtXjLcVeeulTysSrHvU6CDREL5/BJxQ70Ey/Io8LlbmjJGrL2NrerlcwzPzyaHOyWSjI9/zWjDn30Y2kxinR+HHbLStRAHnzWy6FV5TTWHNLo7t2ruwXWoRSI+NA37aga6BF1PXm3bvtWjEEPLuSo2mF2rFZMtnBhR1iEV8pkcn3Rj4eoOfis7xjQ85RZG2e20EeUL4jwORay4dVxd4z2oT8a3515oB3MRLSGYC4mvVc2tAmYxROM4HVqIPYWW+PBqOVYrjkdpHqReosVMvedhS9vuD/4YpPk62dEneZakpErbuSmvPP63mKjgH36X3E8pgTDKR6koqZDtAIukP2ADivuwbV+Fwf7Ge0ojQnHRdj5f7CvODy3LfYRhbF8mF4Qiar4SWYR9QjyXu3qVQ9IknrjCVwg3b+WkLzjD4lW2ULVXvuQFsjvFY/QZQnAj3hEEbqdUoHTWpGGTLodVldW3V5KI6ldC3GFaGZvuTS/2/D6QHl5CVFVK/F+T8Vh9p2ayEOhBq3MfkhPI+tEEb2vs2iOW66i/cnXpD8GvsqRf3d1ggX4yga5a65UlTukYrrAbiy9FH+SUWCG0ZXHI5pOxJTX5L9WCcpbkA7EF1jBxOlxc6l0hq23HYIC 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: j83qDo3sJ2JKl6D9jaC3+q1GYmzMiGQnXrQb4up2FIAHZq9ajFI+9Ir/IfZ1PQK3kGwajUo+IxPaswicCgjaP8tv/+ISYpFYi1SfLbMU/i+SXu789Nnom3dygMwFctOQx0M9NspW9DWieal+9thj+bnwAURzZHu3xtvvGobEjm/6iRFacHwXcyndFrjq7QZGaSCuNfGOmG6qqrS9jxsWZ2nrqrV0IfL+H96ZhLn8eUFkGYRc+UVBrmifa2XtiZ8/rLxUnZ8NeaUQEt+j8cD80kFNisw/Yg34R/exvSJb8QED+Wko+41fEaGw31n7OV0TaiUBUU2/avX3pzOIjVZGzPoyXVZvPAun6kWmH5w22bP1YX5IpymtnJgo2DRvDa0t4CPshYnhLo0MtYBMC6dD4TGnsyFF1l1d6xPamS8MitD1t/jumrX8r/ONnu0NYBgtF8jgqF3mXZuH/E0n/WLj/9ttMNIHNDcCuqM3avaqGtt0qk7hu5+mlJeN6WYihfxX9hjZEvqoQIaRfLlM4IyEAop8uS6rT50atcf72zqxDVv6IfrDYl0J8iLavWbEbuD9g60gdA3wNYd/ws9fE94UWbiG1SfxbC2fq4cHPjZGDHQ+P2MMWoUyYx04jmGuX91XkN+Vn0oshU4d4N5B97GUo5cDuHt91iyYCc2y2C9osHOJjF0Per8ojNVb/HZyyf+1Pb+YElXCG25V9IAoIexkjX+69ylIEEX87pd3qRf2LvikXPjFembqe+FC7fAykrBpGPoSNYzllu4tQto+B0AX9TkapBFeQo/ueNlFd2ti8zX5AtUkZE81Addc8rRlJrxlC7vykLussyLy1nXVvbMUJ6GjPWx3UoHrY6MIy2F/O5V1HOGqU32d+9FUXPZjOLj719D2HwO5iTdkWPDfhQzsvOPxVTEMqeptSEJhQ3j1Uy6g+lrYrEQ+tq9ce5c9udxoISnfaHQsVdWac7UhPj7DPK7VBdZGMaIfuW+6FDT+Ch64g4rFqDA7bsRI7RU/XVDMoGRzWzn1JzqBOEkIs8FtLiaF/CbLnBmaDRg03BeF3DAVAQnHJ4NWN6yIxEXEkwzjoLM9n6tegJUED1oPbLp/zUyFkkfYC6gahiCailL7GXPGIZqTtW4zw9fBDbMXss8GCO0P7BM1jJCgkeLae07OYcIZcdmR3MB2BYEk4IxF7T1IipUsJAHbuCuvTHxhX86fS2Ptqa3eRJFPYBbJm4Kk2xWpYhYRUyuyYGjG5vIX5e1Lm+V1+pVJf0GYnXgx5XFQsoqXuyCSYsQkXflKg3v5Zqyu38JczKwoyrEFM5AElItVvph3XCtoSZyW/+73BPpd0lfmYRdWw+O6ejeTAjpgeTwS2tqLOCGk77TqYNINPE0ltFU/LbRhfDtLJDWMZYl0dEPFp7zvAwri8kzWUWTlP8VLqLu9lpSoJ6io1BM/zrfeJAUHWnRprMKy/JUq7Iz6IWTis68gLCkTgZSnBeonKb38j8ODXWL2s/XkDYC7UyRgXcu25BCOmMQDgM/5gjMd+zL+dvPzpAySqV6xG0ldv/0nCp9U2NcRhw6nqr072ODKwmAQg2m+vPfSpGEwAo1gmz1D0psDRvlIlvIAM18G1A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 817bd181-6d31-40e2-4bd4-08dd0561aef0 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:46.4080 (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: qO6IK3oiUpxVjD1fiPRZuO0l5h3DZfl5L1dfzZF66i8/GTrAmR4b+Wx0Ip/q3IqgosjumYDpG7aR6C7HVHdX6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 This removes the BAP API to probe broadcasters from BASS, since BASS is now directly adding the Broadcast Audio Announcement Service UUID to the broadcaster device, and it will internally handle the probe. --- profiles/audio/bap.c | 16 ---------------- profiles/audio/bap.h | 1 - 2 files changed, 17 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 6e6d68b57..beab85cff 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -3243,22 +3243,6 @@ static bool match_bap_adapter(const void *data, const void *match_data) return adapter->adapter == match_data; } -void bap_scan_delegator_probe(struct btd_device *device) -{ - struct bap_data *data; - - /* Create BAP session for the Broadcaster device */ - data = bap_data_new(device); - data->device = device; - - bap_data_add(data); - - /* Add Broadcast Audio Announcement Service UUID - * to device and probe service. - */ - btd_device_add_uuid(device, BCAAS_UUID_STR); -} - static int bap_bcast_probe(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h index ab35a3775..d91cada45 100644 --- a/profiles/audio/bap.h +++ b/profiles/audio/bap.h @@ -14,7 +14,6 @@ typedef void (*bap_stream_cb_t)(uint8_t bis, uint8_t sgrp, extern struct bt_iso_qos bap_sink_pa_qos; struct bt_bap *bap_get_session(struct btd_device *device); -void bap_scan_delegator_probe(struct btd_device *device); bool parse_base(struct bt_iso_base *base, struct bt_iso_qos *qos, util_debug_func_t func, bap_stream_cb_t handler, From patchwork Fri Nov 15 10:38:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13876088 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2069.outbound.protection.outlook.com [40.107.103.69]) (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 8F1891B4F0D for ; Fri, 15 Nov 2024 10:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667139; cv=fail; b=DIiYuJdqq8jZ9ay1kwdJoJqzdc3oo5pAscqYZlvjnjmDsRgYuH9gdn0ZnZ6bE/iU108ZICvN1BY05laoyAbBLB3zSGsm2TYKVKr9AOZDNTnyt28us3FXJRvK6QF+WQ9MrclFeYtav0NFV0hSN3Zp/reBOLMCY6vbtCfuQ7jvVN0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731667139; c=relaxed/simple; bh=DaEyLzGrhJKD5UOukuCqfbFY+vb5x4iXX3w7Ro/bBnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=MqPS4KmveurK1XTqN93MaR4KLpHV3f/Wo803niJjJbUWFZvTG2v5V9KCc5rXoYnY3/W01RJ+EU+tbHIDSulLHk01LOLxde52rD3vGvK5I3X+La9h8uH/GG09HuctKOLjQ7xT72VmqK/4lWA0U1ywj0ZoEjJeRLtJ8SDOyO0Hd7A= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=P625B4xK; arc=fail smtp.client-ip=40.107.103.69 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="P625B4xK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BabBo9f4KUtSE6WG1qKfDavRSL7tspdcRdx65L5dVJ4N9PQJ/zbke3gnF1/ZXy8Smrc6acVczpy55mGXFzbHrC0FoftPdTgdwqWnIVMYF7YcpwJdtocvhug3qVqDgHJTwtE1wG6CCZnRlpgFIvgpG1exmXrQVFf3DiSOHJIAVTJQelTh/gnA0v3OhLlJ3aCWRpl6vekvWfOva+DnUkrjdGmiWJDxXCeOyDIAca67zTZwFYuCGYdy+bZmf+Xu5WpqJyC7lKQP3E8oNk5ClzUNSsa3szAr4+5G/Mr/A5TkM3p/SsJ32DMzqTQTZAbNQwJdigUObnagBvzoNm2cVfzgUw== 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=AyUGRdJgN2J8d/rVi2mbRLQ+UUB/Xe8ctafwKJyA4M4=; b=gZe3osiTqHCgU80Um9U9CUVCGzpC/OeoMvcsJCP8z6PD0qgW/XGB5j/5q/r7K8FWNnAwtL5XSYXi/XZy1KGqzyeC6eu4ziVuJLQyuvG3XZpx0Ckmg4Lua94Jxtre4CqgzzxdfKcf3PpI5+Jy4FQ+Q0/opiDxkmVhN1HjXhepSVK0CASYCJXUw4ePGcW9lkPTA/2CLOOW06MLYK1oqHLL/rIYHuXd4zh0DT2iZNeCI6xvEBD7rlw/LLEz4wV+4+fCKO2YGOytSPd1pb6mrtfcXzOjjVNt4R/2zdbjMHHpj3bD/p5GxdAIq1zTYoswUXeCr4mQBjnSTcB73+Taez2A+Q== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AyUGRdJgN2J8d/rVi2mbRLQ+UUB/Xe8ctafwKJyA4M4=; b=P625B4xKxfWGJTpy8HGASpx0oGzh57ZC+RE4+VK4oLb6JorxudbgNqss3aFr4rGqX2zwhD768zHbFfPeFAbQVx8huwL+GguFvYf/hNJc0XidC4rLAducv4Av8XL7jRAAD1GNYrfl/V4DZeDDXvOvF0nUFKdYSnxzngbs2yM5fguMLBeFxzR6Kaq5tpbgBvePg5aizQpFNi84njoTC6djRyzInelxiwURLCfaL3bhLFx9yVXKIu9Qdt9+/J+QsT9L4nUjD4GyDjT8/peQ8mExeHShYhXmuF/6W7W4bhJQ7ylhhpx+NH2v3vAUbWQo6KnWYImuzyT4Nby7g1hjZXSSUg== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Fri, 15 Nov 2024 10:38:51 +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.8158.017; Fri, 15 Nov 2024 10:38:51 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 6/6] bap: Remove PA idle timer logic Date: Fri, 15 Nov 2024 12:38:24 +0200 Message-ID: <20241115103825.19761-7-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241115103825.19761-1-iulia.tanasescu@nxp.com> References: <20241115103825.19761-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P195CA0001.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5e2::8) 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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 95c25b06-56b7-4604-6e5f-08dd0561b0f3 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: GhPiyx1AHkk5jauABe+vXUsk2HvdtO0s8BO35fKQ1/C05U98GVex8yw1yvTzktRsVyFXp8TNYIq65xbcP6NHPsiAeM7K/L8nmwb/016enn6BIvyi2+TT0F0ikhfyKD2ZaXBCXnHOh0OIQTSz1sgVcQX9JjWlQj19/pvxU7ga/NUH9AJoTcOn7+cCcvBhjcf7ScPo6jcLvw6GRa0y/EbUJKSLyEavKiXOeN48qCFMGmoUm3dfUZlgLUbPP2nGyY/4hPWwyrQoWiI8tmxvKRKgx5hKjm1OC48qvyGSMZ8s29m0h43pHktHqSUbQ1r0Wzo6uQWryY/w7rs8AW05ugSIGu3H5e7D2iJPqKpLCJ6oZB5xI1w/MQK2vsZbC8+tEv7n+FOIGwBrT4lkSQh+Lb4+hE3BJn8TDwwQrQ1OLPiub01Q8cKVq3lEGz+pkZpvjDxwh0h+ynja5ONsiBN15JhM57JjWMXlEPFD+eJfn9msl8SLUJL51o9/eTV+kKm6M6j3KT4P9KmPo2zuEGoTC8mlA3fTcefy2TXEXb9L+/iPNG1sfJGmRM4QR/NVBt4PtIdvoa21kxbX8KR9ZiC1xlaktX22/ARbDT3RDjs84p3Uu+COvNyqWlFp/l7IVv14FUFGAQONu2t5CD090eKZr26SsVZbuDLQcjAPz6E+F/McPQLMvnpH/XVG7EgdZJC3uoPqS9cZa6egyQR5A+0t2kbr2klLY5fNKI8lAp/QGTG2RB477hUBMy+jVEqEqaObTH2jOEdTgO4E2O8n9sqjB0t4V5Ae6s/YpUyb1ubXkGa37DSKmDnRSeuHlx/d344VIuYlFDinbcxY9fWL2Y3dUtmvk3nj+cTcKVca+egYwR3ByTRWH/RdK1goZVP32jib7H5g3cpYBSJA96AN9GkZbZ/XiQM0LSc25wzmdHToCuHCqeypKL2Kd/Pndy/ZFc4xKxtzhFUi8Ht/AfzOgctQ/kB7zJBNOxtEUD1WwibthMuwCS6uEvRSNi3Hndhqv9LHQ8+6K6ijCYw8oWtFd9/9k0b4sGWQZ2uPZ6gV0pF7nd7Axz8vMqJhG94DSjJIKSEuKn7sYmzAMwvBLe6nMfVrAa04I/DVYcO/VZ9yoZQaec4qIJzD54F0iqGwc0+ML9cZFzJD7GhsELL1D6rKToelxyqOmNgF7yama+9jHoeyXWaEZs9WSCu3WTgq39Lq5idlviySmGJCddB0US8/uJ/CydofhkzPqNbSb0aZu/8cgL2B7qoLq7tMd4cecE44jURXgMK6/8UcYUt+/oPiTAHEdfhjHpkUeM62XYU4gkAjN6DNQJB207Hco2Px354xPsC/Si4M 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: tbb6HNU809tkEF/g+nSFboW9DwgQoBbXTjoPBc6Ugb5xuB0IfWf0sGLAfz4x7RgLPx3N4/THdXCEBIwoXaKwt8zlDqdYsR0iGq1V5O2qDaM1B9GJ+JwfiL4LZcRQwvjVnQRz4TWgop9oa9cI4ZAGnNOOVX6li87ObY44Tk3mElEneFCtjSEJNPAh8r7FnrK80c9G25J3yJEHDYYbqzRQQiAmBbL14+Kj3lcb4JgiC2qGlUE6v4v+eEZ2GDs7Ir9HsIkFt23Mq8br0aWCcQxVyUNzT3No+EEd2y+6oL/G6WEe/0QXj5tBHRnQYjkemKJzQpw9q3c3/w0vUEqxBWhs/l2mgpWXKv2XA/etyBrZiks+JfiWNas76mS866vLmHNva2873HfTdjztB8Dn+urMW8kSjv33kn+NIVLmh9Z6uuQzK1A4C1e5UOX1VG9nflCnmxKmefxHOJIDjadanYLwJy2WX6PluytIVH27tEtQ9lfVAm25Plm2gsms/VegjgDhLK2Ql5qEwTHuUM5HeLGFmtn3+kUwQ9/O8PBy5LnCkyHzFel1Nr1WLfZfBl8/eYp2/Hn6uqmgbNQBQZxRgh9c+IctP0CyK/teXOHSx4ugafFgTEqHOpuLPzRS4N8lO3Bhxf2d0dBxcJar6Tal1i7RzRUtjMmNvT1ZcPtv7zF/URk7f50KjEV1bm15cRzAkb6k+sixcKcX37IqduhjLJKV5qakxUFj7qcXqIGZRq3AkwhWdzFDykPDSQDFQtgCF8jEtMH7a++ns+uU2LVu7Y/Hs7wgA77/qXLcB69HTFKDBTOjvUOWnXrJVyGP88z0OdVT/BNFhCSlGbssNNAXXNDJPYuA34wURwZMeiSr19WPhRDcE60Y0dUUGO7SIHsaHsEy1eDxbtiEzl0uW/wlIrnH/FrBMTwV8BOIaQ93cxNrH7RKrAO7B1gQZeIOn1f+m17lzMxd0gsQo5G2f1LZNjlPc226oPpHGVB29Vy1IAhzspDAYXWH3+1ftr6qsOCBoFt/0B4c8CA6deP9gkuOakoiSLdvfH3BhnnDPgDsQZVi3zt3PSBiiLIxGPrHUEgfvu+vT4+miaBQRn1Vwr4q2/4pTRFyTNvAlc2/6a1a452O34P6+r4GnqMkwSXE55dZp2DakbXrFBd5RCpruL2dPAR1r3bhIAXjzaN1QYmWyA0yWLS17I3MTms8cyqkA4xNdWjHs7HROR9pRxcmbEBsbOSG8cYKsA/tK1ZZzJbYeRYH9wvujsS6piPV9hq0QnkzmaS0YU8w+ss+P0xYG+ZdQdXonEJ+f771FG0Nca/DmAzlqInA+/vJxAJv+pCvS7mlwxVUli+DdqJpjG7I5X2S3J1QFge9RGFpRFI2cgrajglk6cfsUsEIJVl8to4VK6x7FHe03FW3kpApgbu0CHwQugCMl5bYL6OBKclhODevIIrH37jwg3EAptEGWp47uI+MgJOJ6JjREXcs0kvxvXh3RFPqPKmwkahmQvALxO2Y5XN/4h1POBpj95La39OJzbTLnJDCm/g/moAljoIwhHo/4FWJaG5rMrtnJLbF4NtGDDlgq+v+I30k5/wc/ymVl3llFaNhEVPwt9FnRMxxYo2EpF8atg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95c25b06-56b7-4604-6e5f-08dd0561b0f3 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:38:49.8636 (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: Qz6SHmEJn3O7ATS2BI/+l9w9ZhmF7bYVD0h/1+pDCWDcN/N3RjrjGhO3kUgVYZYMNM/4Z2+bbuwUWzx8c0POnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 This removes BAP support for long-lived PA sync (added for Scan Delegator support), since it is now handled inside the BASS plugin. This also removes the PA idle timer logic, since PA/BIG sync requests are now ordered inside the kernel. --- profiles/audio/bap.c | 368 ++++++++++--------------------------------- 1 file changed, 80 insertions(+), 288 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index beab85cff..e927a4404 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -65,15 +65,9 @@ #define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1" #define MEDIA_INTERFACE "org.bluez.Media1" -/* Periodic advertisments are performed by an idle timer, which, - * at every tick, checks a queue for pending PA requests. - * When there is no pending requests, an item is popped from the - * queue, marked as pending and then it gets processed. - */ -#define PA_IDLE_TIMEOUT 2 - struct bap_setup { struct bap_ep *ep; + struct bap_data *data; struct bt_bap_stream *stream; struct bt_bap_qos qos; int (*qos_parser)(struct bap_setup *setup, const char *key, int var, @@ -101,15 +95,9 @@ struct bap_ep { struct queue *setups; }; -struct bap_adapter { - struct btd_adapter *adapter; - unsigned int pa_timer_id; - struct queue *bcast_pa_requests; -}; - struct bap_data { struct btd_device *device; - struct bap_adapter *adapter; + struct btd_adapter *adapter; struct btd_service *service; struct bt_bap *bap; unsigned int ready_id; @@ -121,30 +109,12 @@ struct bap_data { struct queue *bcast_snks; struct queue *streams; GIOChannel *listen_io; + unsigned int io_id; int selecting; void *user_data; }; -enum { - BAP_PA_SHORT_REQ = 0, /* Request for short PA sync */ - BAP_PA_LONG_REQ, /* Request for long PA sync */ - BAP_PA_BIG_SYNC_REQ, /* Request for PA Sync and BIG Sync */ -}; - -struct bap_bcast_pa_req { - uint8_t type; - bool in_progress; - struct bap_data *bap_data; - union { - struct btd_service *service; - struct queue *setups; - } data; - unsigned int io_id; /* io_id for BIG Info watch */ - GIOChannel *io; -}; - static struct queue *sessions; -static struct queue *adapters; /* Structure holding the parameters for Periodic Advertisement create sync. * The full QOS is populated at the time the user selects and endpoint and @@ -219,6 +189,9 @@ static void bap_data_free(struct bap_data *data) g_io_channel_unref(data->listen_io); } + if (data->io_id) + g_source_remove(data->io_id); + if (data->service) { btd_service_set_user_data(data->service, NULL); bt_bap_set_user_data(data->bap, NULL); @@ -382,7 +355,7 @@ static gboolean get_device(const GDBusPropertyTable *property, const char *path; if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SOURCE) - path = adapter_get_path(ep->data->adapter->adapter); + path = adapter_get_path(ep->data->adapter); else path = device_get_path(ep->data->device); @@ -996,12 +969,19 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, return NULL; } +static bool stream_io_unset(const void *data, const void *user_data) +{ + struct bt_bap_stream *stream = (struct bt_bap_stream *)data; + + return !bt_bap_stream_get_io(stream); +} + static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) { - struct bap_bcast_pa_req *req = user_data; - struct bap_setup *setup; + struct bap_setup *setup = user_data; + struct bt_bap_stream *stream = setup->stream; int fd; - struct bap_data *bap_data = req->bap_data; + struct bap_data *bap_data = setup->data; DBG("BIG Sync completed"); @@ -1009,28 +989,23 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) * to the order of the BISes that were enqueued before * calling bt_io_bcast_accept. */ - setup = queue_pop_head(req->data.setups); - - if (queue_isempty(req->data.setups)) { - /* All fds have been notified. Mark service as connected. */ - btd_service_connecting_complete(bap_data->service, 0); - - if (req->io) { - g_io_channel_unref(req->io); - g_io_channel_shutdown(req->io, TRUE, NULL); - req->io = NULL; - } - - queue_remove(bap_data->adapter->bcast_pa_requests, req); - queue_destroy(req->data.setups, NULL); - free(req); - } + if (bt_bap_stream_get_io(stream)) + stream = queue_find(bt_bap_stream_io_get_links(stream), + stream_io_unset, NULL); fd = g_io_channel_unix_get_fd(io); - if (bt_bap_stream_set_io(setup->stream, fd)) { + if (bt_bap_stream_set_io(stream, fd)) g_io_channel_set_close_on_unref(io, FALSE); - return; + + if (!queue_find(bt_bap_stream_io_get_links(stream), + stream_io_unset, NULL)) { + /* All fds have been notified. Mark service as connected. */ + btd_service_connecting_complete(bap_data->service, 0); + + g_io_channel_unref(bap_data->listen_io); + g_io_channel_shutdown(bap_data->listen_io, TRUE, NULL); + bap_data->listen_io = NULL; } } @@ -1099,6 +1074,7 @@ static void create_stream_for_bis(struct bap_data *bap_data, struct bap_setup *setup; setup = setup_new(NULL); + setup->data = bap_data; /* Create BAP QoS structure */ bap_iso_qos_to_bap_qos(qos, &setup->qos); @@ -1280,8 +1256,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, gpointer user_data) { GError *err = NULL; - struct bap_bcast_pa_req *req = user_data; - struct bap_data *data = btd_service_get_user_data(req->data.service); + struct bap_data *data = user_data; struct bt_iso_base base; struct bt_iso_qos qos; @@ -1295,7 +1270,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, error("%s", err->message); g_error_free(err); g_io_channel_shutdown(io, TRUE, NULL); - req->io_id = 0; + data->io_id = 0; return FALSE; } @@ -1304,41 +1279,31 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, g_io_channel_unref(data->listen_io); data->listen_io = NULL; - if (req->type == BAP_PA_LONG_REQ) { - /* If long-lived PA sync was requested, keep a reference - * to the PA sync io to keep the sync active. - */ - data->listen_io = io; - g_io_channel_ref(io); - } else { - /* For short-lived PA, the sync is no longer needed at - * this point, so the io can be closed. - */ - g_io_channel_shutdown(io, TRUE, NULL); - } + /* For short-lived PA, the sync is no longer needed at + * this point, so the io can be closed. + */ + g_io_channel_shutdown(io, TRUE, NULL); /* Analyze received BASE data and create remote media endpoints for each * BIS matching our capabilities */ parse_base(&base, &qos, bap_debug, bis_handler, data); - service_set_connecting(req->data.service); + service_set_connecting(data->service); - queue_remove(data->adapter->bcast_pa_requests, req); - req->io_id = 0; - free(req); + data->io_id = 0; return FALSE; } static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data) { - struct bap_bcast_pa_req *req = user_data; + struct bap_data *data = user_data; /* PA Sync was established, wait for BIG Info report so that the * encryption flag is also available. */ DBG("PA Sync done"); - req->io_id = g_io_add_watch(io, G_IO_OUT, big_info_report_cb, + data->io_id = g_io_add_watch(io, G_IO_OUT, big_info_report_cb, user_data); } @@ -1393,7 +1358,7 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, struct bt_bap_pac *lpac, struct bt_bap_pac *rpac) { - struct btd_adapter *adapter = data->adapter->adapter; + struct btd_adapter *adapter = data->adapter; struct btd_device *device = data->device; struct bap_ep *ep; struct queue *queue; @@ -2240,95 +2205,13 @@ static void setup_listen_io(struct bap_data *data, struct bt_bap_stream *stream, data->listen_io = io; } -static void check_pa_req_in_progress(void *data, void *user_data) -{ - struct bap_bcast_pa_req *req = data; - - if (req->in_progress == TRUE) - *((bool *)user_data) = TRUE; -} - -static int pa_sync(struct bap_bcast_pa_req *req); -static void pa_and_big_sync(struct bap_bcast_pa_req *req); - -static gboolean pa_idle_timer(gpointer user_data) -{ - struct bap_adapter *adapter = user_data; - struct bap_bcast_pa_req *req; - bool in_progress = FALSE; - - /* Handle timer if no request is in progress */ - queue_foreach(adapter->bcast_pa_requests, check_pa_req_in_progress, - &in_progress); - if (in_progress == FALSE) { - req = queue_peek_head(adapter->bcast_pa_requests); - if (req != NULL) - switch (req->type) { - case BAP_PA_SHORT_REQ: - DBG("do short lived PA Sync"); - pa_sync(req); - break; - case BAP_PA_LONG_REQ: - DBG("do long lived PA Sync"); - pa_sync(req); - break; - case BAP_PA_BIG_SYNC_REQ: - DBG("do PA Sync and BIG Sync"); - pa_and_big_sync(req); - break; - } - else { - /* pa_req queue is empty, stop the timer by returning - * FALSE and set the pa_timer_id to 0. This will later - * be used to check if the timer is active. - */ - adapter->pa_timer_id = 0; - return FALSE; - } - } - - return TRUE; -} +static int pa_sync(struct bap_data *data); +static void pa_and_big_sync(struct bap_setup *setup); static void setup_accept_io_broadcast(struct bap_data *data, struct bap_setup *setup) { - struct bap_bcast_pa_req *req = new0(struct bap_bcast_pa_req, 1); - struct bap_adapter *adapter = data->adapter; - struct queue *links = bt_bap_stream_io_get_links(setup->stream); - const struct queue_entry *entry; - - /* Timer could be stopped if all other requests were treated. - * Check the state of the timer and turn it on so that this request - * can also be treated. - */ - if (adapter->pa_timer_id == 0) - adapter->pa_timer_id = g_timeout_add_seconds(PA_IDLE_TIMEOUT, - pa_idle_timer, - adapter); - - /* Add this request to the PA queue. - * We don't need to check the queue here, as we cannot have - * BAP_PA_BIG_SYNC_REQ before a short PA (BAP_PA_SHORT_REQ) - */ - req->type = BAP_PA_BIG_SYNC_REQ; - req->in_progress = FALSE; - req->bap_data = data; - - req->data.setups = queue_new(); - - /* Enqueue all linked setups to the request */ - queue_push_tail(req->data.setups, setup); - - for (entry = queue_get_entries(links); entry; - entry = entry->next) { - struct bt_bap_stream *stream = entry->data; - - queue_push_tail(req->data.setups, - bap_find_setup_by_stream(data, stream)); - } - - queue_push_tail(adapter->bcast_pa_requests, req); + pa_and_big_sync(setup); } static void setup_create_ucast_io(struct bap_data *data, @@ -3083,10 +2966,8 @@ static void bap_detached(struct bt_bap *bap, void *user_data) bap_data_remove(data); } -static int pa_sync(struct bap_bcast_pa_req *req) +static int pa_sync(struct bap_data *data) { - struct btd_service *service = req->data.service; - struct bap_data *data = btd_service_get_user_data(service); GError *err = NULL; if (data->listen_io) { @@ -3095,13 +2976,13 @@ static int pa_sync(struct bap_bcast_pa_req *req) } DBG("Create PA sync with this source"); - req->in_progress = TRUE; - data->listen_io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, req, + + data->listen_io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, data, NULL, &err, BT_IO_OPT_SOURCE_BDADDR, - btd_adapter_get_address(data->adapter->adapter), + btd_adapter_get_address(data->adapter), BT_IO_OPT_SOURCE_TYPE, - btd_adapter_get_address_type(data->adapter->adapter), + btd_adapter_get_address_type(data->adapter), BT_IO_OPT_DEST_BDADDR, device_get_address(data->device), BT_IO_OPT_DEST_TYPE, @@ -3119,9 +3000,9 @@ static int pa_sync(struct bap_bcast_pa_req *req) static void append_setup(void *data, void *user_data) { - struct bap_setup *setup = data; + struct bt_bap_stream *stream = data; struct sockaddr_iso_bc *addr = user_data; - char *path = bt_bap_stream_get_user_data(setup->stream); + char *path = bt_bap_stream_get_user_data(stream); int bis = 1; int s_err; const char *strbis = NULL; @@ -3146,39 +3027,36 @@ static void append_setup(void *data, void *user_data) static void setup_refresh_qos(void *data, void *user_data) { - struct bap_setup *setup = data; + struct bt_bap_stream *stream = data; + struct bap_data *bap_data = user_data; + struct bap_setup *setup = bap_find_setup_by_stream(bap_data, stream); - setup->qos = *bt_bap_stream_get_qos(setup->stream); + setup->qos = *bt_bap_stream_get_qos(stream); } static void iso_do_big_sync(GIOChannel *io, void *user_data) { GError *err = NULL; - struct bap_bcast_pa_req *req = user_data; - struct queue *setups = req->data.setups; - struct bap_setup *setup = queue_peek_head(setups); - struct bap_data *data = req->bap_data; + struct bap_setup *setup = user_data; + struct bap_data *data = setup->data; struct sockaddr_iso_bc iso_bc_addr = {0}; struct bt_iso_qos qos; + struct queue *links = bt_bap_stream_io_get_links(setup->stream); DBG("PA Sync done"); - if (req->io) { - g_io_channel_unref(req->io); - g_io_channel_shutdown(req->io, TRUE, NULL); - req->io = io; - g_io_channel_ref(req->io); - } - - iso_bc_addr.bc_bdaddr_type = btd_device_get_bdaddr_type(data->device); - memcpy(&iso_bc_addr.bc_bdaddr, device_get_address(data->device), - sizeof(bdaddr_t)); + g_io_channel_unref(data->listen_io); + g_io_channel_shutdown(data->listen_io, TRUE, NULL); + data->listen_io = io; + g_io_channel_ref(data->listen_io); /* Append each linked BIS to the BIG sync request */ - queue_foreach(setups, append_setup, &iso_bc_addr); + append_setup(setup->stream, &iso_bc_addr); + queue_foreach(links, append_setup, &iso_bc_addr); /* Refresh qos stored in setups */ - queue_foreach(setups, setup_refresh_qos, NULL); + setup->qos = *bt_bap_stream_get_qos(setup->stream); + queue_foreach(links, setup_refresh_qos, data); /* Set the user requested QOS */ bap_qos_to_iso_qos(&setup->qos, &qos); @@ -3192,7 +3070,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb, - req, NULL, &err, + setup, NULL, &err, BT_IO_OPT_ISO_BC_NUM_BIS, iso_bc_addr.bc_num_bis, BT_IO_OPT_ISO_BC_BIS, iso_bc_addr.bc_bis, BT_IO_OPT_INVALID)) { @@ -3201,28 +3079,16 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) } } -static void pa_and_big_sync(struct bap_bcast_pa_req *req) +static void pa_and_big_sync(struct bap_setup *setup) { GError *err = NULL; - struct bap_data *bap_data = req->bap_data; - - req->in_progress = TRUE; - - if (bap_data->listen_io) { - /* If there is an active listen io for the BAP session - * with the Broadcast Source, it means that PA sync is - * already established. Go straight to establishing BIG - * sync. - */ - iso_do_big_sync(bap_data->listen_io, req); - return; - } + struct bap_data *bap_data = setup->data; DBG("Create PA sync with this source"); - req->io = bt_io_listen(NULL, iso_do_big_sync, req, + bap_data->listen_io = bt_io_listen(NULL, iso_do_big_sync, setup, NULL, &err, BT_IO_OPT_SOURCE_BDADDR, - btd_adapter_get_address(bap_data->adapter->adapter), + btd_adapter_get_address(bap_data->adapter), BT_IO_OPT_DEST_BDADDR, device_get_address(bap_data->device), BT_IO_OPT_DEST_TYPE, @@ -3230,26 +3096,17 @@ static void pa_and_big_sync(struct bap_bcast_pa_req *req) BT_IO_OPT_MODE, BT_IO_MODE_ISO, BT_IO_OPT_QOS, &bap_sink_pa_qos, BT_IO_OPT_INVALID); - if (!req->io) { + if (!bap_data->listen_io) { error("%s", err->message); g_error_free(err); } } -static bool match_bap_adapter(const void *data, const void *match_data) -{ - struct bap_adapter *adapter = (struct bap_adapter *)data; - - return adapter->adapter == match_data; -} - static int bap_bcast_probe(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); struct btd_adapter *adapter = device_get_adapter(device); struct btd_gatt_database *database = btd_adapter_get_database(adapter); - struct bap_bcast_pa_req *req; - uint8_t type = BAP_PA_LONG_REQ; struct bap_data *data; int ret = 0; @@ -3258,27 +3115,10 @@ static int bap_bcast_probe(struct btd_service *service) return -ENOTSUP; } - data = queue_find(sessions, match_device, device); - if (data && data->service) { - error("Profile probed twice for the same device!"); - return -EINVAL; - } - - if (!data) { - data = bap_data_new(device); - data->device = device; - bap_data_add(data); - - /* The Broadcaster was scanned autonomously, - * so it should be probed short-lived. - */ - type = BAP_PA_SHORT_REQ; - } - + data = bap_data_new(device); data->service = service; - btd_service_set_user_data(service, data); - - data->adapter = queue_find(adapters, match_bap_adapter, adapter); + data->adapter = adapter; + data->device = device; data->bap = bt_bap_new(btd_gatt_database_get_db(database), btd_gatt_database_get_db(database)); if (!data->bap) { @@ -3286,9 +3126,6 @@ static int bap_bcast_probe(struct btd_service *service) free(data); return -EINVAL; } - - bt_bap_set_debug(data->bap, bap_debug, NULL, NULL); - data->bcast_snks = queue_new(); if (!bt_bap_attach(data->bap, NULL)) { @@ -3296,6 +3133,8 @@ static int bap_bcast_probe(struct btd_service *service) return -EINVAL; } + bap_data_add(data); + data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service, NULL); data->state_id = bt_bap_state_register(data->bap, bap_state_bcast_sink, @@ -3309,36 +3148,15 @@ static int bap_bcast_probe(struct btd_service *service) /* Return if probed device was handled inside BASS. */ return ret; - /* Start the PA timer if it hasn't been started yet */ - if (data->adapter->pa_timer_id == 0) - data->adapter->pa_timer_id = g_timeout_add_seconds( - PA_IDLE_TIMEOUT, - pa_idle_timer, - data->adapter); - - /* Enqueue this device advertisement so that we can create PA sync. */ - DBG("enqueue service: %p", service); - req = new0(struct bap_bcast_pa_req, 1); - req->type = type; - req->in_progress = FALSE; - req->data.service = service; - queue_push_tail(data->adapter->bcast_pa_requests, req); + pa_sync(data); return 0; } -static bool match_service(const void *data, const void *match_data) -{ - struct bap_bcast_pa_req *req = (struct bap_bcast_pa_req *)data; - - return req->data.service == match_data; -} - static void bap_bcast_remove(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); struct bap_data *data; - struct bap_bcast_pa_req *req; char addr[18]; ba2str(device_get_address(device), addr); @@ -3349,17 +3167,6 @@ static void bap_bcast_remove(struct btd_service *service) error("BAP service not handled by profile"); return; } - /* Remove the corresponding entry from the pa_req queue. Any pa_req that - * are in progress will be stopped by bap_data_remove which calls - * bap_data_free. - */ - req = queue_remove_if(data->adapter->bcast_pa_requests, - match_service, service); - if (req && req->io_id) { - g_source_remove(req->io_id); - req->io_id = 0; - } - free(req); /* Notify the BASS plugin about the removed session. */ bass_bcast_remove(device); @@ -3501,13 +3308,7 @@ static int bap_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter) bt_bap_set_user_data(data->bap, adapter); bap_data_set_user_data(data, adapter); - data->adapter = new0(struct bap_adapter, 1); - data->adapter->adapter = adapter; - - if (adapters == NULL) - adapters = queue_new(); - data->adapter->bcast_pa_requests = queue_new(); - queue_push_tail(adapters, data->adapter); + data->adapter = adapter; return 0; } @@ -3522,15 +3323,6 @@ static void bap_adapter_remove(struct btd_profile *p, ba2str(btd_adapter_get_address(adapter), addr); DBG("%s", addr); - queue_destroy(data->adapter->bcast_pa_requests, free); - queue_remove(adapters, data->adapter); - free(data->adapter); - - if (queue_isempty(adapters)) { - queue_destroy(adapters, NULL); - adapters = NULL; - } - if (!data) { error("BAP service not handled by profile"); return;