From patchwork Fri Dec 20 14:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 852573 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) (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 876CA2163B1 for ; Fri, 20 Dec 2024 14:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705093; cv=fail; b=cPe6Zl8Wqc4kRFiEnfDEqdkp1qMSlSDrMQjnCCU4uzbqNSY9Xo2l7wgFyUmoOZfb5OuinJX3AKV9vhoeJZi3efHIH0i2GToMbDvRpFc1egFE72IPGN1bepjQ1Mo4B7lLSGIrmzeO4LlEPnd5ZCV9hZv8FxRxuCaiv4S+VXGokSk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705093; c=relaxed/simple; bh=6bGbmdndhgMa1+5hKEOB7UMU+uuiLEsBUAlGMNej7eY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mXJ9y/RF2GM/s7KkcmHWjVsr1anFJ9qDuq2Navpx2Zww3O5LrGGox4CMa9IMCVFDGyxTWl6+kpMJwLS+cEQx31Expr3SSM12jAVElusmmS0FqmXR8z//eUSpXZcYuxrXUJqnpyHf4nDgDO3yDNUIV3LBp0m2pDyPrWPOq9Oyq28= 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=jcHnWyH7; arc=fail smtp.client-ip=40.107.21.68 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="jcHnWyH7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yn7NUd5Q/KT2TCc7GqIVK50o+8TFXdDLh1LI3Ee+VPINAwqIMjWBygTD4OfMB9RkSiDtrBn1rKJllOrnJEvsH8y8foTu6mP6ZgZl/wRwY+Uq/AcG6uDEONZIOgkfiZjWONcPhQCA8NwVOH99+E+q4sbnIFWvDbEFvvb5aX4mL1Rz3AEooPp8LnLPGk0b2Ev3x2fsTRDCvLcUayPBps1hUHz+zC/lvIokOPz3Z7J5fKQm+bfxkMOguBsf3ld69KOTP+mRDig5HW++IFT0qrm9ObdrQNW0tt5Ytlwdvdc9fJLfS2jZGfz+gHASVELLGVJenuFuKGqf4x5qkz51kXNtSA== 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=HxSdTcTz0+Jy0gniPUNOpiw56t0+B0r2odZhshetd7M=; b=gsIhI/GIS4K891f4LY48FI8UeX1tZZkWJft501OEJ9QpwVgQkbK4DviBKBjbOFuy+sHgzRuWMA58loyDOIAIAHGynQJmFl0ltfONHS1BmlTF9A5S8PwLf6VBblXQ1mPf1SZ97ipa+JT/OZdQbqxV+vO285oCbt8PuKd8BAUd9fc8HJZk1eu2sytrZSah3YpONuIopPy2Jmjdur/zgSR1zUFvAnWmietBWW3RyH7QXmxiT8NLzs4cipeTLIupLxu4DZbLIZjhj6S4npj6N4E2PztZxVey3Cm+Ez7/m8QXOKmUs5iC//fhaeAnlEYVA1mQ8oJkx5MaB0JwcfskhP5fwg== 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=HxSdTcTz0+Jy0gniPUNOpiw56t0+B0r2odZhshetd7M=; b=jcHnWyH77r9TfTchUcck8ILJMrerkamEtcpA1XMa+WRew8Xb/QP831v4Dk5sz4u76Ht1GucKCcb9TOQPQddMAWaOXgGfBWEUf3ewCrjQTOF7pBr6HwZ+3MWFXzFkXPPofH1ETvI2xQ+YBKu1IcLYs5dHmxf8iV1G075WeTd2rZ3ROZCRENoN4bBdvfA6OQ0io7o7beYnuQxjcACMeXlviJAMpVB5Z23+vjGAVganBYiZWBs0fm+zeJZKh2/pbOEhbB3juaqn6JFHy1Ohd8IhxaBAuY8R03sSc3Nqb9SEn6x2CRyitRWaLMDKNDiKLs/rN8gz6a3ntVS1xSQ3GErMpg== 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 GV1PR04MB10105.eurprd04.prod.outlook.com (2603:10a6:150:1a3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.15; Fri, 20 Dec 2024 14:31:26 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8272.013; Fri, 20 Dec 2024 14:31:26 +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] shared/bass: Add API to set sync state Date: Fri, 20 Dec 2024 16:31:02 +0200 Message-ID: <20241220143106.27443-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220143106.27443-1-iulia.tanasescu@nxp.com> References: <20241220143106.27443-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4P189CA0048.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:659::12) 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_|GV1PR04MB10105:EE_ X-MS-Office365-Filtering-Correlation-Id: 76278102-cfa8-40ed-6585-08dd2102fc63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: 6WC/CiPl6oZ/qA/AgHW9kUdnau65frP+3cM+RznDh02IIS58kxmE9biwYlEorQ+Sa7u6+YY1g9qkB7U1Mv2bw9iKApynN4IzXcNkOa8lCCgntytKdXD19nNKkigWXDtNCxaeKEg3T8JiWwf9mEZXAk0DAGpBmAd/uh6P5hvOHekJBvQmWJbEOTNGlGVqyocstul+FpznzPK2xj6uOcVTUFstxVmtP5sv5yUXoV4BimiGZsaVB741HpXPxhJiDJKazX9NqSbbc2ttE0sRPCry9Bu+CUTScVQPLdFjcJcNR1LdANe5RRL7MOS8zz6q/b49NNRqjZ7+IVPfNM+WU/QBHh+J1HYuZsRVQjWJEn+63Lo6V5yhVsTlrrQA2CPzOPsuGAiIDW1MZ1Xg396p97zXVQgZUWfArS1SFyc2ONkoI3uh8d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urprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E/JaaV94vuVM4BNi3qNbkViTY7nTF85XkRbK0wmtZSyzHYRkBX9sDQnRRRucWyLPVNq5+AmZPsfXjhm4LuwOEQecB1Tf7O5n3mSs8ntW9L522sQ6AZ8xd0cUjGaa0en4jVzIkucQZ0fHZ6+bFaPZdQax1bXpyAMYffpfT6MiBdpZe1Gq2rSSG0W4zuCj18bMPcnpbfl7G2CBmixZSYD9Y2bUsDIwSQUtjhpzjNGQjLuEkLi8fMYNHwDviiOd2f1H/a9FewCDTZErOfMM2yAr7PjOiNF+bJvWxVKjnyjcuQTY48eib8KtD0lQVKnoVbalpc5PftBFdT7apQwTDuHS2Py3e48ROqV87x5GY2ablVh9ouBCLpX6iE2NQ0MJT5ops8rAehEuxBws2nxQ7J9YTLYX1YSdpDbtcyWBuSug+ECYIcw+EBj+zzjUemHvwiev4Y/kEceVNv128a5c3PmIJY/Ua8JK6qs8Ncogi51ah8pFaREkulbc9OrHngA0hyKQa4cN2xAdJyI9uEvHv9bNkMUOALwMbNzE3U5M7aOxhshzZ2gEDJP5u11VvC66UdF9fceGddLFg0Xk+A1/lQ0qDpQ6WA5Chr/ZrLpZQuH+HVS6J7PsW1ZmrIGmIW+FXURiQhgyNircOzo9npLCrQhbbvNpV5SftZtpxVfdD91xn4hrdNboC/wCdbEJBckb7iPfPomhBNkFwQqShZfmCUGm6n9zvplRbe2Dd2zYMS/BonQAFkMhjm7Civ7zvLFT2o/Db9ZHmPy0Wy6yvu4AtLaQbh3eFbMKmcwEqL6I18HwNzYLOBKmjiAYvYIowg2wQ5bsRtxfA7c3dr86mtaMMnrZ60wogeVa6csOCI06Zw572tZYigaiW/JqpGuopAv8h1OLlmivrEBL3HBZacBV6d2DSLy/YzyXfwvUpqVn4/77cws3GpCFQS9o0zJbfqsF/sbGlKzk4AeRQ1MfctawZamIt9qcYASEhs0kwnu0hKGTmsdMUSuFsu9rlQMQ/+rv0EJB2NYn8qnm0gMDSYGl9KbgCtl9YoqjJxcxlvk9QONJS3/66FGv9XkOOGi76UPoL13ANtmVtAk+0c5gPBVhkjp9iFd2YxnKF17s2SFsQxThWeK0b9PrdLedPI8jEY+/db2wffiIqNAHM7NPWzCiEqAPkIeFy6uoSR5z7nj07Mfg1nM1cEIrkGQyNebQDUGXWbgQI0fl8Y3p6k69lT33iuVTBYkYbzyRwK+QCGJp78aP+GaLBBv0I/qsH5gzXMcL+LGIfq7Pwqe/V8b1DzwIlM2MGdEofdxntJoBSu7iQSu4IEK0xLijGjxVsWhcJxufjAW9YjD+EC2pmrw4kKJ+yG4Pl07lwJNPyMlpLQmiW7iNarsJN3ccbrjPQWoVLKHLwJOJPThOq03pa1yz08eum+9ZIurNo9W9Mh1/99sRY8xrVotsUndH3oDymN2auX8i5gUakz0bBmx31hyW1/YFQFBsWA1IXeqJbT+tSDJgJsvK1bVsCRGPfRMEVZhw4NuuBKwHpcB2cCuFFeL/o/IZ7EegNhLxjpYGFG0/fjHjUKkeUh6PrpgJscjmQC4HKdyfKbbBcJJYQ05tnG2cslXxsK7vUw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76278102-cfa8-40ed-6585-08dd2102fc63 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 14:31:26.6632 (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: ELc2mXNZkdtAAWeoBessHal3DV0+DUqvnFNvFRigvijTNECYlrB8TSo9Jma4yOmylPNtN9PMcJl38+yL7CFbUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10105 This adds an API to set the PA sync state of o Broadcast Receive State characteristic. --- src/shared/bass.c | 10 ++++++++++ src/shared/bass.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index 1ab1a0a44..0651f9a40 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1781,6 +1781,16 @@ int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state) return 0; } +int bt_bass_get_pa_sync(struct bt_bcast_src *bcast_src, uint8_t *sync_state) +{ + if (!bcast_src) + return -EINVAL; + + *sync_state = bcast_src->sync_state; + + return 0; +} + int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) { struct iovec *iov; diff --git a/src/shared/bass.h b/src/shared/bass.h index d256b920d..f39ed7dad 100644 --- a/src/shared/bass.h +++ b/src/shared/bass.h @@ -130,6 +130,7 @@ unsigned int bt_bass_cp_handler_register(struct bt_bass *bass, bool bt_bass_cp_handler_unregister(struct bt_bass *bass, unsigned int id); int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state); +int bt_bass_get_pa_sync(struct bt_bcast_src *bcast_src, uint8_t *sync_state); int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis); int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis); bool bt_bass_check_bis(struct bt_bcast_src *bcast_src, uint8_t bis); From patchwork Fri Dec 20 14:31:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 852572 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) (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 3FE74216E2C for ; Fri, 20 Dec 2024 14:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705098; cv=fail; b=Y5iwoS+EB5Zhl5nk8rIDEwkBheDCnfD3T4LjRKQ3wcqcbS0t7VPnGchUQGF+g+T3/zE6GpK6J07S9+eceqOHS1CWaw3DZA1mXiklB+LhnarRkrk6Th0zqNPpbcWKDzxW7XBJAKEQ5d06IXSNDZmvyvXxd47nm+bAnB9E0MozWPs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705098; c=relaxed/simple; bh=qwf+WIGIYpwhFBA2PRia7eS7uhmuOnBDxx2y7J/C8Ms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=cgue1igBEdjQWNAycbjWB5Zr+mWZ9VMUpaqYjKFCMsx+KizCKrb2ikP/e4ShEPIp/yFAYYl3CP9vwORCCSjJQk6OUT74XdIO4k8XW7/HDTI4XmuDuykgyqUU+VGqlj/mONB2wTsUr3WPRo2SQPoZmL4xdoiLT8yFUwVAoRa5zVk= 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=HRkGzVf0; arc=fail smtp.client-ip=40.107.21.68 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="HRkGzVf0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fHsf3SyCiEjY/J1B1idusTYpZeYF9YPBN49N099vRNf7HcoJhf9YMBQpzqGO3Hwb5gpva2Hee7KHsF8tG7X3JUXOZ3P2QZ65jYcqoBN0Epwblos461W7ptpp04tpOR9TionxYi5W75Dv8x99NNy6ZkWppJ4P37RrVqbOhl3pStoXf+A+L+YDjb4ca/yIfgJBOgIoV+KxCTcd1osoR/x79L5pbI+ob/+B4AGjEJtW1pz1uo0Vr9AbGeDgX7J7dh+LFEq8iUGu4fDk9P1u7IyKYocx/Gmadm9Ny8xw5McpKbvZQe9a3Hvjt2KeohINk9cQPFTn0bgGGxUzCMW2zIjlzw== 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=LVwyTsU0FSft2xFXcUgCTO3i+y5LW+mKpMN30vs46wU=; b=YlRoo8CeUqD/L2emRPZz2oHXFmkE7JBRBHy5LoKbh6YrirRk1EBg71RsgJrm/ezgAV1WCE/udwMGWcNERWqD1I3/zUMBymidE/VtSoBQGruVykmLJNnh/HEbYjqRbHxDqZfXzyvmKXROwnwdYF75ddKpGg+oQflQA1ApdONWPqZ4Coq6pOYgh1nvGfrqeo1C1PQWIa7cWmgewwBscs3WZyAFJZRLFr4iEdtozaTrHUPe0qzG+VJobDwhXAni1tIBjVsZ7EzDKk5rBT/Ma8JcWDZfo2oXuks/HIP+CoHm/brYEeTcoDSG2H8eYqrkuW8W6aYNzWE4b6ziPiZiqyBV9w== 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=LVwyTsU0FSft2xFXcUgCTO3i+y5LW+mKpMN30vs46wU=; b=HRkGzVf0ZYx3neZZmKZGdKiEp5yn/KHZrye8w2hTx0vz7GF1VP118pE1qYSt3hLIYL9QviKdV7QHOpqSdUPkmocy6jJmTYrtmcEa++n5lCR72KR+J7cMfhmccydFxqI6iLSwKLON3pJFOekrK5Y1n25ySS3/c5jveNm1l3OC/wHqAeRj6lECE2+mBoIPgJyipUH5/E/ZNtR2E8BZcbTknbLPUqDyjmpNTdK2HVwPvWVrWw1Ht94kItv82cKDNeY5+3+lFnM9lO/aAfgMe1bUkUdgne3qyxBHPNu++Y69ZeMm3dbOS9tTxDxtJ4iR3wSrBSIbeNA/l4qEj24McKK9aQ== 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 GV1PR04MB10105.eurprd04.prod.outlook.com (2603:10a6:150:1a3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.15; Fri, 20 Dec 2024 14:31:34 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8272.013; Fri, 20 Dec 2024 14:31:34 +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: Create setups for all BISes in BASE Date: Fri, 20 Dec 2024 16:31:04 +0200 Message-ID: <20241220143106.27443-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220143106.27443-1-iulia.tanasescu@nxp.com> References: <20241220143106.27443-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0134.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::39) 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_|GV1PR04MB10105:EE_ X-MS-Office365-Filtering-Correlation-Id: 69b814eb-8886-4aff-ae13-08dd21030108 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: xkCddlEp8gwNT8gZW5+mZzlh7+H0wT6t0o0wp0gnkw3iEqwcCvMoi33ZyYKl3XhxgQZALMNIVL5OqsBYPDyjkUtVmQUbJ60KXjY6jauWssduFMOzI+lG78VGorbG/Ai9l1j4Ukq8ja0UOnMGR91L71Omk3vruZdS7hbJMyk2lWWoRdn/+YNScgEqIATibcsLhK/77W2f7pdRzWWaY/Cs1CIsysp21UyGJgMVsiQXkzCQ/cRor181jx4jGfkLJ84FM7Q+jjb/mg9ICWyT0IwiviRdEicHnEcikE5SyQwqqSpW2XEoBWdB67oEcAQUnL1Ru+s0a12yprhCmTtrlACsEwOZUl5nLwBY/Yfjo+sKYPlrt2uLFasmvNiKnaZ+rL3ufcSHVs1If9o1DO58fEGjjSQqn2Kx2LQCoM/UYmjayjZTV4gtv+tZfRrhlM2PsT1kDpkH0Tnb+LoSezcJAod+v24bYthYaYytddYTFXBOexZsYLuGklJGaZ0ycUV01pgShMi2Lqj3oykLA3CwQsjDrIpWIz4TOT3mDb/4z6Q63qSyONSDpJ0HtZTIthfBDcFgyd99u16JB346nzSaTBu5wLVk9l89cN75T8o9l/ndcQwHQgvcli8luhPt/u/WQBzewomr8RTV7oV3PZE6hCbxIwf+utc7iynW17l+xWflVtfvJPb5qYZTJipQUixpq+fnvwXUho/Lzbp60GU+A/YfA2h32uPLvFmenf7rTJKDcA0w+z/08ow/mmu9n+5BPb/VyM97ny9/5P9Alx053DMjbog+GYdnsOmWk2mkQ6JKafAh2VP3+3Fc73RoUY37TbnFn46VYmGIfgEotdwYiQANnNPT6Ili2fqHbUz/qcrwE7CJT2mcUPMDXkNuz0e7e3g/Hg0OXJ8LB3ZndT6WlUc6f+Ci0SZz75LpVtVnTpsROzqi9vReEjYjWv9eXwONPKe38kDq7R31t/VSlZgJcpY+UTOwDK3tVCufZ9xjggK4i7oO5t9V38fYdRkuS8+0mll3WM9XpB0i0U4VdkcjQum9mApT1XS9dZT1BHrWzdoPK1T0agJidBtZWzSo44yB8Xa+hIWsQ+dnZLd8WNg9H87Gn8meOwXOyaDU9scHc+JQenjtgJpdmh4UF+TfDCHcpxiZKqJEPpwT/F7ZGksdVfP/dSRV3L7k7D6pwZEjD7+HCXdjTG34Rl+/h+WaVv4LGwT3hYtCqYSpjdJbzFErjHJg3vlN0OsEJfciyjKNcOP9MJadMwy9SLyA7Ykzs8Ga3vpbwgrjWB+CKcpDUDUw0+0UC0CkVgcE0aMqZsVmKCgJ6CCFKl21gfUec8MKtym7eOGh27HDb9c7I8cNFLr53GSKzDvL03vBoTW7k1fIssQj6JifyRElcVFe/hmhNlh/leou 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)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9DFFfugGRTKJbZHjQUC+BsYiNDeCiVUV6omBQ7eBj3j9ZcLD0zxTTbOVURNp4RZZymqEid9OWlyqeYrsouQKRDKjuZ5wDKgZcVsDS5RgnZHvDDBoobKp9UOSJlhSVyRxQ0rUV1317ve6+RF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DASJE6IOCRwgxWPclGZrYosHZbhkO8ysq77HkfpLB5rD6NxKZA840t934p3r/Og1lEAoHYYbLVS3J2FNtQdQ3pukP18d1yqCaRVzUVnaITf3nT/0j9zqn96d/c/erRrXfK7QfeZjQw9VatzERXfRC55z5kaCl7OwaQt+zT4K4Htutxn2BPaRTWKc4Fd3uGExSZPuDV/rE4yriz6tmKuKXDXdHkjqwcZlBdQFx5gRQvhdm0KOu5NnRuHqkFWub6KWtNVCkN6cZjHSPLFYImXlIDHVfGw3wbuuJzrBbY21y/j65GRSIMpkbo5y1hlhTqxdj7Ur0pt1qME8g4ptwmZ/RMkDHuvJcoC4Y6FcV72B5KPXW89A8QFsAPTRa3rmWNn+Y0YiZcAFi2YsThGdQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69b814eb-8886-4aff-ae13-08dd21030108 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 14:31:34.3574 (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: +b8q+kWgJEkUDmDXdOCI47t0NhVdOR6q+pt8OeCL0vxIVxqIsbpFE7PLM9XtUpx68dxaPW2gA/hDdQoJoLLIvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10105 A BAP Scan Delegator (BASS Server) might be instructed by BAP Broadcast Assistants (BASS Clients) to change sync between streams, via the Modify Source operation. A Scan Delegator should create setups for all BISes discovered in the BASE of a Broadcast Source, and create associated streams based on Add Source/Modify Source commands received from Assistants. --- profiles/audio/bass.c | 49 +++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index 21f708ba6..2984d7697 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -118,9 +118,11 @@ struct bass_delegator { struct bass_setup { struct bass_delegator *dg; struct bt_bap_stream *stream; + uint8_t bis; struct bt_bap_qos qos; struct iovec *meta; struct iovec *config; + struct bt_bap_pac *lpac; }; struct bass_bcode_req { @@ -376,31 +378,47 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, } } +static void setup_configure_stream(struct bass_setup *setup) +{ + char *path; + + setup->stream = bt_bap_stream_new(setup->dg->bap, setup->lpac, NULL, + &setup->qos, setup->config); + if (!setup->stream) + return; + + if (asprintf(&path, "%s/bis%d", + device_get_path(setup->dg->device), + setup->bis) < 0) + return; + + bt_bap_stream_set_user_data(setup->stream, path); + + bt_bap_stream_config(setup->stream, &setup->qos, + setup->config, NULL, NULL); + bt_bap_stream_metadata(setup->stream, setup->meta, + NULL, NULL); +} + static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos, void *user_data) { struct bass_delegator *dg = user_data; struct bt_bap_pac *lpac; - char *path; struct bass_setup *setup; - /* Only handle streams required by the Brodcast Assistant. */ - if (!bt_bass_check_bis(dg->src, bis)) - return; - /* 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; - setup = new0(struct bass_setup, 1); if (!setup) return; setup->dg = dg; + setup->bis = bis; + setup->lpac = lpac; setup->qos = *qos; setup->qos.bcast.bcode = util_iov_dup(qos->bcast.bcode, 1); @@ -408,18 +426,13 @@ static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, setup->meta = util_iov_dup(meta, 1); setup->config = util_iov_dup(caps, 1); - setup->stream = bt_bap_stream_new(dg->bap, lpac, NULL, - &setup->qos, setup->config); - if (!setup->stream) - return; + queue_push_tail(setup->dg->setups, setup); - queue_push_tail(dg->setups, setup); + /* Only handle streams required by the Brodcast Assistant. */ + if (!bt_bass_check_bis(dg->src, bis)) + return; - bt_bap_stream_set_user_data(setup->stream, path); - bt_bap_stream_config(setup->stream, &setup->qos, - setup->config, NULL, NULL); - bt_bap_stream_metadata(setup->stream, setup->meta, - NULL, NULL); + setup_configure_stream(setup); } static gboolean big_info_cb(GIOChannel *io, GIOCondition cond, From patchwork Fri Dec 20 14:31:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 852571 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) (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 3CFCF215F49 for ; Fri, 20 Dec 2024 14:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705107; cv=fail; b=g1Ew7b2AFZNXQufWuVuWYv4km2xqgMALAd1F+Tfj+UHObIYOSSOuJ4r5gYfC5JSJgAGxJgubL83hiwGVk5KeTplsHWvW+8MsYLEJbPchDiztqCEAuNBFYxSf90sLZTNeW0Rv845T6h3bPA/ssb6qanrbCKl1QNfz+LejMWpMza8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734705107; c=relaxed/simple; bh=FCaL0szTL7jwDDxr9vd4ZeDd8vmCQNA9OXrxuTWGfTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=t2byjWPmOQycNRtkmH1O8Rnx7/jSFZsngm9DnQcfEsGH5D0iKMvQ+dOFn1qk934zo6YWLmOvsrO6Nt6lotOysX1W93M1I0mVQnS60fdg6P16+8nzw9nbC5gUD05o/B4w6FDeGeSfEo/UvmKrlqY10H5zBF+maRnzoNkme/dNcZQ= 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=JhLq1w4A; arc=fail smtp.client-ip=40.107.22.84 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="JhLq1w4A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s6rS8RTKOwxt1sqn9F2jcMv00ItcAa8sAHn2FeptKa73KpyZfHRqqdyPwdF816qf19bUe9c0KJ8tAv0yz1scOCALfNpCQq78p1KGjXQO2xxO+FNmHF0g13hYSinTkY5X52fOdE2phjvwvgAgZ3CV60EmfV4VI0yQqaYIsaoMlzT0INZMIW8x253XEfmAH45HHBO987O1+ajlJB9oO7kWxOUmSQr7leuTH0spSMtxCbjqXTQzrc2YHN8i9SxnUQy/4meuPLrwTEUdw8gRGYwT+PxT/aoO5hZs4CrnIzBStA03F/hDAdsnm+XnYBh3vQi7qGaY6Tm8al6NNuImqjZafg== 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=Sxb/OyCrhXCfuKRbfNkJV2CC6hrj8X+F6xviD1AG8C4=; b=dyXbJol+ez7z88+3+hXWaVtLPom0zrDQcjSDdw+NV6T3ucYB17IiglprGfT++10QRbwsYYzKp16PSy/bSjRQT2G0TyrUyx3orCHw2oBWrRayTO7NGcBb952vMdo3RhRG8Q5klEpO3eJtfzmrM9yPhjYBk0SULxQJL+vLg4njlkIaMoM76X80z9MOrPO1kRqQoc/FZhNu3unBqOP6OKXjU5ks8EhR/tDWfjtrm20bZ2Bg/AxYTyODErs2305rc2yqASwoOJU91PRHhQtb4tksxCvxvvblnJ2nMyy9BRyrfPU6D/fuL+GUC2cb3ofphNlbBgvGOqq7oDeK8cw1LuQcFg== 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=Sxb/OyCrhXCfuKRbfNkJV2CC6hrj8X+F6xviD1AG8C4=; b=JhLq1w4A0ZEfcHT8N35hfiWs2xX8g+Tam1KMAYEXRyGSRR6vf0gjatuH19SZ6Nc0LabZopdPin7ttRGp00oLOVhANDegGUpbAx64x5FOa0Sg6oWIIuqYvHyDNjjt1qjOXzo3qBk+MEaAVJXuV6g0rIFd9eHX05KH6Q29uDXjadwHNoCNmYi5q+G20LpeGqc3Dvr9y9GkegJlgEmGWNu+M5/P0XbpNKklCxxyT6oSCb+2h8t8vNAXs/Pal9kjBPrTXYJRYNbzvkakA5EmqXr8RfI9AnZq6ieHND42qx8jDfyKKYsPdfrRwyFoc1so+pfjdf8BYaa5AV5m+a6jRBYY2Q== 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 GV1PR04MB10105.eurprd04.prod.outlook.com (2603:10a6:150:1a3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.15; Fri, 20 Dec 2024 14:31:42 +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.8272.013; Fri, 20 Dec 2024 14:31: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 6/6] bass: Handle Modify Source opcode Date: Fri, 20 Dec 2024 16:31:06 +0200 Message-ID: <20241220143106.27443-7-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220143106.27443-1-iulia.tanasescu@nxp.com> References: <20241220143106.27443-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR02CA0129.eurprd02.prod.outlook.com (2603:10a6:20b:28c::26) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|GV1PR04MB10105:EE_ X-MS-Office365-Filtering-Correlation-Id: efe1ff89-de9d-44d9-d6ba-08dd21030570 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: PYs1IvfSUwlO1Q/Z8nXW+FK+D/m4s6RILwYDR1pXRgl1M6CKFtCi2pAAlJ+ldD20ayPwfjUyOgX4xuDm7o/4GfGxjrs7VgcHCBeVIKoN5TlySUpIC+3BBpS56MJx2RjqK5607WAnu/J+bHmgoItYqWdwVA9M/R41PaupqlwrQ+JQuBJUqrnMvl4gDU0jTuper2Ww548BJ18s9QNho4dmF2up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TsSUrEZap5+dUZ0Ny7OxrMT6DD7k6LZFRG3orypE9zed1W5T8vV05ixWpIWqEBAVAC6v3skHPJOD5GSEFWEeUUXpMguNyhyN6GKebYpleIi2BQ31UjUqhJyoDK 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)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d2zMuAvhCjfDoS/cD781MIDYJ9eAmOAwMae1HAKLQ1eaNMuW/BHooi8jvoPUljGXc9oUb5eDSg3IjkUQSqd3r3GY0O9V8dzX4ORSePz3Ld6Ca+7bH9hIbVYACcd7Bpo6Clmg/S0L0vnd/JDPhN8u7hSi2WHMxUkYaL1z5jLzzo+s6k6Zy/Tq7kJEpvr4JBZEz3iyWIMrNMEs+mCk+U5bOZ9pQnfQBFBhmFiIKxGCzhuxYl417mRVP2DtGrKqJxzCFEgrkkTLRCtJ4k76YPsxAQBL5q9LPXfZQNU4nnBjE+fOFB/SvklOixIjyG7eV4VZHZzNsc0/9/8Eywm3JKVBkV4IRFXi9e2aZl2jrVZvg3URVI80lVtrARiPs17omZnb0df09zS1uC8BMoYj1amApq3AUJdsDyyNiUywkfSswbZF3aCZiFcF8yvs2ApNU4Opc6VQ748PTFX/5cR2PHoVTgJYNnUoShwDYBPqoPwba/MbpW2/qYwMvuo9vyaWvPBItsyBOkxeMmh4BQRpcLbJbZKbC5V2kCYZXy4nOWKX9/ZjOOjj+AMqnpTvqX8npl9SBXkLwNl6wNPJtE/rBBquujZ2d0+0ohRwtPtYUATtBjIKNhphSVlFHUCSZW1TAI/63d2B93xHVZ4nh8AoTBJn6VYvFK/17n2gDx33EChbXB6V1E0qd83IuaYmeGNJ4fUURXJrZdGFNKbU9jjdKI2oNoT1HWMiqMSF7+8Gw/UjyJk5+PAnbOhPGmNTo+BCJ5Rx0nHcLo2wW1VmOSlvmTl2ebBEbssUps6AKcPHX3Kofe28lUlQd4v60DYqFwCpKPgdFnsOtYO9nuBzMDnRv6Pib+8PYo42u6tvG5vSh3V6a5k8n0cDIjg5okG7xZ3VR+bNlEFjZX5ePVRrn+1dcBmPrqdm1LJqinB6XcrN/EJjiQURD7YwL41Mo6ZbbmeZ5Y0ohU5VOGRn75x6A9xDzXzR5/986XxUsAm/FjnD92tQTRRf+0u3B5NHoifqiMgZzBBNlDrPnW/jISg1TnvbkB1cKiYhkxjuBE5ZlP1FHWbRXrKl7gtWiJDZccDYMQ55pLPogYq/yvTBJ5HWanio3BHaI+Si6qNJ4E86CdEXAOTGuqM1bz6SBExuLvTfeoknFtXet2yOzbCf0Ywx+VCcd0hdb+lRCmoDjob709D9uy5ulT29RbX2g4pCMaGWlZTBJ/Nw3JODbfDG1U9uvFfHDzFfo0r48Qt8/fg0zdQnARtyoN4YRS2kQniP3J/JQrPxD5+nUid8eOXb8VT9yr18ieSF0xNYER16KSVEl0VeYvZZzcEmTn+U1TqsxknJxeMzhjG94yiZ4bAJd+tdrNL3c/sjThpgf2wO3GVzJiO8PuHJeUzUSgMj/o3SFuaQZwWLYded5TKSSmuDo4gfyXu+KqdKL5f/Mje5X79fAvjicUcg0mYqmHRHK1vdR+pR+iDn4wvrcc4i4NVYqIbUbmTSDM4Emc0JhwPQey/YU/mUcxyJwKUPFBYNTiPCZhFbjAwYT4jiXOGQegU3hqYNPXVs/c5HTNttaGGRpOE2n6Jd7BV6hjOx7oOvQZ/WmYS4j826yiPc9Z4saWb7MYmk3NWDPQFzmg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: efe1ff89-de9d-44d9-d6ba-08dd21030570 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 14:31:41.8624 (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: teCHnr6nWsTGBeGdZWN0Zzq5p7b8kf2Z2fbSpZ2fwsp/pVRq4W+xW6hdAYwj+mlWUYCSO5TNT5CCHjoEhMev1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10105 This adds a handler for the Modify Source opcode. A Broadcast Assistant might write the Modify Source opcode to request the Scan Delegator to terminate or establish sync with some BISes. If required to terminate sync with specific BISes, the Scan Delegator must unlink and release the streams, leaving the others active. If required to sync to a new BIS, the Scan Delegator must redo BIG sync with a new array of BIS indeces. All active streams must be unlinked and disabled, and the new stream should be configured. Then, the user can select and acquire the streams, which will recreate the ios. --- profiles/audio/bass.c | 146 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 1 deletion(-) diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index 0904748a2..3a37d6711 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -335,6 +335,8 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, GError *gerr = NULL; struct bt_bap_qos *bap_qos = bt_bap_stream_get_qos(stream); struct bt_iso_qos qos; + struct bass_setup *setup = queue_find(dg->setups, + match_setup_stream, stream); if (dg->bap != bap) return; @@ -392,6 +394,10 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, */ bt_bass_clear_bis_sync(dg->src, bis); break; + case BT_BAP_STREAM_STATE_IDLE: + bt_bass_clear_bis_sync(dg->src, bis); + setup->stream = NULL; + break; } } @@ -417,6 +423,44 @@ static void setup_configure_stream(struct bass_setup *setup) NULL, NULL); } +static void stream_unlink(void *data, void *user_data) +{ + struct bt_bap_stream *link = data; + struct bt_bap_stream *stream = user_data; + + bt_bap_stream_io_unlink(link, stream); +} + +static void bass_remove_bis(struct bass_setup *setup) +{ + struct queue *links = bt_bap_stream_io_get_links(setup->stream); + + queue_foreach(links, stream_unlink, setup->stream); + bt_bap_stream_release(setup->stream, NULL, NULL); +} + +static void setup_disable_streaming(void *data, void *user_data) +{ + struct bass_setup *setup = data; + struct queue *links = bt_bap_stream_io_get_links(setup->stream); + + if (!setup->stream) + return; + + if (bt_bap_stream_get_state(setup->stream) != + BT_BAP_STREAM_STATE_STREAMING) + return; + + queue_foreach(links, stream_unlink, setup->stream); + bt_bap_stream_disable(setup->stream, false, NULL, NULL); +} + +static void bass_add_bis(struct bass_setup *setup) +{ + queue_foreach(setup->dg->setups, setup_disable_streaming, NULL); + setup_configure_stream(setup); +} + static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos, void *user_data) { @@ -566,8 +610,13 @@ static void setup_free(void *data) util_iov_free(setup->meta, 1); util_iov_free(setup->config, 1); - bt_bass_clear_bis_sync(setup->dg->src, + if (setup->stream) { + uint8_t state = bt_bap_stream_get_state(setup->stream); + + if (state == BT_BAP_STREAM_STATE_STREAMING) + bt_bass_clear_bis_sync(setup->dg->src, stream_get_bis(setup->stream)); + } } bool bass_bcast_remove(struct btd_device *device) @@ -1231,6 +1280,98 @@ static int handle_set_bcode_req(struct bt_bcast_src *bcast_src, return 0; } +static bool setup_match_bis(const void *data, const void *match_data) +{ + const struct bass_setup *setup = data; + const int bis = PTR_TO_INT(match_data); + + return setup->bis == bis; +} + +static void bass_update_bis_sync(struct bass_delegator *dg, + struct bt_bcast_src *bcast_src) +{ + for (int bis = 1; bis < ISO_MAX_NUM_BIS; bis++) { + struct bass_setup *setup = queue_find(dg->setups, + setup_match_bis, INT_TO_PTR(bis)); + uint8_t state; + + if (!setup) + continue; + + state = bt_bap_stream_get_state(setup->stream); + + if (!setup->stream && bt_bass_check_bis(bcast_src, bis)) + bass_add_bis(setup); + else if (setup->stream && + state == BT_BAP_STREAM_STATE_STREAMING && + !bt_bass_check_bis(bcast_src, bis)) + bass_remove_bis(setup); + } +} + +static int handle_mod_src_req(struct bt_bcast_src *bcast_src, + struct bt_bass_mod_src_params *params, + struct bass_data *data) +{ + struct bass_delegator *dg; + uint8_t sync_state; + int err = 0; + + DBG(""); + + dg = queue_find(delegators, delegator_match_src, bcast_src); + if (!dg) + return -EINVAL; + + err = bt_bass_get_pa_sync(bcast_src, &sync_state); + if (err) + return err; + + switch (sync_state) { + case BT_BASS_SYNCHRONIZED_TO_PA: + if (params->pa_sync == PA_SYNC_NO_SYNC) { + g_io_channel_shutdown(dg->io, TRUE, NULL); + g_io_channel_unref(dg->io); + dg->io = NULL; + + bt_bass_set_pa_sync(dg->src, + BT_BASS_NOT_SYNCHRONIZED_TO_PA); + } else { + bass_update_bis_sync(dg, bcast_src); + } + break; + case BT_BASS_NOT_SYNCHRONIZED_TO_PA: + if (params->pa_sync == PA_SYNC_NO_PAST) { + struct btd_adapter *adapter = + device_get_adapter(dg->device); + GError *err = NULL; + + 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(dg->device), + BT_IO_OPT_DEST_TYPE, + btd_device_get_bdaddr_type(dg->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); + g_error_free(err); + } + } + + break; + } + + return 0; +} + static int cp_handler(struct bt_bcast_src *bcast_src, uint8_t op, void *params, void *user_data) { @@ -1244,6 +1385,9 @@ static int cp_handler(struct bt_bcast_src *bcast_src, uint8_t op, void *params, case BT_BASS_SET_BCAST_CODE: err = handle_set_bcode_req(bcast_src, params, data); break; + case BT_BASS_MOD_SRC: + err = handle_mod_src_req(bcast_src, params, data); + break; } return err;