From patchwork Wed Jul 10 08:13:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 13728986 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012059.outbound.protection.outlook.com [52.101.66.59]) (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 65D9884D0F for ; Wed, 10 Jul 2024 08:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720599247; cv=fail; b=cbYAuwjiTgY5n3FtnFeYfnQWohN9rHOnZE9Z5wyy/jQfPSnbff5bhuqabWNK1tqg2rV5jfYLCLjVU6LaCW3dAYbUdflzNM2nctTUb9wZ5VxJT5acmSZY90+rEL7bc8QO+PlC1T5Yl8j5Coo3CIG3YySRdZoAbGaybJWRplJYf34= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720599247; c=relaxed/simple; bh=YjvdzgaXzpBlUl2V4rpuOI5M8l0HgE/+uLbtDLJwpvs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=X9n4ZWhYHRzLskkX00WwAaKVy/hvoSivQ/fbAI5z3ekh7t9PtPsSd+p+nPlHIFGO0SiRxrshyPu+O6kLuHkYNRaZ6VCnGH0QmSetzbm97rJK49Gp0fnE24EbS6tPddslLhjlZCIBzv/99SMxRWsPrJ8u+THjF+C+nZoem6tvnH4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=oiZJZycI; arc=fail smtp.client-ip=52.101.66.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="oiZJZycI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DXxDyMBQ4oj4DxKEdF5TAxX+MCyjVbbxJ5Ox4yPrUL0A/dQvAxn3yAc/xD1UyoP03e8tg7rGLnrlE+/ZuwohblSeTUpQomKu3JVFZL6NRcg6/vpATnhII4YI3J71JlH41K9MrJBlP7N0lkBT8Z+xvN/4bZXutZyFIytIe6N5n6ObrnoQNkZVVb0nbo8q9TAeu0wRV99KdFTtQj6N9Bkbdcbzk/YifVJNkAPoD3WUJJWlwpppIxai9jx4v2SJdF12ZcfbHkqJ8VRWF+zCc/L/J4/zcuUx6fXJws2MD7TzXb0YmGzHC9xUuKFRFmnHZcAN/G3gbcdp7hrObjkFYes/pA== 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=33LM9qldiF0tWdBO559Y+C1iVarkxZwsDkQ76HAThJ8=; b=Ph43weH9RoazTfKqnUBRmnhtcnZEimMVt4gQBI5bprj+9MpM5mkBZmfDgzI3xMs21IRARa+GFWOWjYdmMurqrllubQpeYaS31KFTcCBcnqPTX3JAl3rq+VQ1jQeCtkIfAED10+YolOTRiRQkR53GyvIr4I7UwykWadJc6rXvwuPDr+QuBd6p4elRqXYu0MTkMJF4kKWlKAebB2aqTuk5vVQFhDMA6+lId/whOvS/SxaIu2ntNS8/K+Plu8oQdletrWjBpTecphSjUf6VnBUrISHu+SxSBQjlitUBifej7CHWd2UuLNTp0b8wpbU51gWV3JL51T+U1kbP0QAHJ1lQ+A== 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=33LM9qldiF0tWdBO559Y+C1iVarkxZwsDkQ76HAThJ8=; b=oiZJZycI8cCrrDD5yWO2V8FnuQBQrQV6HOTx962P8UF9zev9lJ/u19F5yV9/asuV9411kVkhM14H98ayulpe9yjGC3wNwzSfIi9Hf4ZL+AZ1xa7g6yqgQVaumwVUffIbZYKi32MRPTxYG/4h4MbqGjTf+S+MnHVsFkejgBaP1mM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by PAXPR04MB8864.eurprd04.prod.outlook.com (2603:10a6:102:20f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20; Wed, 10 Jul 2024 08:14:03 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%4]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 08:14:03 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 2/3] client/player: Expose transport "select" method to the user Date: Wed, 10 Jul 2024 11:13:37 +0300 Message-Id: <20240710081338.17262-3-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240710081338.17262-1-vlad.pruteanu@nxp.com> References: <20240710081338.17262-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0212.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::27) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|PAXPR04MB8864:EE_ X-MS-Office365-Filtering-Correlation-Id: fce11c67-12e6-4364-9585-08dca0b842dd 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: HtZ9r/S5GfFu5SCp8GuIwmmXqsw+fBlE7SETYRi1oJ15qNlu9fLEptPxOU8QDX+G1zN2GvycDMUESc2c+h18ILbDgqPX5UFoxaZMmypYfEc5EyzfOyHSg/e4LHKMneEy8RLErDgOQ2P3tAxIX0603WR30//EViJcpHKyGdFFXcGSmKO3UHhHTs02lWlK1se3Cvl/ExV0XGE2DAhQbm7E3fywnoo4y0+6h/JGkQ7bhJiya5kteuVtWCOWM2Mzcu6HUQfLXj2EciaSMYy9NyEW/bevHGTlW2HoeWGI/WWkLejRuEb7oSqdVSof4odi46r72UyY3VYFi8sYDTMtTT4OhqMFZ+jbGIEW7dzOygClm0KQZ6dTDQmfaYZ+Wz+sZJ/LqVo1hDLsgTW4tO7uVDfpq5Ay3KxI7SBORm+locO0B4lhBb/XcPnO0Hew6XszcC1xrvCONdrjFLD3xLfe/Cs3FUuzkypOB58BeuDsp9IfK0d/ySqdf6PDCk+H/L/DSy8R2kDRNqWY+95+nZUUE7+wjwZC3LkE9QZTA67eAW5vCtwcVtzX4D2PIPTewF6MBq1ge/at5RelXo+PXyDLQw//Oe8eiXuAhnadG7j2aji/tz6+27M/gH7Xg66gbk3SOqFjssw0/Pmndk3Le7LUlBivnqeubuGy4KgP8l3Kgh6l6KiTgdSS6mCxNR63EuAePFopdMmxGx0bohQLwGHvBMib9jfwUya8CLFqR6RQMAdlE1VGjxITb97xD/kBlKVmWso7LchXTlglYelDN4rJg2h8bAlHe9pCDrEtZJCV5L6uLAQzZnxD10vVPzrbAxflkCyvnSGYnnN4dwYFCsBhDh6Mke2OB3HtxUDQyQUjO8p5JCHIW+heCdZNebOSpRrzpml2YVD7pIiFCjFTbbBZi8I45lfU6IMnaoh4gn9LrfJaCikwH4Si3jgwsw6DHAidm360sYJfQ4VI5RP9uUTS4NnxZHjAdd81Z6vMX0Kk0zZ9alCh5d4JCRl+moM5VFYNlMXFVddymSh0amEUoT5tPBoQs+pVRwzwzQUqPg6FM+A+pNnfXRIHTMMDg5+Y/D2yf164C72TyUOE3RgRYNK0Fds3RWjmX/bNIcLWQxQ6e1nMIrrdYz7WDBj4fZuNyXlneZb675teuGMV+GI4K3ckZ5gfJUccz23juUQZk+a+EnZtfvd52zMXD7BkiHOax8vtzBWnS9VNUe7kF21LgrqEPb3awSMbne+Lv4px1/GQf9v1/je08QBdxw0XrlXZraEVhBhizeqol66WBztHuSVcSE990399ttLwVhdWUzZ1iFMKQ0Egh3RpOIzESP8YMLJAz/Sm0zdWxHSaHAWQqrFnvlnSLfpJlohF7iMMxH75j7UwsslHXj8OFnS0sgckCh+uE/EIgT4R0n8dt84fbFCTPNj2qg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9088.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: CrLWmtwPsNSQQbyQEn2HT5P5BIRqzISprPLIMFnZ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2RngJmK5CCCqypwTeOd+xaPS7nWdW6cHstyqasOWAsCxh0RDnlsS7gyMEZS/cq5WvOB55rDUZdkgsvgDhymHzLROTgtzpDrCmJwPufmclUUtPqQvCriwjjpMWmx6dImjI2Jo19ky/oClZfO93SQWCJ00ldW+/zGMk7w0hY8wMmLdQTrrYfiO0ULs5svdgygUBPToM+qWdJ/jPev+ga+n2IVige2xD0puvTQSacNLX5CID7PmB8CLnWrRn84xhG7fikkyFwvHnmnoDofXGdE2WF5SZkWoR8BjqgLj2Cz9l3UZAvOZf14gnKRpcUgZyI95Xo8uka8pwaVe1tuAO9kAjLCNzEVlGgHFsaRhGizP6szzMMw0m5QnNa5NLbpih6gbzfx+Bov0PNnRN8B0as7nkvBFrv2W9xKm4zMSXR9c8zwJ1W0BF0sSsAU1cce4G1faAa9cbJ4MyZoMA5S6hl6fk5ZUGE2+cJrHO8NRlW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fce11c67-12e6-4364-9585-08dca0b842dd X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 08:14:03.8186 (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: gCsYMd2POs+z+5J6WVI4Qp0tZzOxTjqnV03zDvz7jOPpiVuT1tXG1/inG20XXqZJKcFfuUWYwdYsUulHKp7bCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8864 This exposes the "select" method for Broadcast transports. This allows the user to select the desired stream when running the setup with PipeWire since it acquires any transport that is pending. --- client/player.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/client/player.c b/client/player.c index 0d031e4b0..58805c26a 100644 --- a/client/player.c +++ b/client/player.c @@ -4628,6 +4628,23 @@ static void acquire_reply(DBusMessage *message, void *user_data) return bt_shell_noninteractive_quit(EXIT_FAILURE); } +static void select_reply(DBusMessage *message, void *user_data) +{ + DBusError error; + + dbus_error_init(&error); + + if (dbus_set_error_from_message(&error, message) == TRUE) { + bt_shell_printf("Failed to select: %s\n", error.name); + dbus_error_free(&error); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + bt_shell_printf("Select successful"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + static void prompt_acquire(const char *input, void *user_data) { GDBusProxy *proxy = user_data; @@ -4849,6 +4866,38 @@ static void cmd_acquire_transport(int argc, char *argv[]) return bt_shell_noninteractive_quit(EXIT_SUCCESS); } +static void transport_select(GDBusProxy *proxy, bool prompt) +{ + if (!g_dbus_proxy_method_call(proxy, "Select", NULL, + select_reply, proxy, NULL)) { + bt_shell_printf("Failed select transport\n"); + return; + } +} + +static void cmd_select_transport(int argc, char *argv[]) +{ + GDBusProxy *proxy; + int i; + + for (i = 1; i < argc; i++) { + proxy = g_dbus_proxy_lookup(transports, NULL, argv[i], + BLUEZ_MEDIA_TRANSPORT_INTERFACE); + if (!proxy) { + bt_shell_printf("Transport %s not found\n", argv[i]); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (find_transport(proxy)) { + bt_shell_printf("Transport %s already acquired\n", + argv[i]); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + transport_select(proxy, false); + } +} + static void release_reply(DBusMessage *message, void *user_data) { struct transport *transport = user_data; @@ -5276,6 +5325,9 @@ static const struct bt_shell_menu transport_menu = { { "volume", " [value]", cmd_volume_transport, "Get/Set transport volume", transport_generator }, + { "select", "", cmd_select_transport, + "Select Transport", + transport_generator }, {} }, };