From patchwork Tue Oct 8 08:01: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: 833684 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011026.outbound.protection.outlook.com [52.101.70.26]) (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 78DD81EB9F3 for ; Tue, 8 Oct 2024 08:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374592; cv=fail; b=TtkRsg9nnWCpg4zTTEXS9gC+kqQ61xprLrH/5W95eaT6F95ZBXR1M6VsASexTUgYIC3x7FbIVozvQHRwCf67tSfYOIZEJCVDQtkS0H7BrI6MRs0AIABCFgDgGYomnlu85m72XGxBoOm9bOh4DUW8lRovby1fm0GIfcVwZsIn/qU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374592; c=relaxed/simple; bh=4GgI4Isa/L15DGlKgFh5WRgEF83HkOwJnnmcYwp7bSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YFL+RPwIiHfDlJDkHSbDmjsUxjn7iUvui9RbHeucn5Ht7xr09WHnvvdgJAIp0JqzQje7xD7auhd9hImtsKMuG4ob5YHEglURUw5em4DStJi+t02izmChAnP9/0pbB7xMq/bEi5H8/ShVahi8jt67M8suuE75Ky9MBK0Sv53U5C0= 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=VmNvqiUr; arc=fail smtp.client-ip=52.101.70.26 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="VmNvqiUr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yB3nXsep+8Y9eAJpi1FtJrxhb2hc9VgkslEmXiapBXFeFWDprreegtaJ29jkTAjdTZw5wcuGVRyBcnNtp2fb1whrFukeLUFkfowGbK6Qvhqf7wcWCc7zlUGKaRj0o7i2qTI2ce9Mj+emCYtWXfCjFHGtNiebrfqmV09vG3U5wx3svKZxBoJWebbheDsOyLkwCJc9Q1qeL8tcxFXhxPwrgj5LnD7TfZAp8WXtAwSfffI1CIHIptOi5Jj2Y7a4wJP5CGkGTWq+qjlGE+e7qB6vL8NuSvtyGGPjQ7k+/+YC+QLejS2W2ovh9+b5B6qebzrUrMzSFFJUZT2X1PsouRdLuA== 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=D1Zu6wrZiwVe7s2wdrXx38OHBZBOSfSa4H0ZhWFgxUs=; b=XonWe8coc2tlCy7yPYEcvEGHfIq6EEeDnXiZcXU+xzhKlR96bHEh68lVyJgh+0Yn6vSaWAE3j2BTUzKgSgMuLsH4k1l68J38RokN54ekL00RuN4gjm8pd+e3rwOAg2Zhjm4cKHvK2b2gDbcr8ob0IzBhdcvYok+DLGYqgzJXqyDg/fs0HBxmtSkFKkJ4f7RWZFXiFwTxqB6RvHqioYRMu+buClpuH9ulHQts3Q+XSqhgCyvt+4uMAKRrFryLcZzI5KS7RzlZTcMkZnMQt3sSUiXehz0TSpt38cSAMEBoHnhD4fp/f4Ky0IaekIUqWDbcfKQOUiqBhBe+38XURblamg== 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=D1Zu6wrZiwVe7s2wdrXx38OHBZBOSfSa4H0ZhWFgxUs=; b=VmNvqiUrUqz53w//M4qJYy2WS6QfMGK/pbRPjV45ypR9LrZ6aQZ7yuvFHO28qtToHaHePjP2ye1aroD1nt9RcSWc28OLXSy5Uu6lQJvKGniNgEm2ctfYmkGSU9vOr2PMgoIYjwoTu+y6kfjzonEDad1JVh/MCEvhv/d7zHkCfRiBFKEf7nKri5MhuyuVN2VY7pnGDMGHbkWof64xMZerGuThyz6Ql/Gl85VRVvCWtVxGgxnDO5Q22tWv5HxFWbO+pZgGNNeP0fijkPrXJEzBkMxBtnbN5Fc0B75ohLH4pNlQjsWQpl3o9IW2Lz0SgrwTlxMcDU27z+R1a/vRkB0x+A== 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 PR3PR04MB7388.eurprd04.prod.outlook.com (2603:10a6:102:84::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 08:01:49 +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.8026.020; Tue, 8 Oct 2024 08:01:49 +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/7] client/player: Add support to set empty bcode Date: Tue, 8 Oct 2024 11:01:20 +0300 Message-ID: <20241008080126.48703-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PR3PR04MB7388:EE_ X-MS-Office365-Filtering-Correlation-Id: e387ef49-be07-4156-fe55-08dce76f762b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: Y8ludefOq4zdoxI4qptClx1ZyMswxU7Xm283/Yq1fvVKmJO+VEJ3yIUMgeVHWosFfBgB5tVVywQbaFv1pajabxFH/4t+rLdJKh2JTmFIj9DlAUGANhXmddegoZq1Q16rudReoFq938Q+TzTqNQGdmXLhe0fJWBBlOFXGgqcyS6Ic8gVA7MFCr57qPQ6zmjDT4XlcDSYxd5wo6mUmsW/CAiKpfF3Qtjt9ho+sYEAznz5bPhu4hs35C8cItM9iQApy+2HCJxpCtHxIEcHcnXqWpWbaHLakvhb7hJaSEfyzxBzdai/4wKsM8NmP2WyjMZxxFXz5vsUjje96c4qjQIJDxnmpi6nRgFwSUtb1XsO2iVqTcNek4/5iQNVnLPutJ9zNv2glFt7hSGQaW47HckOPN9TikyRxw/SXBZD7gASu8air6RKerMAdqTiR1tkiEzbZsLE25/LhUzOVt23lE/1L5dDMcFiqD/RfofNzlQJfRpULUzlBaRZjy3kqJwi5J0kxQu0j4rKVcBogGtPkGarUirRnC8JetJ+9cb85kqfDOG7bH7lcOW2VgbsCPdhWttOGFgXeDeaC2m9BZ9yDCYOWFX6Vr5DMB7bUUNTDiM4YWZ1dG8VXW7adqHM0TXZxImlhTJFOi6XFwAuJZkmODy3/CGe06k6aeYbq0hQvCPAFHcJwTVst1Bm8PQBCrEeoSgBLcGUtvRMFCDchiNHdXtLvSyVN7Pmeix7iyd+yrNcNoMYsfhwXwuXZuUcc1Nf5ZKGHQwrHl29tMqRA4FXBle6FRFCGTtv02GdbIis5ifLJyDN9kWtAWC7Ndn0UQQWHBty8mcwA1bYhMN96KzAmadrFSuhqXnwXnlaERyG0UMpa8qayNQScHQ9A39NpRVd3lB4jRqtrxj+GcBoU/DDMS8eFOon6/m5AmXcduiEtiu4VVlfPgj7DlxBZ573lSoP4jWpitS56eOaukqYdlqYIbkA/wMpPNTWMsFg3dPg/rhoQhfQDAdZRWt5yr4VtD+EV3LCfiICm0klo297RAvByyXXkSa3t5yr1qwTmObymhG/Kxi+r5gLKgbpa0cjfIlo0dySX9xENIcTez7b6rAhuaObQCN2Ia82Tuo19InwKCV38tFPX/j1c8nz+IMG/xH4Xqi/+wqFDSagUhCNBkTeqWn1ShQtPDjVkNA3U1kcKZc0UxK58tlcVImMIWAgMGsiK2E4Rgqcw7Ihz2rENIa8lgymUcr0CDeSkxGztPdBRPtLtl1SHYVD8hDv76u3DRaKF3Xf51bWpZy6C/lgrozxvpooMFMT/2hg+ZJvjateEH/9NId8alVPRIyVWxwqOdhlgLD44ftveL4HENBdrDhl00sV81g== 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)(52116014)(38350700014); DI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9t5/PQnUmEg5p0RZyn1CSdkvzGOEza4yhf2om5HG1NtWSlM5MDjTOCNQbt5Ps/qbrThdLG7aT0ca4tGSLGjS6u4Vz5GPbg9i1EDEkdkY3caIFpzrdC0+wvi/ZcqneR7N+1RluvRXX5mD8EYRrFtLKvEt4ZklzG7G26nL6BORvbr4xeVZpbiFbOh9FQKrNA2BJnxIh6IutnyWn5hJxN+fIXjSaSy0kbXP4SaxuGhWxtiomepnDe2lISO4hTOm2MG0Q8IoZSZf8Py+jQoVlEc+Geyk2jL6L6l0Iyu0lCVdxDTvtD0FhQjf/Lqh8el8BdAklUoQy2U1pm1KmGDUv85tyt2R5EvNUq0WM411yG8nt6eN8mpQGi7BEeNqc1JPiWnOljz/gJuApPfgepO/MUjiqROf5jWcpq8079W5jgsRtbWxe4bGHcoEpT26rYFAqzScD+3/XI7MtXdjhbyd1yf5b1aHJnip6nBTqxXdToxJQB7aTRwmU2XqmHO7j/TYaf+arIidU1PwNA5nwO74h2hNsXEC6gzUPrd7se8Bfb9mJnG/dW22I+W32UnRslEvfgpuZcfulxc/zyviXJkFojbzsxo5EuJwCAX+zXcPPE+Dj5LW0R8P41A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e387ef49-be07-4156-fe55-08dce76f762b X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:01:49.1885 (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: /sDCRoNRgks9K+dqwM05HoeyIp7TMO9x4ko3aqPHZwVrI52O+qS4+toaHJnO+BHVX9ePUYWg00vf6jZ6e4R1jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7388 A Broadcast Sink might scan encrypted streams, and the user might not know the Broadcast Code to decrypt them. This commit adds the option to set an empty Broadcast Code when prompted for it after transport.select, if the Code is unknown. In this case, if the Broadcast Sink is acting as a Scan Delegator, it can ask its peer Broadcast Assistants to provide the Code through BASS. --- client/player.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/player.c b/client/player.c index df2246516..188378175 100644 --- a/client/player.c +++ b/client/player.c @@ -5150,15 +5150,23 @@ static void set_bcode_cb(const DBusError *error, void *user_data) static void set_bcode(const char *input, void *user_data) { GDBusProxy *proxy = user_data; - char *bcode = g_strdup(input); + char *bcode; + + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) + bcode = g_new0(char, 16); + else + bcode = g_strdup(input); if (g_dbus_proxy_set_property_dict(proxy, "QoS", set_bcode_cb, user_data, NULL, "BCode", DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, strlen(bcode), bcode, NULL) == FALSE) { bt_shell_printf("Setting broadcast code failed\n"); + g_free(bcode); return bt_shell_noninteractive_quit(EXIT_FAILURE); } + + g_free(bcode); } static void transport_select(GDBusProxy *proxy, bool prompt) @@ -5183,7 +5191,8 @@ static void transport_select(GDBusProxy *proxy, bool prompt) dbus_message_iter_get_basic(&value, &encryption); if (encryption == 1) { bt_shell_prompt_input("", - "Enter broadcast code:", set_bcode, proxy); + "Enter brocast code[value/no]:", + set_bcode, proxy); return; } break; From patchwork Tue Oct 8 08:01: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: 834140 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2068.outbound.protection.outlook.com [40.107.105.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 518771E9060 for ; Tue, 8 Oct 2024 08:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374520; cv=fail; b=aAUkU9BO7uGJCRuuLzkV6VHOTnxJqeznARGP33ez53fg1KpgVA0Ox6YwQ5Yb5eXcvTzzqrsyzVSH5XsGuu+fw18Ks+RTK1LQWtI03PGdzgPWaf+Dyc+S+Q/FjWd+6to8PIySUOmUXQv4IwmYrwmamQpg7Scoo7rHoOPzG7eoaxg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374520; c=relaxed/simple; bh=AV1vV1n58c7AhXeTZ1yYRSVtK28wk14DI+k2D+FDa+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=gl6gKSv6TKe4MsecrxxpaXzoZW6BMMTbrpyF58s18l6OPRheK8ym3ZHrOU86QpQrDdkDK++p+5uavwEhkiAN1ZnnFbD5NbXX5kc9zgOLCWYaC0KEAsgkpQhgc3NaL0SVMKWj+iM1hENB8C1t2kAccY0XJawg15gYnp5WuFA1Sik= 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=NTovQoZD; arc=fail smtp.client-ip=40.107.105.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="NTovQoZD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tibj00uVl98jOygTLnvVCi5/HEpJufzVTMJu236HvkPXkRj9gFZQLk4ooKcr+RcQ6r51RyZ79NBdrf6xIdCOXhMcV0ym3mCs6SxBb2LOt9PfoYCsAorU8GhL5x4cgKtvCkKH0lsV6AvA0oubCb9KAjj5ttOskMkwLiVj3JGQFZKm6D3tMMVcGAGzRPV1Ir4qxnk8j4zqd23fowOmCPILT1GEjyLd04rHS95ZgvgncPphiDD7NVNddPzUjdfPEZ1ETMVGZpga8Tp96PjSITLUCEMzSwWzkKiBC9gZZ8oEIIbOo4jBpCPiSRokutx1Dr56l2eWTTmiHRAWAlCaj2qh/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qSgq3ljGwWpIXHLnfCf490g9kSxQf6rcDuOJQowQnjc=; b=u2XcxWc/voCm282wSrBugH5KLcT766RZM6P/HHxy5yjOoU/pUvZhTuYaxl0/laDZFgv6FWXmbtDxENOiTYY9KycD7vZfvlbLOfVPBskdmJ5LrF5UQTEED1M3dx7Wt9oVRI73LyBaND/CFi+N/rOcvov7LSj1VvXkrcmaf/1OfHLfNXieFCtFqM2SJkB1pChN9d/ljCRlMku1qb6TOqpI6/rf/KeiOfAnGrB/IXZb4tZPuPxY713GMGnmeZEIwAPVxpBzRhUz33dotchwn1rQyYavLmQvFsokcECt/ZI2ypRRjTOnOp+ySbko1AvklPVrih4OZSJ4br3Hjk+Ht98S0A== 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=qSgq3ljGwWpIXHLnfCf490g9kSxQf6rcDuOJQowQnjc=; b=NTovQoZD+gB/cA/uf17BK8PckNQKh8+TuQE0HDoYeW9Wd8gv0kp5zKlwRBMkkejo62eVmoNtTeUW6Kzhu8PBg2WZu4JXOPRJN2jioP0Pefed3mWYqC+7kuKgCtzs8fNuTvCp8/pIYsrdGoCKtC/jUbbdpZuQpqWGAqsKFxOqtkuQ2gfbU9XvTlAuWsVewqotm+UXeaYaapEpUDh6p7y+fnTVw13nKILM/AwrWrlvdbUQyPcJ10n+yP+4PN2ga1qo04TMiOQn5o6tz5Oefb0jtBD3STX7KZp3jwa/MllWlE/bmR4M09CBaHI02NvJabjN9aeQfJwtm9Vg3XmajGs/Sg== 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 PA4PR04MB9343.eurprd04.prod.outlook.com (2603:10a6:102:2a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 08:01:54 +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.8026.020; Tue, 8 Oct 2024 08:01:53 +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/7] shared/bass: Add API to set BIG enc state Date: Tue, 8 Oct 2024 11:01:21 +0300 Message-ID: <20241008080126.48703-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PA4PR04MB9343:EE_ X-MS-Office365-Filtering-Correlation-Id: c05ded0d-cd2f-4c5d-a41c-08dce76f7750 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: uEKOj4+o8Bx5xRdsM/dt3UB9b6mCh3YEEs2wiTmnewAhGbWqpT6MsgNEhETEEQ0+aAsRqpIM3Mn49AdVrqI/ufFlbrQeIpcceYjfl6Vz8JjsLmcP7twMdtG38rAFjqcGtvULQ+4di2nx4uMZXVxjVuPeHWqeijx2mZDb02pCkZQVCUKGYLPMLQBmfylKyiheCVmF0A0eFD5OTickgDgD3YExx7R48eSOlLFFcnqWMXzuAUFAU2oVHH7BWrsXWuRr+ZemgX0Gn5oKhsvZ9Gir+/A/FaedPF2L8YLGEWi5JxK7nhi7oxPFYqKkxDXTcc5dRHsWNcpzcOmWvejgo3ON+BNd6R4omMp8taPXtX2PEMed8S7fPiiJUFvmPxwJsMAzG4aT/+ffhUyZqMKs7GQ9bOeCwGn6BUklnAnChDxcAGYsrE4mBBJ2UqmesXPnkX3Q7O1K90RzpadqOYyozalK9uNgCxbXNZ6ZedzxhSP7XxtFPfkBL3JCdSEiD7XazeZ+0X18uqcN3McMxLGtSkP7OcXz11lsLYY0WzFw/ib5Yt+uKAtksAEz0pA79WPnLBROMPiiiVQYFo5ivlrbMUMcarE9UCgDiUfiak0JZRIhCH5Q6J6x0sX/WJcYHq1ilnjkDJs/9zRZYiU0qnnMnoRJr/iEb4T0WunX2TBPpd5td7hKd6OJIaikj3nGhwNaRE/bebYt0H3uqdA2i4KKAaPXzyWPc8Q6rmzmIPrAPAnvs3ZfIwLOA+ZR7xSG3K2FInoOIxKjB4IElD24iMk/UzoHBD0jsXTQyh2YELzLQ8eLBiZ61qi0Kd9OH62TdJOYQIaB1KY2KgaKANJck6spDJBASm01rhPeIqRk4hr2GM59bk60Y73ouK1g0ISPiDYhM0LmkhktTr0bMKMrwGajU6BW0YkjxD1tZpTZpUNHWuSaa+kv2aH+QxqbeeU/wE1OryJ6LjT4I1QLjdy6yCsnltlYXuRGwzkGxRiC99dH7eg98Gr/pXRe3xQ7nIQnuNQJK1iwxpGw/c6/jlZWZGlZOrhkT+Ky8DceDFigsJ7MKRfWYESJwgJbaz3AYudVw2wF4APGhu192LH4kDVskczKQ5gBGaaF0CI7Nu18CEa4jORKre5bCB++NXk+vLS8LcjiP04kL4YprUmdqz/PFuUDSnNGY51D9q4QD/BBDjDozVw6JO8ZXkyTr7IZYML8Ita3L4FxDFL5TfImbno2cSVuCqdIlYqqs4sQAY53uyw7JbogwH5HGHXH3m65lg4qCVtT+UpeqlQSUd8wzC8dQhMehvZryUJBySgfcl44tq9XrkBFBFryBy+X5cqW6lvhNpW+upkYN3PsNuZO9N6ubKD0ezh1oQ== 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)(52116014)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c+aBR4MQ7EwrsENDQiVhAcWUGr7C/KNmSp62vCiuxxZu0yPn63tErD5rPJ+pMgo3E+xtlxmk6nLzcq6ZnLsdSr+KVzuHcyHyhzToiVKKQSu7zTwzBfDaC94t3CoaowEMgHS6J+14bSblQv2XR1EV6biCWTmnYUC6M1VH20E3invfl4RsaIKa0olomQcd1Re6ILTuZ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0WbmW6/B9X0wxI/I67xPXSs13B9Oj6YW6RV6WRQqaUJkV8Tq2l5M0ZqevLeN8nLRC/AGUdfxdZq3SgLuFA0wLVYTRfiYS9D0a+Bm3RmiZnDjNbYrQrhNqHPb5PW0/AUX49xVDTX/c7lCxLixHR+8EJo9KWMZsVp/CelyIKjVkZjTYZ2MvvfUzK+Nyyfgpjp8bxbyWpADfj3/lkfDrr6l7+uD08c2s7JURSApnqkmAsVpbh/hLNxYpuwwWcnnxDLma3wqpHwMOmwc5buDO7HiHTLoT5+KGOKVHSpN1HkV5fQ8ZLS9m6oq8R5LfItRP36E4FkGTAcBIEKw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c05ded0d-cd2f-4c5d-a41c-08dce76f7750 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:01:53.8431 (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: 58i1QcOrhDOe6ksAYyaCjNsBqoPgm1gnfv8WT0j+YpSlmXGzaR9pxBsd8EkUgve/bneidLMZvNZCEiPUz6YXFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9343 This adds a shared/bass API to set the BIG encryption state field inside a Broadcast Receive State characteristic. Notifications are then sent to inform all peers about the update. --- src/shared/bass.c | 24 ++++++++++++++++++++++++ src/shared/bass.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index 76287cfbc..9ee13bf4a 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1832,3 +1832,27 @@ bool bt_bass_check_bis(struct bt_bcast_src *bcast_src, uint8_t bis) return false; } + +int bt_bass_set_enc(struct bt_bcast_src *bcast_src, uint8_t enc) +{ + struct iovec *iov; + + if (!bcast_src) + return -EINVAL; + + if (bcast_src->enc == enc) + return 0; + + bcast_src->enc = enc; + + iov = bass_parse_bcast_src(bcast_src); + if (!iov) + return -ENOMEM; + + bt_bass_notify_all(bcast_src->attr, iov); + + free(iov->iov_base); + free(iov); + + return 0; +} diff --git a/src/shared/bass.h b/src/shared/bass.h index b21256efd..d256b920d 100644 --- a/src/shared/bass.h +++ b/src/shared/bass.h @@ -133,3 +133,4 @@ int bt_bass_set_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); +int bt_bass_set_enc(struct bt_bcast_src *bcast_src, uint8_t enc); From patchwork Tue Oct 8 08:01: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: 833686 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2068.outbound.protection.outlook.com [40.107.105.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 2E7DD1E885D for ; Tue, 8 Oct 2024 08:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374524; cv=fail; b=TYqlc3uzTRVb9DUl+WK4vJ35Lg5XBC2L0U1nX7FguEG9g35SoTp+4YbwUMPLtac7mVC/scuKfUw78FZMtb/G2BjH5AtliuIUDG+fRt8XEbss7Yl0HC4Z8ITEZOxyJqNv16EW2hXiEP+tfNLffIoJkhs0+1fCKL2NwUjW454NQZA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374524; c=relaxed/simple; bh=3cIlJqlDWZGa4xgJIfNL2YIOlUR4wIBEO1ZkeXCz7K8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=n1jO1PBd8P3DYkgwyQMV8dbBDbqu6NNvf1Pgck1UAqRlu6FU6owZjfKJ+wzpEzwS+XQKMJCo23MEaOOPSpKzxbX43itLx/atSFSKfcPPa4V8PhyxARkbP2By/uVI9I1wv2Bu8CqINgKluE6zAdTonmmc91QvxJtEY8st64M8Pwk= 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=EMBAQvHr; arc=fail smtp.client-ip=40.107.105.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="EMBAQvHr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XUjb8LhXO56XmYcgFWkk/cDbZFoJTcmcTs5kqGAfnfcxKoCgEwnz7tFPdBSH21yOFiYccOG5y+VQuMhTuj0yQ3HahjqVbiqjAmdHZasW2zhw703/Ru9KfjVVXDWuFgt2EqZrYYmQDf3zyXqZdHO/D/LDWybRwfyfb06dQmv6BA6g5piSmRZONeS7vWsGCmvzvCiWMvfXTdNc+Gr6eGXt0/O8IsItyCAUUTC0GiTssJy0z0a0qFbSwstLBQWa3+NQkkyGYBcH4YiHZTO2TwZI1jYKIApwPF4qWvxvJ5y/95wmzfMGgwdTC07hyzQ1K08pn6hR+uRefu/pTByK7R8HVA== 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=oQUw6Y/7nYzzKq7wKF7Q4unZeNz4MlwXy5mKli73RWY=; b=gc5J60Bn4FQE1FOL85PJPjXt4RlC3eWGLqiHvAcfH1YottkEEhJsH23tySH/Cd+hUw2gZdW5Vx+QuROX9OR1wbG7yEfifSaWIR6UtLI6VKUqo8rtoXmu3zaZwsszLQ2XSW2i3DUUFAA5tBSn56TwQNz3LjxB+np9ckBQk8eMJufTo1TGXFCTae+cBngShAIVs6Pdhz/ISo1tjdTqZU/UpFSkr8+tKt+v/LaIz25dlXUBnQR+XY97JgA0v+EW4izdgr+zGA1+Jw9Xl1d+eHTwEehK0SdFVeP1YwZjizwToWBreF4C7FPXTcaZ17KsMdb6wtZ0vw3fkwiK1P8HC5RQiQ== 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=oQUw6Y/7nYzzKq7wKF7Q4unZeNz4MlwXy5mKli73RWY=; b=EMBAQvHrfmz0MURhgoQ5J9kloItxbGD+RrZIaQoYFS05K6ZSrXxgNYLIa+WzphNnr5dDIg++uyHYsa0Fx3lo0BVaoBI9yheXSUN/McsaKg3rDRZdGd43w97HjeCZRj15kt/6ioOB84BqFb7kGKyX2cTVABfZItHlilEj0me6YUK+UyPQ30gXxTE+wEbXle44jD+t9KwLpBK23U+LaCq5/RfKV93n4PUuXu+3oCodG/Y5IpOakWgcVvRN5R6hTFnVgl9AZM9BqERte4V9I7rTXSx8GQxw2XXdUO+TOu7UnoRTVrcE5ApZfLQvv6KSSCsRkeIa5/D7WiOQV3e6SqqSsw== 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 PA4PR04MB9343.eurprd04.prod.outlook.com (2603:10a6:102:2a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 08:01:56 +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.8026.020; Tue, 8 Oct 2024 08:01:56 +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/7] bass: Add support to request bcode Date: Tue, 8 Oct 2024 11:01:22 +0300 Message-ID: <20241008080126.48703-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PA4PR04MB9343:EE_ X-MS-Office365-Filtering-Correlation-Id: 593bfc64-58e3-40f5-faa9-08dce76f7a70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: USf/qzdYRmzAkHPnT3eMc9X7opvtpmCHX7xuMrY0ZrzPKJTMLg/dJC6yWeeesUKgIH7rLIWlYKAdUsc93xvwoayAVSCj57fI4T1sQvf8DegpvRdbIYeyUqnZniXFb82lSAXF4sjffa90uWNkjeesTIKP+OKT8HEVQCEUlFPoLVWMiLBxPoTGjk/YzLJidMUQ4kiibI+DcrARgkO97YLBaJBaZYEqoL6V4kE6KRgaA6ERh7vTBq53HbfreaFMl45PqYmaOOReKvNQXRp3CpaUq8JQlGmpa8EE/YKyQo+x1Q79JxPPF4KOucMsy1QCWu7r/6HPhkJDsRIPQmqbt8+UYOUJ2npxHgSwro//mF94C6xA+UICV5bcofhr3Vbyx0Dhfemh/hTo1JfirnnSkB03uJDVoPqvr70KesX2Z3hnoR/ATgqrlK2hwbt9HrpnlOIQlkjzrFXBIl5p33DOqoRDmIEZGNGmmBDMzzWBFlYaviAfT9D4bJkPhi/HRNnV78Qw4qSexdyeBKXJb9NKVQ/nKEMXJovOXwaCTpGG0tVJ+ErxSnjfUkSwb7GWczDiUgDx68raY7boht/+A6iqiucypkPL3eMAkfBMRwMp/WKolNpFwk6ZjI3t1ZKcUVtfhYN6Umzej9J1dC9DPCwY1ljadcthPxjlzOpVraoFR8D2LYFnZ7X/z/gL9Kmr+mxSQU3sE4Ay1eWGe3+3MJi4kraXA3VrAWup7DKGz2VLiCY+PIPWm/n8upZAlYQZagrUBWk3N0IFOtiwGn/+kAsaTpCxs8n8iXtCAzf4GeVoi4Ws3bkDEOlE+FGpPYdyMYow6H5GyoGxa4DdT+PugV4wXKDBb6Omjg/2YkgDGTsRJgCMyHHEAiPMX69+vOK3OisdS7GJ2oRzfx2BKtifBtB+GWVclLgRVOS/fUO4XtnhGSgX7klJfavqLDK7bG25o/kC+TTc5t23uq3zoCw5+/tGl/ansfUmyfBxbzAlUjA+OGMryFLYkdVukWqsYyA+ZGXo8BQf7DhqRHYaYonH+tbS3oUmtOM32b3JVnVYef//Xqul4MJXKjCcdPkZZw1nNE096xUIQOMJuY8MbNVKc0DU0H5KWk9ckflkD614+Pw4v1+bCLmJvboLQmkTecHFqT6QCBUO84zB1LmcZ365X4KZWs2m8rt+WIQkrQSvhiyJmHC9HWCKjO/GLrqFXZB5n4Veo0kdht/DmMy5tyKUqR6BVM7TtmnImF7FSvHwGfM+T2VDycHvD6EbE2mPlIaFL3yH6GTyVyVN9Iy6XhU5ATXi0XMg3l82GPlWZafU84tg86KNlXVkOLHml5j1Wm3jX88qTJUgojcjJxHRQCoCEGkSTnSw5A== 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)(52116014)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wcFEvvwK3Scp+7dTouB+N589lxNOES/0V2S6pLZHW8i49ogilucUH38DDMyYYfBtXAe95KB8TZcRyYJgzJ1ApH6YJG728dv5gIDQSTA+8lJTrdFIerfbejqG/ODjQLOsvXjgLs9JKy4FglmK4P7e5jgxEx9zY/yhFy2cYQaYuf2MdIV4HgUyAsuwGLcUlWL/BCVok7jZlqy6PFXJ/HSN4Wu3HbHPq2JMysgGFJ+o+badrWu4gbqX6KqRV+TxGllLy/qs7l628quIKQLZ9D7xBITtcGxKTZ11OWbrzR9cT1UtjU6W/Y5OyFsiVUM+EEunNbz1FciI3n9GYlHG3X/SiY1K0otHq4YBwWxWA/Ki9RqShN+hXZMLrEWh4AbMO/fPsPwSEJCXO3Plws/BjyhaD1VisP6vgF/GezzwHO3ygA5m8uoLBNpIKV/MYCfEugP32eoQXylpNcbhNpYi+L+D7YbT9jJ5K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AS9kj+uxisZ2p6ITd4+5gdqIxcFLYqSLISTXyRjzuoGiYGCs7O1uDZg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 593bfc64-58e3-40f5-faa9-08dce76f7a70 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:01:56.2457 (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: MqsFukOAMS6NNtbT4oyqCyIYueJNlb5xFrbl3EW8F9Ncu5g1sii/UcvHh3fzjybeUrHJvHIujaM/EdhXkCHJEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9343 This adds support for a Scan Delegator to request the Broadcast Code from peer Broadcast Assistants and to update a BAP stream QoS with the value. A BASS API is added to update the BIG encryption status of a Broadcast Receive State characteristic and to notify peers. When a peer provides the Code using the BASS "Set Broadcast Code" operation, the BAP stream QoS is updated. The driver calling this API will pass a callback as parameter, which will be called to signal that the Broadcast Code has been received and stored in the stream QoS. A timeout is set to wait for Broadcast Assistants to provide the Code. If the timeout expires, the callback will be code with the appropriate error status. --- profiles/audio/bass.c | 141 ++++++++++++++++++++++++++++++++++++++++++ profiles/audio/bass.h | 6 ++ 2 files changed, 147 insertions(+) diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index 7553d1bec..6237f5acc 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -104,6 +104,15 @@ struct bass_delegator { struct bt_bcast_src *src; struct bt_bap *bap; unsigned int state_id; + uint8_t *bcode; + unsigned int timeout; + struct queue *bcode_reqs; +}; + +struct bass_bcode_req { + struct bt_bap_stream *stream; + bt_bass_bcode_func_t cb; + void *user_data; }; static struct queue *sessions; @@ -117,6 +126,90 @@ static void bass_debug(const char *str, void *user_data) DBG_IDX(0xffff, "%s", str); } +static gboolean req_timeout(gpointer user_data) +{ + struct bass_delegator *dg = user_data; + struct bass_bcode_req *req; + + DBG("delegator %p", dg); + + dg->timeout = 0; + + while ((req = queue_pop_head(dg->bcode_reqs))) { + if (req->cb) + req->cb(req->user_data, -ETIMEDOUT); + + free(req); + } + + return FALSE; +} + +static bool delegator_match_bap(const void *data, const void *match_data) +{ + const struct bass_delegator *dg = data; + const struct bt_bap *bap = match_data; + + return dg->bap == bap; +} + +static void stream_set_bcode(uint8_t *bcode, struct bt_bap_stream *stream, + bt_bass_bcode_func_t cb, void *user_data) +{ + struct bt_bap_qos *qos = bt_bap_stream_get_qos(stream); + + /* Allocate Broadcast Code inside stream QoS */ + qos->bcast.bcode = util_iov_new(bcode, BT_BASS_BCAST_CODE_SIZE); + + if (cb) + cb(user_data, 0); +} + +void bass_req_bcode(struct bt_bap_stream *stream, + bt_bass_bcode_func_t cb, + void *user_data) +{ + struct bt_bap *bap = bt_bap_stream_get_session(stream); + struct bass_delegator *dg; + struct bass_bcode_req *req; + + dg = queue_find(delegators, delegator_match_bap, bap); + if (!dg) { + cb(user_data, -EINVAL); + return; + } + + if (dg->bcode) { + /* Broadcast Code has already been received before. */ + stream_set_bcode(dg->bcode, stream, cb, user_data); + return; + } + + /* Create a request for the Broadcast Code. The request + * will be considered handled when the Broadcast Code is + * received from a Broadcast Assistant. + */ + req = new0(struct bass_bcode_req, 1); + if (!req) + return; + + req->stream = stream; + req->cb = cb; + req->user_data = user_data; + + queue_push_tail(dg->bcode_reqs, req); + + /* Mark the encryption status as "Broadcast Code Required" + * in the Broadcast Receive State characteristic and notify + * Broadcast Assistants. + */ + bt_bass_set_enc(dg->src, BT_BASS_BIG_ENC_STATE_BCODE_REQ); + + /* Add timeout for Broadcast Assistants to provide the Code. */ + if (!dg->timeout) + dg->timeout = g_timeout_add_seconds(10, req_timeout, dg); +} + static bool delegator_match_device(const void *data, const void *match_data) { const struct bass_delegator *dg = data; @@ -233,6 +326,13 @@ bool bass_bcast_remove(struct btd_device *device) /* Unregister BAP stream state changed callback. */ bt_bap_state_unregister(dg->bap, dg->state_id); + if (dg->timeout) + g_source_remove(dg->timeout); + + queue_destroy(dg->bcode_reqs, free); + + free(dg->bcode); + free(dg); return true; @@ -794,6 +894,7 @@ probe: dg->device = device; dg->src = bcast_src; + dg->bcode_reqs = queue_new(); if (!delegators) delegators = queue_new(); @@ -808,6 +909,43 @@ probe: return 0; } +static bool delegator_match_src(const void *data, const void *match_data) +{ + const struct bass_delegator *dg = data; + const struct bt_bcast_src *src = match_data; + + return dg->src == src; +} + +static int handle_set_bcode_req(struct bt_bcast_src *bcast_src, + struct bt_bass_set_bcast_code_params *params, + struct bass_data *data) +{ + struct bass_delegator *dg; + struct bass_bcode_req *req; + + dg = queue_find(delegators, delegator_match_src, bcast_src); + if (!dg) + return -EINVAL; + + dg->bcode = new0(uint8_t, BT_BASS_BCAST_CODE_SIZE); + memcpy(dg->bcode, params->bcast_code, BT_BASS_BCAST_CODE_SIZE); + + if (dg->timeout) { + g_source_remove(dg->timeout); + dg->timeout = 0; + } + + /* Set the Broadcast Code for each stream that required it. */ + while ((req = queue_pop_head(dg->bcode_reqs))) { + stream_set_bcode(dg->bcode, req->stream, req->cb, + req->user_data); + free(req); + } + + return 0; +} + static int cp_handler(struct bt_bcast_src *bcast_src, uint8_t op, void *params, void *user_data) { @@ -818,6 +956,9 @@ static int cp_handler(struct bt_bcast_src *bcast_src, uint8_t op, void *params, case BT_BASS_ADD_SRC: err = handle_add_src_req(bcast_src, params, data); break; + case BT_BASS_SET_BCAST_CODE: + err = handle_set_bcode_req(bcast_src, params, data); + break; } return err; diff --git a/profiles/audio/bass.h b/profiles/audio/bass.h index 5e34db90a..257346374 100644 --- a/profiles/audio/bass.h +++ b/profiles/audio/bass.h @@ -16,3 +16,9 @@ bool bass_bcast_probe(struct btd_device *device, struct bt_bap *bap); 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, + bt_bass_bcode_func_t cb, + void *user_data); From patchwork Tue Oct 8 08:01: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: 833685 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2054.outbound.protection.outlook.com [40.107.105.54]) (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 008541E9095 for ; Tue, 8 Oct 2024 08:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374536; cv=fail; b=BbUxBoC9EVcClGs3sQ0inonY87vkI9Y7Pn7RhQQZGrRbvcVSizdII3vVQ4l5b617liUWM9JX4yuE9VDm3wx/CCzlZWETAh4NUuTVINRmviZvH4YsD9dNgZ6hZdk2rvYm2wVjasjtOsJ/DS7kcDc5/Kw4BPXhx8JhLjWlTRVZ9Is= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374536; c=relaxed/simple; bh=yn1+bVwijqdXkvA7PQdr2/w/GO23aWkXnFp1RcLlNS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mgTltpmAQeMmRWTsvoWbmu40v+jV65/AUVbN/cm02tBgxxul/tVH9eM8Nlb3vvcxlgTag7wdsosMAC/688X6KOFINMgUst7ZI/JPoEcT4zn/hPo2YWoJoS6sw1SMRf6j7UNqYZdTSu5JkgH+FfxayO147S6cLZjP+e5Aio5XZ/E= 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=njXXEKF/; arc=fail smtp.client-ip=40.107.105.54 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="njXXEKF/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L90zVfYhTW4ZWC3lV5g7LcqlYSgFZZ4mu4fMfK9ejLCtXNRM7XOiLkYyGqtpD9GomxXv4/UsXXqnqzSdGwtXuyORTagiwlYmZ80rDKQrig7vll2zB+Gc9uGli0eeWVigaB7Ykd0ZRmrk8kRPTEy/hldrvyUvl1+ld/ZVKTCvqUdv+A+FK6pct0SvX4G3gt2+3yPRbkhmKCzgkKewfHMHgGe3YbQE8URB2d01lp+dN6DiyXxKU7xUxnrReEK4qDFDAoQ067qJ2KO62pMK8wYW0jJD35qwnhInz0DvhqaGUL65w6J+lMs7fu1UU63yImxl2dFwX41mjkU68vadlaWsBg== 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=b3IysLvBjs9DRlc/1LbaYlRm/dPUSXztSNXbg7c7HI8=; b=XIPFdCNQ+jqkKrzMq1FK7ew1CeuHoo/5Z9Dd5LFLQIviJg3eSUQjTMoURcof6Y9QRs1faCJUiBb/7J2TFtDlzXIZsjY5bC7khp5+/tyyZIsVv5VPD+ubx8o7GRmo8g6DPR/rzG4SVBJejQmhL40xihG5fnl1QjT7H2en+6pSBAFWYEJ/kQakZObl5kKrwhQTk2zohMrQ5jZRBAwJpaAfIbKhaPZ+fXY0QrDsa/hNNfQRLN6+LZQT9p5vgvvrzNrERoOPC4LxK/wKF4EXmJySQsqb9hHsgyGQIHw9VbN5QJ3a71RGS4JAH96hAPVu/4fxwaJ0ycuFON1WxaMPWGkHAw== 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=b3IysLvBjs9DRlc/1LbaYlRm/dPUSXztSNXbg7c7HI8=; b=njXXEKF/jIj4pkpnqxR9n/nyN4DC0oZUmPQvhB8pgpDgAm4JMsmfv+uvgWO4rboczENi2Sa5yNwEK5nQrZHzOcaEYzyR6HwnWiOtb61I1rpXo4EzLvo9gj6WZHpLihK3SicYyY+bvtTyfTYHd1ZIe2YFel5TKuqK2LZ2XKaYmbukTTGDc2wvzP2IlW+7Ah8IFJQa1wI5SHdOpwES9hVq/2O1r+DR11BAdjc8HfxZET7mtLkLoWyRg2x/pGvufqYYh2QiDtCFlITtcatjPGLXqUhwcCpH2Pb3AD35IICI3f5UQWBvrfwzPMgCQh3bDZaagtfYjxTiexOEOniQFrjQBw== 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 PA4PR04MB9343.eurprd04.prod.outlook.com (2603:10a6:102:2a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 08:01:58 +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.8026.020; Tue, 8 Oct 2024 08:01:58 +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/7] shared/bass: Call cp handler for the Set Broadcast Code op Date: Tue, 8 Oct 2024 11:01:23 +0300 Message-ID: <20241008080126.48703-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PA4PR04MB9343:EE_ X-MS-Office365-Filtering-Correlation-Id: 14a4329b-9805-4d30-5004-08dce76f7bc4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: bhNPKfCzDRU6ZRn9T1HYpkiwVTu0xWMUGL4DQZ5t/jqOXGocu4XJt/F+4n9EP9uanVx9zSA2zqban5PHn93kNMNzrqKSKuPoPC+2/8IkNg5XcE9HoGO4s+ULawUInB5kwTqJpvzyv0uh6zZ+oq4DbzfgcFf872BdNkZhRASa7aFGoVDmobTa8NbhnyBF4L3lJ7fLDZDUVo1aQMsWDVzyO6tGyGMsgenriTZS/azRAG5Aj69aISZoqpHfhs+E9trN8nP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FNGVK8V0DD32kg6Q8TmxF2qw== 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)(52116014)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bD+eEVuDhZjKMvLscyKFY61oJeSO//vQbQflTFTvwy88JmeB2EtKISH08G8z4JyS/c8hcSuXXVTm8p9iEUtWRB4+HS4hTV2lyDvHXQr83lf4XGt5HxZeGW8pOGbOofdojyxzvK+pfLqQHntAZpd2E9Uo/RBxqRoZUpDZV+WDqHqZFOXRKBPXqLDeTtUq6IrlpSlrW0aeQMXURqSEJ4neqJHSJ58y64hOKwTZdQrvmBBMKMXkyRso2u+PsWViZ729BSj1QkA/+u25qMM8a0wP97Fsy9AiMBGI7Ep9vtNNLKGmiZ0YpVfR4oVk95TkleYrHp6N3nLLgG24FN6pcyDrY3noeQmuGFpeJ8+ntirzmOLdRdnTLlfBTmEhHOWTaP9W3HQOoG5qiRt2p/TeUwuuIq8pWJ7xykYcPetkAWMqhQeMDBzAZOQ/L/4o9Ke0meXtDxL4lqeLlEPLeOdJhIdvFHTBbce5C7e7t1aCqZASY/WtruCKgkgHXDcl2Lpx7x5dmfw/pAFHm/NuWSCJU8GRPa/v1MwWcR0M72tZjn1eFjtvLHxSJaoQ2xkBTQDQgvNQaXjPtVXHEhaInB5ZAC+tAk0pbqqa106JNFj+vH3sydVsjdNqaxboiYYcie/FiNjoFS72qRpaT5RGol5BZI97JPzwW5Yic9ndZNnWInbEmRTyojLVJDG//J/86pSjAliYa3RisMdo/3Fx1fX4QpZUpZ19MUzixSJtrp7EQTOVDcNnzpHbqdYQU6KKB1cviJvToxAvB8atawXH45jNPjcPgkvpbPApdiHTL863jWZg8r/YqCgVZPxphrlLZj0Xl7vinOzww0LUIxdDLz4mRcDwsJ0Z7Reb/AeypJ/62kkwpfws6QlcQ1WDuswXQAPGovUdoK/EGRvc+/UMNmqJrOT+bCjDi/vXALFY/WyTcva0p2tKEBUZGYtsX98V1FYnUTy06yqw06KcsptzNRBvA3/J1Qp/kZE11eMxkKQ9k0uviclA5R4WZQjFAVlP+r184jrpZSSNbqlFaWJVN0AmyO9RU3jk21IMxhkG2qRC2G+Dp7yubhR7fpLSAPxFwKejYKwcGfZUt2pV+B7NAiVgtEyQSr/s6BxaKGUOW5AD4qfkE0sBhLXJBzomcDivobMlr5xjMXndyqGGBTyclnSQDYjQW7O2qMmR3a+9eovPoeaBrI10/DJFl9jAVIDLrdU4FKcoN8ww5jtd2B52ipQejVWE/612ImDSeaufOseFjBHQhwO8234tJcFzXBKtDmxApxIhsd9mnsEzU5rRcDbN8cY9yF1wzXo21flPvF5Ua8kFhTYe5zfaEKw1BdnBa2WEHDTVeTUvGDMandlO2YhN6npvH1DMB4pm4R9xVfypsY/PMg0jjUjDUzn6G28FLUgDiuYnmL6JHSOoDTbxeQO3Dzzl8bAMED0PWnMxzX0k30+au9JQleZEU41yIe8vP1Qp6D0tesbYP0GXhxOLuQWglMsaYJXouP+j9q28bJhHffa3dSPHzt1p303cfqnywiPhBSsqQfi50iBzAUwhGhCybpnLBqHP506O1ZgwxYBQxDDMYCrJ9Dv1V7cmBcX0dlKdmG80oW6KAh9F9FJ5za2SIarJNw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14a4329b-9805-4d30-5004-08dce76f7bc4 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:01:58.4695 (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: n33I6O5uEfcFDE8QiDRDOnys4QJcsVnnbX6c9chvuL6NtCji+vLE4EyhMJgGgXUWTx3QFiUUGCA2QzaaQTIgfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9343 This updates the Set Broadcast Code control point handler inside shared/bass to call the handlers queued inside bt_bass. --- src/shared/bass.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/shared/bass.c b/src/shared/bass.c index 9ee13bf4a..6efacb2da 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -944,6 +944,8 @@ static void bass_handle_set_bcast_code_op(struct bt_bass *bass, struct bt_bass_set_bcast_code_params *params; struct bt_bcast_src *bcast_src; struct iovec *notif; + const struct queue_entry *entry; + int ret; /* Get Set Broadcast Code command parameters */ params = util_iov_pull_mem(iov, sizeof(*params)); @@ -978,7 +980,19 @@ static void bass_handle_set_bcast_code_op(struct bt_bass *bass, return; } - /* TODO: Call BASS plugin callback to sync with required BIS */ + for (entry = queue_get_entries(bass->cp_handlers); entry; + entry = entry->next) { + struct bt_bass_cp_handler *cb = entry->data; + + if (cb->handler) { + ret = cb->handler(bcast_src, + BT_BASS_SET_BCAST_CODE, + params, cb->data); + if (ret) + DBG(bass, "Unable to handle Set " + "Broadcast Code operation"); + } + } } #define BASS_OP(_str, _op, _size, _func) \ From patchwork Tue Oct 8 08:01: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: 834139 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2054.outbound.protection.outlook.com [40.107.105.54]) (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 DE2201E9081 for ; Tue, 8 Oct 2024 08:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374534; cv=fail; b=CYQyGm7FaJ9z3L6yJW8t87dUVfGelGHr+MvL8vhCI9mUdRMtW7F6ey4ysVWBnLmg3lxAsbNqeVXgtT3dpwuMC1GoqH5ftpOrqE7Tygn89jXJaTKb6REniBkizb5ifsuit8Z1iXNVV6LxzyUYZgKOLlVAg6cKZ8BLgUyYXxNGu9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374534; c=relaxed/simple; bh=A6IOMRJooGNNGDR/RQDKucsOMgtNDO6tz9FrtGYYiDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=t1NTHmo9nw3inxrLvtEJ1agkO0D/eyL172zFWQp32z1R0skgk/rcsrXDil19rkEPAWZbZtfKR66+otj4YQoIJF1XIMQfo1LNOo0nlcQEsrCQ3MH3SKZLtT7ZvMTGvhH5wqE5jroTXoiOgaWKN40IbN/i1esTs1lKjvjHRZ/00gg= 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=KnIZPbQt; arc=fail smtp.client-ip=40.107.105.54 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="KnIZPbQt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fl6uYGpyFzn9avZQfvfprlRP2F7Nj9gbBkZPBY78GsCLJD6HRnq0vjfZuhC+pOhWsf9rJ4TGRaFqlwkEcyLVz0NaP+/MXxXDYi6ct0nAaA73OIUa9XTzty9LnK8i88VLwJC7I/YrRyNBfreuI6pRIJUlftLQsUjEVj6Iyg7fIhbWCfYPP1rzuruRWWObYf1p39WPx8CgUZbtD+GuNEKI9FrOavGamJnaj84/eHyZBral7HU0JcyEDGk1B5YZD9PcEEf73zDUwEyn+wz4Wo455KP2ehdmLUlsmfEDa4DU/26+addssAAvr58sm3glSPPYkI6h5sJ999ZTMargTU9Oew== 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=Pqy6fqiYHSurIGz6JjOnLqVJ5/TqLxCfBZPYD9vuJwU=; b=UJyqRvHI20eK2LmJlcbZiwpFlz2aaCOHWHKzF3b++T1UBZ+59/AU8yKAs/QuKLVpXXFGYdRI1SMRHVSixa3zwSJ1gFonHn1ncvqVprungkD2OQiSSgHhqZ8Nx5DKNA2CQRB7VPaOYNoA/iFXrygWSa/iTUL9HoJlkV2iJf6WNtccsnR2yYCnxIHK3DZEC3BOwQBsWuSciTgNkhJTKxMjv7Wi8qaBBE/abJEt0xt+EGSmKIDqz0wAePaUmTydxq0Q9LNbQ7Wkl5E9jhJsATvTgAwK28u1rKJrCeExtz1ChyTumvisNxI/q2tMCS5wXYqxH0cATHblikxYS4+ffmrxXQ== 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=Pqy6fqiYHSurIGz6JjOnLqVJ5/TqLxCfBZPYD9vuJwU=; b=KnIZPbQtE+E/sdt10Pb1QEXwPK3buyEWdYda40kV7POIwOwegEFSYUE3uwqikq/1Cs2vWiWms2sZov/TSlugMidQ/Odg4JplygwQS8eTvXUC03XGjlZkF5c284JvjIXd6tkvz1sxCZYGXgzw54Zd9aiYM41fheK9J2oWg999TZWlbEzWbTGhi4yacCdIZP9pZLcdFnzJ6qu4qIzGh3Qk4gMu+IW5H4GYgf5kndoFgfjQlrdYUiUc8b6vsnbDz1N3VSDt4qfFcYgQhc+ER+GKQysKOG547iB1H+P+v2jbfU+XWH288rknw4KgLuM5gdXrEvv7TPsqLv3OZaAtb6uUQA== 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 PA4PR04MB9343.eurprd04.prod.outlook.com (2603:10a6:102:2a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 08:02:00 +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.8026.020; Tue, 8 Oct 2024 08:02:00 +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/7] shared/bass: Set correct BIG enc state after sync Date: Tue, 8 Oct 2024 11:01:24 +0300 Message-ID: <20241008080126.48703-6-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PA4PR04MB9343:EE_ X-MS-Office365-Filtering-Correlation-Id: 71a38020-978a-4d7e-6d55-08dce76f7cdd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: 5ASZC8d2yjKSdFizSuvq5b3xzb35pCAfIa65hMyecp4/A7cs2mYZxg8ciTJbNAef9s2gz94wKMGGu9tUQFh0ffjdNoR7JlVhIneFmejzQtCtm6Dowi/WahMjtBKjCG6gHpIZrB6OsD+ciZjuRm4mLqB0jTQydPP/5RhLjNbb1pW3HYWPYZD8cUmPzf4tBOFKvKaxXSMDXfAtmOhWhuiCq0s84AQcw7d8YuYb2dkpR0xewkq9indqErFxLMjqowwxSerZ3W1HI/BXhrP+ClE1AVUepX+CVslVPq7V6mpLo+pTWuCaKjMFF1weslA0TwtNux5EmySnHXZT1v94xx+OOMKn80x6nl2jurWjCfqmnO6QOOA8zuHaPXTEYxP4qeRNkHCz7ujFHvYZ5zJxjDb85b70W+ZSPYb3cTe1TjxF3hqx9zlue1KghOLFBpNqa8sNs+2tn1Q55Ztu9++W1zN1VwNwXOwwPgyLphAesKdB41WfvwYd4bVse4rDBsyeUgg7tpnB3curQQ4ippDM4Hm+aXrffBKK8+R5YGfYRbUjntbQkNOsC8Ij4gsupKDPflFzmp40fY3UqbsDM/ilDZJIhZ2TpEWXYt2B9PlhMUuVGbSl8HDZhnqoggxUvAI1BsHG3/dPk07EctpCZ6mdZ2wT6D7Gzi+klSQbR5O9b8WcRJF0cGpnGJ5hQviJz8tivVLDGf4EYua2QVmQ7+BTQtCDrh7HualM2HM3srmzKj5VC+x4zb8Drhsjc4laJXkpfzUHpoS17ClO/uhpNmlnJzpRw6B+02tzI/FxrNONqn4uGHOp2o9KcgUYm4NNJrrqdsaay7q5VU8F7NJccZ2tLkD5nO0VTLPH3+Fw3XEmUo2cC2as7xWFmUSpCEylglhCLXZGkmdBITs96ymu7MtW0ainCgTxeZIkTzmXBrt5gc4GMtaBFEqk9tLTcwbj8/6j7ja1/Q5Orlzidq88akJmP4uhIxscVHR3GzOzoRldihyJOma+5Xt+0fHA7vFMXGSuLpRgHXi8udTWJC+wiJmeijuYXQdRgHOVqZIfETPD8ALVFcrt0fgRNb5dgJ71LvqmMzh3Xnw5XtqFayS077VnIkPSTIPJ6uLTbiYBL5XaChV22hG+wg9vKA8PkGzu21IP3oFQh3c9gYOuiT4RYssuldvK1Z+EFAHYmpGn8BzXWSr5gAvkPMzKwM3ZEe9zRlBG1IIVaC1Go0BfbDggPXTnoEaUTIMvkQmG0LzFPokXAgykcIxnzN1LcTuJBrRCjjqe3ylXLRyTg/89SntOhx2D9e9tSbZnqDrK/tdOcZnqVSFMWvGeghhdXvR/bJtvBz/c9bbnXgyG4Plv9g6dIpxT2OXT3Q== 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)(52116014)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OsaLdT1ssb4C7zKQpaUSYSEFMHLTMQwE/g+KqB5ucvdIWB/zdWYtkD2J1zVHzA1p8nlYOU3/wjCFVvxTiaTq5fibKaMrKMIPvkipL1CiGrpbezz2/6WFt56AHd4RaIC5pB30jLyqx3z17xBGTwJcVFh09BBUVTIgpPjZN1kOehU4lenQp0KpBv4nSBMENNong0Ov6VY9RW2dzHE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z9eeb43WELXzPZyOdFAqTFbkPNcfBcLnjWAcfbxTTaaBnKY6/sCEAjHAqgqhxXGE6f4fQIRgVz0mD+Qx/KImIgJ8ObRXIiZ1c0s9iCl19R9vl9vwMk7mq4b7tgh6YUzD6HjWNUHQxUstrreAccD8PZaUciJx5vqwssy8mkrf/Az8IhySaqKIvYF/Ny17nXFWfL/OW9cx2VHZ3f8IJuaV2skXv4AYmmi8DaqWOSFuLJFTGkN5oZCxkc/RTz9P/u3zr05fDa8diSTlZJkbVZBKtGMTHuQtP0NKFuoR2M5my/HnzeOVhkfvMyKDJP75N4e35wZzcwyIwXmw+R36QuH9iTKn/XOlg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71a38020-978a-4d7e-6d55-08dce76f7cdd X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:02:00.4039 (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: nUQMfndJVWpyygKQ/t3IUEGmS5GRgTvnmO+c9CjfTma2xJ1PfvhwlWFH++hS/7BRWfXYnzcTSeGOlvoj2Tmi1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9343 A Scan Delegator might set the BIG encryption state of a Broadcast Receive State characteristic to "Broadcast Code Required", to notify Broadcast Assistants that the value is needed to decrypt the streams. If the Broadcast Code was received and BIG sync was established, the BIG encryption state must be transitioned to "Decrypting" state, to inform Assistants that BIG sync was successfully established with the correct Code. --- src/shared/bass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index 6efacb2da..d99a140a1 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1793,6 +1793,9 @@ int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) if (sgrp->pending_bis_sync & bitmask) { sgrp->bis_sync |= bitmask; + if (bcast_src->enc == BT_BASS_BIG_ENC_STATE_BCODE_REQ) + bcast_src->enc = BT_BASS_BIG_ENC_STATE_DEC; + iov = bass_parse_bcast_src(bcast_src); if (!iov) return -ENOMEM; From patchwork Tue Oct 8 08:01:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 834137 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011026.outbound.protection.outlook.com [52.101.70.26]) (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 9BB701EC009 for ; Tue, 8 Oct 2024 08:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374594; cv=fail; b=UnBrLIefZNSgE8IeBQIpulkew9unml8dFjPWyGad3/1DLmMCCnb8AxwlF3evpOOg+BT44I7g8PJKnIAaeixwWlxgD7zxs+bQ0sJX1i3X/uj80BgH6JLQn7I9hdR6QzOUSJgkFSm5t9GPiXjci4+TYvE8tGamKGRSq0qAIUsi/uI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374594; c=relaxed/simple; bh=RUyi19NGnu5Qjw27bvdXpLu8ASEfs7JLSiJn6G0/x8w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=F+Opr6Cu1WgHUOrrdkrDcKZ+NaseFFEwYcCxkFYXW6W80DO9fdZ79Y54zqmFhMOTMQPiW40uDeEv9kW9pUaxg3oQ7O14YRx22DRhCzFE5nSFrscIhkLnCiMzViIQnHD/kj10VQSLQWsnLyxDC6BKfH7QK4ToEF+5mSocpkRUFqE= 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=f2aNgCKx; arc=fail smtp.client-ip=52.101.70.26 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="f2aNgCKx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Dhlzr346lCHsx2UQ349rqD4wJ/ggr1YtSoLBJsDWoBxnwZ0PDsqnq2Nmlyv34qlepntlRM7Yiiof+z1vGPgzsfiET8cr2e5yno8HHTI8hiTx5HfVWzyKGs0/CG1VKkucfXUvbqdpMHvJ03nBV4Jnh0rCTaLYEzO+VQ3iBfDDZnetiPKqpwtNT95OgvbDkYjqU5vPzI2YLCveuYF//rubRDUqR1TvRq86kvGjBCObOI2dslxgAME+v1mL1NhI5Iot0bJ0bkWkk6JFO8Bv+nh+7gTht2KdL2br/5tfde4tlHIwNktnaHlV8Bqx4TwNnZhW1J3q6iaC0qj102C1KznqAA== 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=EEJhkRaP5FFu636AxbzzKERfllyO0lYpiH1M8urg1hY=; b=s2y5nEv7He9/SKxznypuAt2ox9TcPhzdneBc/vGzgKTU7ITKAp3XAfn74qBtKcWASi9obICRZm5Id9SvKu2UINrIrY6rKYbimzqv12Fo7zTJksh6dYP0ODfBdMY0mlqP99/JNgSfydTB+WUkt/GkTHFIwpi5oGnBrU8KQkxeKWeKGwIeJb8Nqd46sjPI3xiok2i9yATDmXr7ugJftWz3mqH62HsX7pibAsHUHwNJ6acU5kVcOvoNaws3LG46iNo4uKWCNQZRfQY6PcA00Hr2FCUSt/PoVjuxEnc2zivV+kU2CprJ1mlLAwWc37czJmtbWfUpc31QAFr0pGgQKp+beQ== 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=EEJhkRaP5FFu636AxbzzKERfllyO0lYpiH1M8urg1hY=; b=f2aNgCKxYrxvXabxi2m8XVERR8i5upgh9KBhmks4fiHpqzWB6kPDLpl5/HejCGwbRIXuQeRs6UOhfnNJjZtkcf6TzHtu46d6JcoDGzJGBgf7BlPyer8Usgh0G3sna0Ha3BvETN3B3JRvvtvXnu8JQfTzaw+7B7yWy5D+L1N/cesHs5TdYTrrdG+1tLHDd2VAxkR/jDxxg80RIe1tAbV6dBGNETF6qe4gmZgTE9B9Pfam+g9A4Bpx2tkQzV7UGmoXDNcAju/ChoUTV/YBG45dKoQG0hLGnL2qtJNR8n/oDg2SXaCe6mHPR5uFZxP4JpGdK5HeNAe1sMpqKTben+uBsg== 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 PR3PR04MB7388.eurprd04.prod.outlook.com (2603:10a6:102:84::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 08:02:02 +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.8026.020; Tue, 8 Oct 2024 08:02:02 +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/7] transport: Add support to request bcode from Assistant Date: Tue, 8 Oct 2024 11:01:25 +0300 Message-ID: <20241008080126.48703-7-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PR3PR04MB7388:EE_ X-MS-Office365-Filtering-Correlation-Id: 67e0f4a0-aafa-4801-49c2-08dce76f7dfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: PJ1kyAXMm00UnsD3JcK4EDAwp2TMiN5991+7Yo4jHF+tSUSgbce9MlMw6LW1wm/ZtV+5MzWub0u9DVvNaG/W4/e5QfA1AYk8Aa18/BKGyF8sFxkHC7S6P6MJhFg4+/rjXAcvUkXi5kzr2ZBEZUx47p6aLLFftlnxghDLmD7sdFrQhZnapu1sJNOriZZ0hx87gR40jVLuv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FJIlD25p4oSJmAC0alJqxgE99+UxkUsdQDAjNvJgSEONivyVpqKz6N1ugcGJ+NWGkehgFsKHr9+kd0KLzemR33Zahw== 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)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JG9nEacamW6ug9by+yCK+pWzGZm2Np3H2DNBe2dQ6O0tH0m8brt+k7qdk26Om3wHTc+k3QIcys7Oii02OxUZmLzJqm60kr+NedRsjNIFYPBwH+6uKYeVYEzXF/i8X31bwE0npwTc42ITIQ5m7+NRrxpzOVXeUUw0Zw8ke/yRD+bNZOS1H5PuTlLC4B5gU0u1kJ9RbC5VlrVSLEfNkqbBTbJEhucAeOTbJ+uZlB6m8+SHGh7SQ7QUYbnzoqRyLgm1FvaArTe0VxltE74YVGSKwwCzCcfjNh/uAbpyBpUztpqy3VKQaVnQcLRhdOXVQF9LjrTBKw+64TPCNgFjQW78F68AfWQJD/dh4vFLQpPPn5jM7D6na9sn25icTErPnZqiwD0L6g00utyQCNqvcwjtuJqYvpTaoTg1zT57ZvdoVmHFYm2JGv6ShLqPuwqZhfuVNhTYSM1ysFrgk9DLZQoGD6FMpVHIZY01C8ksKcc9x84B5N3xxAO27+QtMnhi/dCX6318YWBGK8Cs5gC1S4ZwfPtISLQ7fsRp8iupZuU+iHwGP7JzfTDqzsgvF/e+nUEg6Qa43wH//dX7dDy0ShVMK0uFiU+UBfw8dmSRJGvlmFPzDoFvekcMdT0Ky1+M7Fk7ykcnBozTdzUE8V7I492dubDW2hmhj1Bb2RIPxAacyDjVTC5kd9zpaZDE7Lzn8VJXn0PiFe4cdXy1iUlAHyMJ1aoQtRMFJlMeAwWjbGrXlIap6YdnCvkLpDIzpjO4DtV724PAIInXOFnGB5ryH+mow6ZQXXsEYJQeMT+KmVC5d1lWiLXx7YCp2CLF010v154/n1QWX0o1cXgu9xOtDNx8NuAALmuoMiI5qBYKj7GsvxOcAnJJSmL6+IaSIwusczc8oSGmzc0hSmI2YbtRijbDRX/Ds8j7Am/3vMBlQQjGKXm4NmFYzUZvsUAXM5sHY6zw8SkTck7oc4IQUma0eij/aA8+Yw80pL+b0eUe/fKEXTbcb52Tq2l8RGbwoHsU1L0lCoHthy2D7MWT+s+QOnYcz6Qx6/rNUsNo8mHvvEokp3fIAmC7wtACVVE6yIkiH7VMxMGcayJ3EP9NnX+ECEdA77C5bQKVFEcT5phofXi5CnBtBtySwhRc2U2WSqyUHLY4uDw2mjcE5LTVrtGljki/bj+JznJOVQdu1VlJ+jkEDZVc4Jt9ACKfn4+/ndOaWd3GDNWqTZII0o5WA9VQyKpw8jivvx0L7zJdISiwTUNY025HFgRxhq7WUDM8uWI9RSj98RVRKnzE4b63MHkdNAp1xjmTrt/q69V63HIuj4mziaiF5SmiQWWYgfaPt5RyGPVtt3qPlFLK0UTd0vZRnKAlZx2Su/EKQAyweYfWr8ok0QnOS2qO3B/8OytKp8xXYOscPH9/phTEc0l5oMPXExy8oHls1gqr0TmXM4vQ4KlgoTW3utqdm7blDRMyqLWjwB8B+pPq4ijIPwjPb6DFRdvUO5NhpFbiX/QtGffs3pBrsKmdXPvKs3JVNhOVs4DOXpWZNKCx/NssQgT6YQ//acPvZVIhJo2RYVb5oCKvpvv/pvf8jVL2vYworIDpiasF5RqdmGf0+DjAo93jYRBYz2rvnQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67e0f4a0-aafa-4801-49c2-08dce76f7dfa X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:02:02.6984 (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: GKPJsx0VELCzx9eUXBfWmg0VPjSOWB5wTu65Ne93rSSFngE7f7cId1lwYhXPhjgsVx9A1dT+EhX9Nlx73l/3EA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7388 A Broadcast Sink might scan an encrypted stream, but the user might not know the Broadacst Code to decrypt it. However, if the Broadcast Sink is acting as a Scan Delegator, it can request the Code from Broadcast Assistants. This adds support to ask for the Broadcast Code through BASS, if an empty Code was entered by the user at transport select. The bluetoothctl log below shows a Scan Delegator creating a media transport for an encrypted BIS added by a Broadcast Assistant through the Add Source operation. The user is asked to enter the Broadcast Code at transport.select, and the "no" option is chosen, since the Code is unknown. However, the Code is received from the Broadcast Assistant and the transport is successfully acquired. client/bluetoothctl [bluetooth]# endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06 [/local/endpoint/ep0] Auto Accept (yes/no): y [/local/endpoint/ep0] Max Transports (auto/value): a [/local/endpoint/ep0] Locations: 1 [/local/endpoint/ep0] Supported Context (value): 1 [bluetooth]# Endpoint /local/endpoint/ep0 registered [bluetooth]# advertise on [bluetooth]# [NEW] Device 00:60:37:31:7E:3F 00-60-37-31-7E-3F [00-60-37-31-7E-3F]# [NEW] Device 23:E1:A6:85:D9:11 23-E1-A6-85-D9-11 [00-60-37-31-7E-3F]# [NEW] Transport /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 [00-60-37-31-7E-3F]# transport.select /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 [] Enter brocast code[value/no]: no [00-60-37-31-7E-3F]# Setting broadcast code succeeded [00-60-37-31-7E-3F]# [CHG] Transport /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 State: broadcasting [00-60-37-31-7E-3F]# transport.acquire /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 [00-60-37-31-7E-3F]# Transport /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 acquiring complete [00-60-37-31-7E-3F]# [CHG] Transport /org/bluez/hci2/dev_23_E1_A6_85_D9_11/bis1/fd0 State: active The btmon log shows the BASS GATT write commands and notifications exchanged between the Scan Delegator and the Broadcast Assistant: > ACL Data RX: Handle 0 flags 0x01 dlen 1 ATT: Write Command (0x52) len 23 Handle: 0x0040 Type: Broadcast Audio Scan Control Point (0x2bc7) Data[21]: 020111d985a6e12300f9bb8502ffff010100000000 Opcode: Add Source (0x02) Source_Address_Type: 1 Source_Address: 23:E1:A6:85:D9:11 Source_Adv_SID: 0 Broadcast_ID: 0x85bbf9 PA_Sync_State: Synchronize to PA - PAST not available PA_Interval: 0xffff Num_Subgroups: 1 Subgroup #0: BIS_Sync State: 0x00000001 < HCI Command: LE Periodic Advertising Create Sync (0x08|0x0044) plen 14 Options: 0x0000 Use advertising SID, Advertiser Address Type and address Reporting initially enabled SID: 0x00 Adv address type: Random (0x01) Adv address: 23:E1:A6:85:D9:11 (Non-Resolvable) Skip: 0x0000 Sync timeout: 20000 msec (0x07d0) Sync CTE type: 0x0000 > HCI Event: LE Meta Event (0x3e) plen 16 LE Periodic Advertising Sync Established (0x0e) Status: Success (0x00) Sync handle: 0 Advertising SID: 0x00 Advertiser address type: Random (0x01) Advertiser address: 23:E1:A6:85:D9:11 (Non-Resolvable) Advertiser PHY: LE 2M (0x02) Periodic advertising interval: 10.00 msec (0x0008) Advertiser clock accuracy: 0x07 > HCI Event: LE Meta Event (0x3e) plen 42 LE Periodic Advertising Report (0x0f) Sync handle: 0 TX power: 127 dbm (0x7f) RSSI: -57 dBm (0xc7) CTE Type: No Constant Tone Extension (0xff) Data status: Complete Data length: 0x22 Service Data: Basic Audio Announcement (0x1851) Presetation Delay: 40000 Number of Subgroups: 1 Subgroup #0: Number of BIS(s): 1 Codec: LC3 (0x06) Codec Specific Configuration: #0: len 0x02 type 0x01 Codec Specific Configuration: Sampling Frequency: 16 Khz (0x03) Codec Specific Configuration: #1: len 0x02 type 0x02 Codec Specific Configuration: Frame Duration: 10 ms (0x01) Codec Specific Configuration: #2: len 0x03 type 0x04 Codec Specific Configuration: Frame Length: 40 (0x0028) Codec Specific Configuration: #3: len 0x05 type 0x03 Codec Specific Configuration: Location: 0x00000001 Codec Specific Configuration: Location: Front Left (0x00000001) BIS #0: Index: 1 > HCI Event: LE Meta Event (0x3e) plen 20 LE Broadcast Isochronous Group Info Advertising Report (0x22) Sync Handle: 0x0000 Number BIS: 1 NSE: 3 ISO Interval: 10.00 msec (0x0008) BN: 1 PTO: 1 IRC: 3 Maximum PDU: 40 SDU Interval: 10000 us (0x002710) Maximum SDU: 40 PHY: LE 2M (0x02) Framing: Unframed (0x00) Encryption: 0x01 bluetoothd[5431]: < ACL Data TX: Handle 0 flags 0x00 dlen 29 ATT: Handle Multiple Value Notification (0x23) len 24 Length: 0x0014 Handle: 0x003a Type: Broadcast Receive State (0x2bc8) Data[20]: 010111d985a6e12300f9bb850200010000000000 Source_ID: 1 Source_Address_Type: 1 Source_Address: 23:E1:A6:85:D9:11 Source_Adv_SID: 0 Broadcast_ID: 0x85bbf9 PA_Sync_State: Synchronized to PA BIG_Encryption: Not encrypted Num_Subgroups: 1 Subgroup #0: BIS_Sync State: 0x00000000 bluetoothd[5431]: < ACL Data TX: Handle 0 flags 0x00 dlen 29 ATT: Handle Multiple Value Notification (0x23) len 24 Length: 0x0014 Handle: 0x003a Type: Broadcast Receive State (0x2bc8) Data[20]: 010111d985a6e12300f9bb850201010000000000 Source_ID: 1 Source_Address_Type: 1 Source_Address: 23:E1:A6:85:D9:11 Source_Adv_SID: 0 Broadcast_ID: 0x85bbf9 PA_Sync_State: Synchronized to PA BIG_Encryption: Broadcast_Code required Num_Subgroups: 1 Subgroup #0: BIS_Sync State: 0x00000000 > ACL Data RX: Handle 0 flags 0x02 dlen 25 ATT: Write Command (0x52) len 20 Handle: 0x0040 Type: Broadcast Audio Scan Control Point (0x2bc7) Data[18]: 040161616100000000000000000000000000 Opcode: Set Broadcast_Code (0x04) Source_ID: 1 Broadcast_Code[16]: 61616100000000000000000000000000 < HCI Command: LE Broadcast Isochronous Group Create Sync (0x08|0x006b) BIG Handle: 0x00 BIG Sync Handle: 0x0000 Encryption: Encrypted (0x01) Broadcast Code[16]: 61616100000000000000000000000000 Maximum Number Subevents: 0x00 Timeout: 20000 ms (0x07d0) Number of BIS: 1 BIS ID: 0x01 > HCI Event: LE Meta Event (0x3e) plen 17 LE Broadcast Isochronous Group Sync Estabilished (0x1d) Status: Success (0x00) BIG Handle: 0x00 Transport Latency: 960 us (0x0003c0) NSE: 3 BN: 1 PTO: 1 IRC: 3 Maximum PDU: 40 ISO Interval: 10.00 msec (0x0008) Connection Handle #0: 10 < HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13 Handle: 10 Data Path Direction: Output (Controller to Host) (0x01) Data Path: HCI (0x00) Coding Format: Transparent (0x03) Company Codec ID: Ericsson Technology Licensing (0) Vendor Codec ID: 0 Controller Delay: 0 us (0x000000) Codec Configuration Length: 0 Codec Configuration[0]: > HCI Event: Command Complete (0x0e) plen 6 LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 10 bluetoothd[5431]: < ACL Data TX: Handle 0 flags 0x00 dlen 29 ATT: Handle Multiple Value Notification (0x23) len 24 Length: 0x0014 Handle: 0x003a Type: Broadcast Receive State (0x2bc8) Data[20]: 010111d985a6e12300f9bb850202010100000000 Source_ID: 1 Source_Address_Type: 1 Source_Address: 23:E1:A6:85:D9:11 Source_Adv_SID: 0 Broadcast_ID: 0x85bbf9 PA_Sync_State: Synchronized to PA BIG_Encryption: Decrypting Num_Subgroups: 1 Subgroup #0: BIS_Sync State: 0x00000001 --- profiles/audio/transport.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index caa7287db..6b6365289 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -35,6 +35,7 @@ #include "src/shared/util.h" #include "src/shared/queue.h" #include "src/shared/bap.h" +#include "src/shared/bass.h" #include "src/shared/io.h" #include "asha.h" @@ -45,6 +46,7 @@ #include "sink.h" #include "source.h" #include "avrcp.h" +#include "bass.h" #define MEDIA_TRANSPORT_INTERFACE "org.bluez.MediaTransport1" @@ -1208,6 +1210,18 @@ static gboolean qos_bcast_exists(const GDBusPropertyTable *property, void *data) return bap->qos.bcast.io_qos.phy != 0x00; } +static void bcast_qos_set(void *user_data, int err) +{ + GDBusPendingPropertySet id = GPOINTER_TO_UINT(user_data); + + if (!err) + g_dbus_pending_property_success(id); + else + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".Failed", + "Failed to set Broadcast Code"); +} + static void set_bcast_qos(const GDBusPropertyTable *property, DBusMessageIter *dict, GDBusPendingPropertySet id, void *data) @@ -1230,10 +1244,28 @@ static void set_bcast_qos(const GDBusPropertyTable *property, uint8_t *val; int len; DBusMessageIter array; + uint8_t empty_bcode[BT_BASS_BCAST_CODE_SIZE] = {0}; dbus_message_iter_recurse(&value, &array); dbus_message_iter_get_fixed_array(&array, &val, &len); + if (len > BT_BASS_BCAST_CODE_SIZE) { + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + return; + } + + if (!memcmp(val, empty_bcode, len)) { + /* If the user did not provide a Broadcast Code + * for the encrypted stream, request the code from + * Broadcast Assistants, if any are available. + */ + bass_req_bcode(bap->stream, bcast_qos_set, + GUINT_TO_POINTER(id)); + return; + } + bap_qos->bcast.bcode = util_iov_new(val, len); } From patchwork Tue Oct 8 08:01:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 834138 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2054.outbound.protection.outlook.com [40.107.105.54]) (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 1BE2A1E909C for ; Tue, 8 Oct 2024 08:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374539; cv=fail; b=kl9w8JiRSGjjloxS+RWDWqkhTd3N4lGS1aXtoNDFgPz1+urROwgruqNkw8FGm4tchBAujVorF6N7eDLtnxz5hn6TtX7k92NUh4GWuCkaIOIRYGH4A+NES8v5a7bLYHWyBZvwFc6yasANneazO4VNXbJpTu8wRi6sAMo2d0TDhFY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374539; c=relaxed/simple; bh=zpFDv7QqBEJDw5Tn88XPbwfbUGZSFMTC41Ulvgncgj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=nQ+9p9OT/Ujy7OmN5FgOxRDLbNsRegVX+9YxuAGs6b6b9jyKQhuDXu6Of2/baOt5nSgYkaHWMpDP7kHjhfvujyo/qlPt+OQV9FKpUnbmAhaHup8XLL+CGwa+5iqTY7iraCglq36pLhYzTAGVK7DN+09QYlwPp45GTbKEI/0Jkt4= 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=AZ2FY097; arc=fail smtp.client-ip=40.107.105.54 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="AZ2FY097" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sJcgEalZsYGIPLfdamzltiQGQ7XWdBvUDgGbpOhs7MmgZmpiYzgWj21abqiKvm/P7wBfjjCJtpkHNoyy8Y5h0BtVqvoQ5wQkQM8MyT2mi4A0CRfTtyxPusvMjZnmlPzRnzrYkp8q8BrqJJVklBI+YdreSRUwWwAU4mYaaGGGJYuiRCFQIV3Z8n2SBbBN5BFS9nclvr1sMbbHsBTiDEkV+Pj4m65i/ECXTWyrYlpzPWLjenJuafzC6FZX9rCDJ+6vNKh1K4RG8EeTBwgp5sSsoWSz78hAoIWJhn4MpdjUgSGDN9qqQ3wP+IoBeHIBBfmZNJMel3w+n83IqiriyFXn9g== 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=AHkrfc3RAByY8yg+OifplWQe6K9H7Q1OdEMveEsVVWw=; b=dCMTgkLDauOZT4hQy+kt4LmuSTY57C1FX4LZ+/dTP0XQG70Vn2ngzbtWtMfcGJZbPad+uFj7PDIrEQ8Bpqe8VjkvlHHRQMNUqZ2frVbl+4fVNhTjEC14EFYwciLRAOP0/APYQlZifMyXdWvvLWXrhtfndTI/QRXJSCleegNR0s4UEf5uHDtW4TlpRrTT1DDnUBWHhS6dDt/nYi1YrQPvPb/cc8MGf23vTSUVHd6ss/pBAB2LT32lAF+MMpOS1olkISjnUTtPco5cHVlsq1kEes+f+SSZETTPPbCs8yag4089f7zBtu9oCCEsH2bqSQPe9fEXMY69B4YUGHdsKafS6g== 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=AHkrfc3RAByY8yg+OifplWQe6K9H7Q1OdEMveEsVVWw=; b=AZ2FY097Pn02HtffWfJUzRZuwoV7MLj+Kz1zL25ju4/A5G+jTS3vOCpLYH0cOIMZMKFHZaYb7Ma37K9GoEo69lLzyEFVc9JoYl47Dueh2oX1UOj8fFVZ0FIIbCKxTy7BaVUjHj/PUiYKyRKJ4L5jR/T6KPtIjzWHBU8kYwoiISnDuRE6njv/QefJ6pGbj1SzGPSagd9Y3HKw2gkbv1ivfrR2IGE54OAQRDsrt8nZx/YiOl0FpEC/0bhoAy/TkC7VoaWChta0RQ/NqncYYY/xonvSnOkj5O4DhdKxawOPMhkZZLnrNgLsA4HazoFArfKimmtSBrdULSMyT1yqObLiRg== 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 PA4PR04MB9343.eurprd04.prod.outlook.com (2603:10a6:102:2a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 08:02:04 +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.8026.020; Tue, 8 Oct 2024 08:02:04 +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 7/7] client: Update scripts to include encrypted stream scenario Date: Tue, 8 Oct 2024 11:01:26 +0300 Message-ID: <20241008080126.48703-8-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008080126.48703-1-iulia.tanasescu@nxp.com> References: <20241008080126.48703-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR05CA0087.eurprd05.prod.outlook.com (2603:10a6:208:136::27) 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_|PA4PR04MB9343:EE_ X-MS-Office365-Filtering-Correlation-Id: 06a964bd-ed41-4a00-38b2-08dce76f7f40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: cE4tuLoI7tsEO1kyIPkkYabrY4/Jz/+EUD2FyM6KoUMBXyZ2Yc5TuPyE+0SHao2yB4G6mCdEbakTcX90/LDu+Tkj3Wq0K9/BpcmIpz8G6xlewyRFpfZx2gDhbPg4bqJtXY4b05GjQKxpNdC/MttkiwxGLoJTIuc7gUQJrIlM1f1PbuHU3x1zpuEqQ3IzBhVqk6wQX+/ogrnC1OLTvmrvqh4OxQ1RqRLYXdlF5xyBFL4mkmlkXf0T8hKzBDkS1csjNwhYAD5XyVZsKsZHPTPOXJEL6Yk/2c1JWvzM8twJ808l6eriJu4B3eKkbtS7UqKJkNjJ3Jkzhr2HHn3RTRQgU5FtbYsqa2ngCgUKXto4qUZw70dVIbnIsYwCFWsr7LEWOWzKVYQ2gnOjZD5lIAmrJi7ZinMfbX9VJZBI59aF4EqTzjenc1BFw7YzcmMq5OAF5hQLdDv8X7vZfsQNsLDKDbRt4FewHrdl4SGTjLI3JZg45U2aWPiUSWVgTw3BBLiTvF7Dp4Dq4ZEh1qwE4BLAkX5HXhtv7KH3JRIgtRSsUcuAGvsvu/xRc41qTbLuv1Ai2CyUiehs015PWIecJv9KM4plv6vqxLInBthBhusktJ45BDDogyjWsRHYEOEMOq9hctxEj4y3XjbqF2hvYbGsIor6hfvuwnzvAKx9DnL5gzIS2t8REjPuQbLj3PVAGKWX3Ppt2nYetly6uLcOATWK7YJPUhr3EnT4gHl+jPNTUYf7uL6judlDbYEpC7NSL4a6owX/Z6mzbVPb+k9BSn1816hBD4pCG+LxqRl3vga8vx9BLRTjL3qCZZm+yhVLrdgCy4CBNpm/5Tpv4/CuqziEIu1fNeuS0tR4ak/jq5qHYULPmGh1ohkO56hEQIBqbpcXuvLcK+vEhWnuMCyr5NlZwCzXoahG3AFo13mh3DX+9snu/Ytl3/il9KdDFqynC3n5ebW576q8tacSeNNgHLSoHtjBVLiPvCYYyFXv8qjTONEcMJC2RZ31SeFJWQ4p3YYML3o6EZa5qcihgnzyoXB9cB5DBNdueARZn9w+xSVlPR15uMPe27iOY0SCpcsG847boM/hJ95dfeO9Q2WnPVv3oiWDFbNCliIy/JEgOwetnd3DGDwyNj/jszzkrleX6q2ghrfAn2X6znz9Js/DC6gATXcrtQHtSkCECYBPJs+GISsgzuJFvycOS225FPACYp2YquNazAqZS/9XvazU4PsKuPOukpBqqWbipKdhKQo/LnXUzTgVk2HnnZJa5E8+EyI7o50VLhtBe5reKba/GUUJiaIWPyPGuj8uruW/drx8sX8HoWsA06R2q1+8YCy0c1bl0G3LHQNVXIcOz9Ik7tUjAg== 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)(52116014)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CsT0eVJ8G1C+INWNQob2lSIQ/C/EyVXL8ki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hmsqNyyaOn9j5/wSysbHzHNI+utx+h0aDpw2DV5gxrgiWYtmm1Y3VhA8B1swNHkH+HNwsabbKhV45aJTzEoH0cuONPTeT8DpAz0qYqdLg8BbHu9Ma/aDF76+6zletQPmdDeJHAsAKPRgU4AwSl6oFQ8fWyEH5Pwg3dBjnnL5nsPbj//nrolaUObBmPw29aqsqlVU0/zA1QnWfL5EAgXeXO9mxRsNn619BukUuNIVpNhDuLtpA+x+fX6BxoOVEg8ccbVbKtghjBZE35VjWpVTCadggVMU9c4weYmSkq9FdNLSZGc/nJHbWhAFwr6w1Mz9WWLWvJ3Y9ouvW4LTqqs6lFhtTzU3kT/3AnVgT5XI+Evz2UouclZK93y3EhJ1lzlhRkOfMa/YkxQy2t61DDMbuehXPV8OKHpgxlHw8L5RaVmYhlCMbRpsLUf4d/Xu6GeItJOmaz0fBvpvfTz7OkCPU/+dqMS90MDJYYsd6QprhNCBfP1IngfnJtz4A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06a964bd-ed41-4a00-38b2-08dce76f7f40 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 08:02:04.4740 (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: Px6+SnMaNRw2Jw6gWBYs7L1EyYbokdAZtgPJpC0ySO/P58BeHjyHVlojXoLsd03iZzmXeqlhu8T/Rn0vzSswkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9343 This updates the broadcast-assistant/scan-delegator scripts to include the encrypted stream scenario. --- client/scripts/broadcast-assistant.bt | 5 ++++- client/scripts/scan-delegator.bt | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/scripts/broadcast-assistant.bt b/client/scripts/broadcast-assistant.bt index 15e9d0980..81bb147a0 100644 --- a/client/scripts/broadcast-assistant.bt +++ b/client/scripts/broadcast-assistant.bt @@ -25,10 +25,13 @@ scan on # using the "push" command from the assistant submenu. When asked # to enter stream metadata, the "auto" option will keep the LTV # values advertised by the Broadcast Source. By entering new LTV -# values, the default metadata will be overwritten. +# values, the default metadata will be overwritten. If the stream +# is encrypted, a prompt will be displayed to enter the Broadcast +# Code for decrypting. # # assistant.push /org/bluez/hci0/src_yy_yy_yy_yy_yy_yy/dev_xx_xx_xx_xx_xx_xx/bis_n # [Assistant] Enter Metadata (auto/value): a +# [Assistant] Enter Broadcast Code (auto/value): Borne House # # # Wait for the MediaAssistant object to transition to "active" diff --git a/client/scripts/scan-delegator.bt b/client/scripts/scan-delegator.bt index 68c7fb498..5ff7bcb89 100644 --- a/client/scripts/scan-delegator.bt +++ b/client/scripts/scan-delegator.bt @@ -18,7 +18,22 @@ advertise on # After the connection has been established, transports will # be created for streams added by the Bradcast Assistant that # match the audio capabilities chosen at endpoint register. -# Acquire the desired transport to start receiving audio. +# Select the desired transport. If the stream is encrypted, +# a prompt will be displayed to enter the Broadacast Code for +# decrypting. If the code is unknown, the "no" option will +# request the code from the Broadcast Assistant. +# +# transport.select /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/bis_n/fd_m +# [] Enter brocast code[value/no]: no +# +# +# If the Broadcast Assistant provided the Broadcast Code, the +# transport will transition to "broadcasting" state. +# +# [CHG] Transport /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/bis_n/fd_m State: broadcasting +# +# +# Acquire the transport to start receiving audio. # # transport.acquire /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/bis_n/fd_m #