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/8] client: Add support for LE get/set device PHY in bluetoothctl
Date: Thu, 22 Jul 2021 11:19:49 +0530	[thread overview]
Message-ID: <20210722054951.8291-7-ayush.garg@samsung.com> (raw)
In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com>

Verification logs based on BT 5.0 controller
==============================================
[S20] phy  45:18:F8:CF:23:7E
	Selected phys: LE1MTX
	Selected phys: LE1MRX
[S20] phy  45:18:F8:CF:23:7E LE2MTX LE2MRX
[S20]
Changing PHY succeeded
Device 45:18:F8:CF:23:7E Phy: LE2MTX
Device 45:18:F8:CF:23:7E Phy: LE2MRX

Reviewed-by: Anupam Roy <anupam.r@samsung.com>
---
 client/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/client/main.c b/client/main.c
index ab925769b..e7146ab6f 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1705,6 +1705,7 @@ static void cmd_info(int argc, char *argv[])
 	print_property(proxy, "TxPower");
 	print_property(proxy, "AdvertisingFlags");
 	print_property(proxy, "AdvertisingData");
+	print_property(proxy, "Phy");
 
 	battery_proxy = find_battery_by_path(battery_proxies,
 					g_dbus_proxy_get_path(proxy));
@@ -2071,6 +2072,47 @@ static void cmd_phy_configuration(int argc, char *argv[])
 	g_strfreev(phys);
 }
 
+static void get_phy(GDBusProxy *proxy)
+{
+	print_property_with_label(proxy, "Phy",
+				"Selected phys");
+}
+
+static void cmd_phy(int argc, char *argv[])
+{
+	GDBusProxy *proxy;
+	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])) {
+		bt_shell_printf("Device address not given as input\n");
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	proxy = find_proxy_by_address(default_ctrl->devices, argv[1]);
+	if (!proxy) {
+		bt_shell_printf("Device %s not available\n", argv[1]);
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	if (argc == 2)
+		return get_phy(proxy);
+
+	phys = g_strdupv(&argv[2]);
+	phys_len = g_strv_length(phys);
+
+	g_dbus_proxy_set_property_array(proxy,
+					"Phy", DBUS_TYPE_STRING, phys,
+					phys_len, generic_callback, "PHY",
+					NULL);
+
+	g_strfreev(phys);
+}
+
+
 static void cmd_list_attributes(int argc, char *argv[])
 {
 	GDBusProxy *proxy;
@@ -3072,6 +3114,9 @@ static const struct bt_shell_menu main_menu = {
 				"[EDR2M1SLOT] [EDR2M3SLOT] [EDR2M5SLOT] "
 				"[EDR3M1SLOT] [EDR3M3SLOT] [EDR3M5SLOT]",
 		cmd_phy_configuration,		"Get/Set PHY Configuration" },
+	{ "phy",		"<dev> [LE1MTX] [LE1MRX] [LE2MTX] [LE2MRX] "
+				"[LECODEDTX] [LECODEDRX] [LECODEDS2] [LECODEDS8]",
+		cmd_phy,	"Get/Set LE PHY preferences for a connected device" },
 	{ } },
 };
 
-- 
2.17.1


  parent reply	other threads:[~2021-07-22  6:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210722055008epcas5p28da6985b690d3bbc564a5957c1b209f4@epcas5p2.samsung.com>
2021-07-22  5:49 ` [PATCH BlueZ 0/8] Support for connection specific LE PHY configuration Ayush Garg
     [not found]   ` <CGME20210722055009epcas5p25e4997aa7e53cb2a6e3780fdb7301785@epcas5p2.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 1/8] doc/device-api: Add Phy property Ayush Garg
2021-07-22 17:33       ` Luiz Augusto von Dentz
     [not found]   ` <CGME20210722055010epcas5p45a16ff704c37d108a9df0d6c0a1942a8@epcas5p4.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 2/8] doc/mgmt-api: Add support for LE PHY Update Complete event Ayush Garg
2021-07-22 14:45       ` Marcel Holtmann
     [not found]   ` <CGME20210722055011epcas5p15299bfe8f8b8dd58e1354364071608e3@epcas5p1.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 3/8] btio: Add BT_IO_PHY option to set le phy options Ayush Garg
     [not found]   ` <CGME20210722055012epcas5p1bb92b3e31233da03906c4f562b22b4fc@epcas5p1.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 4/8] device: Add support for get/set PHY property Ayush Garg
     [not found]   ` <CGME20210722055013epcas5p350d88f402bbe4c55f1f868dbb2decbaf@epcas5p3.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 5/8] adapter: Add support for LE PHY Update Complete event Ayush Garg
     [not found]   ` <CGME20210722055015epcas5p4db389aa15f16f1577a74ba5ce446919b@epcas5p4.samsung.com>
2021-07-22  5:49     ` Ayush Garg [this message]
     [not found]   ` <CGME20210722055016epcas5p267b70f0da3b5c1991d29ca47d685ab6d@epcas5p2.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 7/8] device: Save device PHY in storage and read it at init Ayush Garg
     [not found]   ` <CGME20210722055017epcas5p4da91b311c34a5fb869148b369338ed07@epcas5p4.samsung.com>
2021-07-22  5:49     ` [PATCH BlueZ 8/8] monitor: Add support for LE PHY Update event 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=20210722054951.8291-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).