Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp276288pxv; Wed, 21 Jul 2021 23:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBcl63pjxQYbwU/YMeih4xtZkFr+zAqUsIU540KfzgBY5rHCGBxdxvF/RfZcmlMFPAPRxq X-Received: by 2002:a92:6610:: with SMTP id a16mr3095234ilc.71.1626933659790; Wed, 21 Jul 2021 23:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626933659; cv=none; d=google.com; s=arc-20160816; b=fz59lOzwuzrfG07nM0J2VzPFYN7Qzpdu6rU272rar4FBP6pNdVXBRz3LA+w+n/6gq3 qbXcskEjq5HrZA7akKX4PwnnZ1Apbcww1dD0QER/ZNZnsZu9vyJgauZMyVedCVf0xyLm 3hX+tG/uircObYZDtyl9YTEG0BtuvhJIgculpkOlPFzVCBY4MRJL/flomIowNig9HBxT 7nBtc2OPMJjaDpg2Zy/6pM3FOxWNeplc9RvTQ3+KcvOozc7EbA8Ae/29FhA8onCvilUM KylHzukMvEpn8F+2fQX+PoJbhRUxtgq9Gs/0sn+rcuTSWr3TidqEXGv8uDCnVXQj4T3b Eyxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=EUChzWKcOMrlauR7u+IEDeWBTjjDHcEGJ3f050q2Uec=; b=XUp8OzVMMowcF1kcsngUkEMK30DelJEyJJoTfPRZW0OWyUpXMmCdD3OstZ3/f2H1wW wJ7LCTYbtcs5wXWxRuOLmCm9INn0cx9a+r1SifghxlOtp15Uv6WsiZkxcSEF0vUcJirg qDHbiPz5AccpZNYY8Is2baa7/GtkoGt8/uvKZAOj/3SCywuhXAa56MeXLQtDbBcVC4Bs 8zs1o1t4XLVs2ezY6uZ2CvlTd8fWVaslHhAeCxg8LHwEQH954cCtUDlmoQpmx+yVsRwi aM8ng48TZ8Ym45xRUzy2Tzu4p0CzW8hBr4ggXP4xql/uyJjO6YyIi+u3gi3ZWVizZiRM eT3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QRb9t1l1; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si28843345jak.34.2021.07.21.23.00.26; Wed, 21 Jul 2021 23:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QRb9t1l1; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbhGVFTH (ORCPT + 99 others); Thu, 22 Jul 2021 01:19:07 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48038 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbhGVFTG (ORCPT ); Thu, 22 Jul 2021 01:19:06 -0400 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210722055941epoutp01e09889a6a81be821ebc976f67474c463~UB3joKRr41867818678epoutp011 for ; Thu, 22 Jul 2021 05:59:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210722055941epoutp01e09889a6a81be821ebc976f67474c463~UB3joKRr41867818678epoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933581; bh=EUChzWKcOMrlauR7u+IEDeWBTjjDHcEGJ3f050q2Uec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRb9t1l1TJfpxNT6d4jPMO3QMpVWsJUhPpI8+iQzb7MDGJMurZk2jHWiCZQ/0bZW8 Laq6xZkzJbhg9kavDEwuOikeECp7U1ac/EwNZ7LWLtO4esU5qJ3UXJ7CkCl4VeICtH BKn0qPmsWwau/n+gFK+Y77D5n3gx8XVc9waXv/6I= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20210722055940epcas5p381c52bf95fdff4d4a527cd150ad8b150~UB3jSubBH0717107171epcas5p3E; Thu, 22 Jul 2021 05:59:40 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id CD.6A.09595.C4909F06; Thu, 22 Jul 2021 14:59:40 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac~UBbpl7Orb1662316623epcas5p33; Thu, 22 Jul 2021 05:27:43 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052743epsmtrp2c71eef4f0532502dc569bb90005b1be6~UBbplNlk70094500945epsmtrp2F; Thu, 22 Jul 2021 05:27:43 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-40-60f9094cd075 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F0.91.08394.EC109F06; Thu, 22 Jul 2021 14:27:42 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052742epsmtip2238d96986118fbf5fb0810618db16aee~UBbo2sDSM0837808378epsmtip2W; Thu, 22 Jul 2021 05:27:42 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 6/7] client: Add support for get/set PHY configuration in bluetoothctl Date: Thu, 22 Jul 2021 10:56:39 +0530 Message-Id: <20210722052640.5863-7-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7bCmhq4P588Egx/PFC3urLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mro2JxSME+morVpKXsD42vxLkZODgkB E4nur51sXYxcHEICuxkldm9+yQjhfGKU+PNmO1TmG6PEs8YZzDAt387cZYJI7GWUmP5wEStc y6U/RxhBqtgENCVef/zCBGKLCChLPNt3GMxmFtCVOPN+HRuILSwQJ9E2fzOYzSKgKtH5bDU7 iM0rYCXx++UOqG3yEqs3HACzOQWsJWb0vmEGWSYh0M8usejEdnaIIheJx4tmsUHYwhKvjm+B iktJfH63lw2ioZlRYsfmjewQTg+jxIMf3VAd9hLnmp4B/cABdJ6mxPpd+hBhWYmpp9ZBXc0n 0fv7CRNEnFdixzwYW0Viw6pOuGUfjy2EutpDYsWJx+yQYOljlFg+fyLzBEa5WQgrFjAyrmKU TC0ozk1PLTYtMMpLLdcrTswtLs1L10vOz93ECI5nLa8djA8ffNA7xMjEwXiIUYKDWUmEV6Xo a4IQb0piZVVqUX58UWlOavEhRmkOFiVxXvZ4oJRAemJJanZqakFqEUyWiYNTqoFJc/ovxoB9 VqfsG9NKIlekJ38rc4558ehgX3XoPNfjh56K+u/ePdvCaJPu2rbUlLDdRzlnGH8XKkv13LYi 6pbhpdeNIv8qsmT3nvp7RE6n+aygWL1z3+zwQN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L9El19Pn7S8IYJpivKH8kYl4ra+QEktxRqKhFnNRcSIA5BPu4YQCAAA= X-CMS-MailID: 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Verification logs based on BT 5.0 controller ============================================== [bluetooth] default-phy LE1MTX LE2MTX LE1MRX LE2MRX LECODEDTX LECODEDRX [bluetooth] Changing PHY Configuration succeeded Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE1MTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE1MRX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE2MTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE2MRX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LECODEDTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LECODEDRX Verification logs based on BT 4.0 controller ============================================= [bluetooth]# default-phy Supported phys: BR1M1SLOT Supported phys: BR1M3SLOT Supported phys: BR1M5SLOT Supported phys: EDR2M1SLOT Supported phys: EDR2M3SLOT Supported phys: EDR2M5SLOT Supported phys: EDR3M1SLOT Supported phys: EDR3M3SLOT Supported phys: EDR3M5SLOT Supported phys: LE1MTX Supported phys: LE1MRX Selected phys: BR1M1SLOT Selected phys: LE1MTX Selected phys: LE1MRX [bluetooth]# default-phy BR1M1SLOT LE1MTX LE1MRX BR1M3SLOT Changing PHY Configuration succeeded [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: BR1M1SLOT [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: BR1M3SLOT [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: LE1MTX [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: LE1MRX Reviewed-by: Anupam Roy --- client/main.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/client/main.c b/client/main.c index c1a62edb7..ab925769b 100644 --- a/client/main.c +++ b/client/main.c @@ -934,6 +934,8 @@ static void cmd_show(int argc, char *argv[]) print_property(adapter->proxy, "Modalias"); print_property(adapter->proxy, "Discovering"); print_property(adapter->proxy, "Roles"); + print_property(adapter->proxy, "SupportedPhyConfiguration"); + print_property(adapter->proxy, "PhyConfiguration"); if (adapter->ad_proxy) { bt_shell_printf("Advertising Features:\n"); @@ -2038,6 +2040,37 @@ static void cmd_disconn(int argc, char *argv[]) proxy_address(proxy)); } +static void get_phy_configuration(void) +{ + print_property_with_label(default_ctrl->proxy, + "SupportedPhyConfiguration", "Supported phys"); + + print_property_with_label(default_ctrl->proxy, "PhyConfiguration", + "Selected phys"); +} + +static void cmd_phy_configuration(int argc, char *argv[]) +{ + char **phys = NULL; + size_t phys_len = 0; + + if (check_default_ctrl() == FALSE) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + if (argc < 2 || !strlen(argv[1])) + return get_phy_configuration(); + + phys = g_strdupv(&argv[1]); + phys_len = g_strv_length(phys); + + g_dbus_proxy_set_property_array(default_ctrl->proxy, + "PhyConfiguration", DBUS_TYPE_STRING, phys, + phys_len, generic_callback, "PHY Configuration", + NULL); + + g_strfreev(phys); +} + static void cmd_list_attributes(int argc, char *argv[]) { GDBusProxy *proxy; @@ -3033,6 +3066,12 @@ static const struct bt_shell_menu main_menu = { dev_generator }, { "disconnect", "[dev]", cmd_disconn, "Disconnect device", dev_generator }, + { "default-phy", "[LE1MTX] [LE1MRX] [LE2MTX] [LE2MRX] " + "[LECODEDTX] [LECODEDRX] " + "[BR1M1SLOT] [BR1M3SLOT] [BR1M5SLOT] " + "[EDR2M1SLOT] [EDR2M3SLOT] [EDR2M5SLOT] " + "[EDR3M1SLOT] [EDR3M3SLOT] [EDR3M5SLOT]", + cmd_phy_configuration, "Get/Set PHY Configuration" }, { } }, }; -- 2.17.1