From patchwork Mon Nov 20 12:08:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Silviu Florian Barbulescu X-Patchwork-Id: 13461131 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="B+SbHxZ7" Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2057.outbound.protection.outlook.com [40.107.241.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A076B8 for ; Mon, 20 Nov 2023 04:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lbRxPYrhJss+mA9G2k6nhOu3rTERWKwx1pu2X1o0TTmg6+lG7ntHFQuK4NtoDe1hfHE3Fh9PMF+i68c7nICR6DsFJcBCkyD1Bv8JpvFiUrmRTxEuU+1cLyGCHnJRcFGAMy026Ak6AmK+LtzYQkwQW3KoQW/xaHRzVzqudy4f3C9s4amIuockpA2BX4lp4i8Fab6w8W0OzPOc6mJp/WGeY/gSWogcDrond+WULG8LRqcV0LXdZK9lFDB8dUSSn5f0ANfQW0zA5uTd4jQbat86ffWF/2oIHCpPThVIGIY5UqBuko9TOZMP+8N0ow6nHz/dL6MIjlvS79TU8xqXEbBwrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NgdfL/cxWX9/zPA4c0BdYvFW3iINckaRP01RLZreDCE=; b=fxTA6JEUTUp7oNl2CjJt02mOrKa4Ujq7P6sG1MPf/MdfFE+9WnLRJRGXUHOT/bAb05HYS8FkrPq2vZzl4EoJM6slCzr20IlsBLusItpuIQ9NhdYklKd3SI+9qM35cMDZQN4/KR7+IsrLVkdpQcJXqtcN9aCoTjLHxwwWqDz2+L0akT08iWSMVC87eX25h0bDx3gNd5AxqId0jYlf+VRRyytYtMMjMOOmxgIDnlljqEkOZok24c6TKSvnZCB9Tcs4o4I1heACm13EY6oflfIbv2TieAHgp7nmJZBKmDX8EYlG8Xho1Rcv6yaGGAfxZd0yg83s9UYDJLG/XhGb9Ahwnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NgdfL/cxWX9/zPA4c0BdYvFW3iINckaRP01RLZreDCE=; b=B+SbHxZ7QXwVTcr280MZQUFHoHUtKjLM4Ors2D7jjnHskjbHTScobfaBHIsBzHAb8RL86fR17wtIpLKGy0B04eB9uZdQQGKiokWALE5VYFCswui0pM9lQDFmbAXRmQanKaZEZHDjw9heQ6Vr6eNq4W9mNVgiwU+3TfTxAudgroU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) by PA4PR04MB7966.eurprd04.prod.outlook.com (2603:10a6:102:c1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.16; Mon, 20 Nov 2023 12:08:49 +0000 Received: from VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::c38d:98a0:a823:d88a]) by VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::c38d:98a0:a823:d88a%6]) with mapi id 15.20.7025.014; Mon, 20 Nov 2023 12:08:49 +0000 From: Silviu Florian Barbulescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, iulia.tanasescu@nxp.com Subject: [PATCH BlueZ v4 5/5] client/player.c: Add support for multiple BISes Date: Mon, 20 Nov 2023 14:08:31 +0200 Message-Id: <20231120120831.5353-6-silviu.barbulescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120120831.5353-1-silviu.barbulescu@nxp.com> References: <20231120120831.5353-1-silviu.barbulescu@nxp.com> X-ClientProxiedBy: VI1P195CA0063.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::16) To VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) 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: VI1PR04MB10073:EE_|PA4PR04MB7966:EE_ X-MS-Office365-Filtering-Correlation-Id: bed742e9-f690-49db-71e0-08dbe9c17446 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wCwtoktjEuvwMfFMO6CVJ1KKL6ZezKvXgbddTWNiGxOnRnmmtCXaQyOLLWJjguq94UKfLxfGOpIAMSj5AVudsLLSFGQpZK96fuKfMY3zBmNTlbC7GuiEyk8t0KtDY2fUAu823RMe9TXIuiMtD/aDH5BuDPZMe4SeFhsyseUsXSHqyKeOvIgxvkA4RTVIE7hTG9gLkd3s/lBoibUUpNYGjoX3NXO7i5dClvp4XF3c224uuc3kIUVkIBK19bMUq5jaw4pTsafXMXCsOc3CzFXEeDrcugv9sn8o/QH/ibrFwGX4IXLCtZX3//MFqNYwSKx64ghD8CtS/C7seN9ZJmjATaAArv7wowMWAgpN/j9z9VAgs+vmrbOwttJD25+GkLImH6esSFkh7yVNhrxLh7Pia+Rd5PbhVkA0J0JwXVmOmBdkExqsyC+j4TOIYAYbceWkzHM8VT3JSMVkZiiJPCWHlOGwfJDxupEx+OZOBugt/x+9rvF0gtVz9Uax2HtzbDgl/WXDqxyIoUl85mwiHIq3y6agAjQ6ugRn9jbc7JLnuNtnWTB6qLpRHK8Hxq66uMuR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB10073.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(366004)(346002)(39860400002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(2906002)(41300700001)(8936002)(8676002)(4326008)(5660300002)(66476007)(66556008)(66946007)(316002)(6916009)(38100700002)(6512007)(36756003)(6506007)(6666004)(86362001)(6486002)(478600001)(83380400001)(26005)(2616005)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J9oDslWr1xgSCNbx9CS4KrJ96cpznmgUDq6vEV0mA8g60bp28nQlZfC1IKCrEclmYg7Bf/yV/RlOYKbLQAyssDTB90wTJhc0Fy8cn5t/Q7xzqStYXZO0Z6yfMCH568Wf0zvNQCRzaIXw0jfZOcZj6bTa29/e4+mISH9e4XdIIWM2sW2ISJJwqSFqcwhEg1bh9cooiROGvnZXunTrpZA5t9wv/17AZCE67lg2NlAnIZRmnhZmcLQVxK4EEvFmehAgGHH8XMUc/76sbnJStYdIRrzyt2Q0rfO9y0Pvf9x+BGNni01EpN4Qv4x0LoGmoTuh5d6uwK84nl38RDmhrQkBgtX9jnUjmNeyVDUEnBeTd91fd7uAuZlrpNSD6FkqF9mUZyWViNFERQZeYHx72ElAnz1ZL2uaZuoKfYKSa8ci3jIvbU0eQWGVCe0r3Qz9G0JstauxV6ej7jgBZ5eSUKW4n5vsdhRX25wRyI15WfFXtlnOHa4TKB2hS+vWKhcRkc6/g1sT4Sa50KF0IdwkCGyVX2fi7ND1SjKOO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g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bed742e9-f690-49db-71e0-08dbe9c17446 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB10073.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2023 12:08:49.2998 (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: B+K55GhR9gTrEY/klwYCWn/tJla1tDXRPMxMUeG4pztPtGoABYk155QlwBVHbYYXAr3GC1FxVVYmcgdxLWSomTLXK7PKbvFNOPRol+AfPLM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7966 Add support for multiple BISes Register the broadcast source endpoint endpoint.register 00001852-0000-1000-8000-00805f9b34fb 0x06 After registration a new remote endpoint is created Use the endpoint.config command to set the BIS codec configuration by specifying the BIS when prompted by the command endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 16_2_1 [/local/endpoint/ep0] BIG (value): 0 [/local/endpoint/ep0] BIS (value): 1 Based on the number of BISes seted in the base_lc3_16_2_1 more remote endoints wil be created (If more then one bis is setted) Use the endpoint.config command to set the BIS codec configuration by specifying the BIS when prompted by the command endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 16_2_1 [/local/endpoint/ep0] BIG (value): 0 [/local/endpoint/ep0] BIS (value): 2 Use the endpoint config command to configure all the BISes After all BISes are configured, use the transports to send data --- client/player.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/client/player.c b/client/player.c index 715598aa9..e060e6a5f 100644 --- a/client/player.c +++ b/client/player.c @@ -2999,7 +2999,45 @@ static void endpoint_config(const char *input, void *user_data) endpoint_set_config(cfg); } +static void config_endpoint_iso_stream(const char *input, void *user_data) +{ + struct endpoint_config *cfg = user_data; + char *endptr = NULL; + int value; + + value = strtol(input, &endptr, 0); + + if (!endptr || *endptr != '\0' || value > UINT8_MAX) { + bt_shell_printf("Invalid argument: %s\n", input); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + bcast_qos.bcast.bis = value; + + endpoint_set_config(cfg); +} + +static void config_endpoint_iso_group(const char *input, void *user_data) +{ + struct endpoint_config *cfg = user_data; + char *endptr = NULL; + int value; + + value = strtol(input, &endptr, 0); + + if (!endptr || *endptr != '\0' || value > UINT8_MAX) { + bt_shell_printf("Invalid argument: %s\n", input); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + bcast_qos.bcast.big = value; + + bt_shell_prompt_input(cfg->ep->path, "BIS (value):", + config_endpoint_iso_stream, cfg); +} + static struct endpoint *endpoint_new(const struct capabilities *cap); +static void endpoint_init_defaults(struct endpoint *ep); static void cmd_config_endpoint(int argc, char *argv[]) { @@ -3033,6 +3071,7 @@ static void cmd_config_endpoint(int argc, char *argv[]) if (cap) { broadcast = true; cfg->ep = endpoint_new(cap); + endpoint_init_defaults(cfg->ep); cfg->ep->preset = find_presets_name(uuid, argv[3]); if (!cfg->ep->preset) bt_shell_printf("Preset not found\n"); @@ -3068,7 +3107,12 @@ static void cmd_config_endpoint(int argc, char *argv[]) /* Set QoS parameters */ cfg->qos = &preset->qos; - endpoint_set_config(cfg); + if ((cfg->ep->broadcast) && (strcmp(cfg->ep->uuid, + BCAA_SERVICE_UUID) == 0)) + bt_shell_prompt_input(cfg->ep->path, "BIG (value):", + config_endpoint_iso_group, cfg); + else + endpoint_set_config(cfg); return; }