linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ayush Garg <ayush.garg@samsung.com>
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	[thread overview]
Message-ID: <20210722052640.5863-7-ayush.garg@samsung.com> (raw)
In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com>

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 <anupam.r@samsung.com>
---
 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


  parent reply	other threads:[~2021-07-22  5:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210722052737epcas5p1682a7f66d42470c3cdb8dd04160912ab@epcas5p1.samsung.com>
2021-07-22  5:26 ` [PATCH BlueZ 0/7] Support for Adapter's Default PHY Configuration Ayush Garg
     [not found]   ` <CGME20210722052738epcas5p3b6074e49f088159e8282bba3457d56ba@epcas5p3.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 1/7] doc/adapter-api: Add SupportedPhyConfiguration property Ayush Garg
2021-07-22  6:45       ` Support for Adapter's Default PHY Configuration bluez.test.bot
2021-07-22 14:46       ` [PATCH BlueZ 1/7] doc/adapter-api: Add SupportedPhyConfiguration property Marcel Holtmann
     [not found]   ` <CGME20210722052739epcas5p4412d38b394f51ab195c77c887f0a0aaf@epcas5p4.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 2/7] doc/adapter-api: Add PhyConfiguration property Ayush Garg
2021-07-22 17:20       ` Luiz Augusto von Dentz
     [not found]   ` <CGME20210722052740epcas5p1fce869a24434f376d111e9e5d4b208eb@epcas5p1.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 3/7] adapter: Add support for get/set phy configuration property Ayush Garg
     [not found]   ` <CGME20210722052741epcas5p2cb3cbad65a301b0ec0cf1780c0920103@epcas5p2.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 4/7] adapter: Add support for the get supported phy property Ayush Garg
     [not found]   ` <CGME20210722052742epcas5p1b53db2cd68028170a86f291bd052bf14@epcas5p1.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 5/7] adapter: Add support for PHY Configuration Changed event Ayush Garg
     [not found]   ` <CGME20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac@epcas5p3.samsung.com>
2021-07-22  5:26     ` Ayush Garg [this message]
     [not found]   ` <CGME20210722052744epcas5p46996d48d12500c39b4b63dfcecd30d37@epcas5p4.samsung.com>
2021-07-22  5:26     ` [PATCH BlueZ 7/7] adapter: Save PHY Configuration in storage and read it at init Ayush Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722052640.5863-7-ayush.garg@samsung.com \
    --to=ayush.garg@samsung.com \
    --cc=anupam.r@samsung.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=nitin.j@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).