linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joseph Hwang <josephsih@chromium.org>
To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org,
	luiz.dentz@gmail.com, pali@kernel.org
Cc: chromeos-bluetooth-upstreaming@chromium.org,
	josephsih@google.com, Joseph Hwang <josephsih@chromium.org>
Subject: [BlueZ PATCH v6 3/3] tools: btmgmt: support bqr experiment feature command
Date: Thu, 15 Jul 2021 17:50:18 +0800	[thread overview]
Message-ID: <20210715174945.BlueZ.v6.3.I6dc7f0bfe78347213063ff6bd4031daf9b5da43c@changeid> (raw)
In-Reply-To: <20210715174945.BlueZ.v6.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid>

This patch adds the "exp-bqr" command to btmgmt to enable/disable
the Bluetooth quality report (BQR).

---

Changes in v6:
- Remove the patch that adds btd_adapter_update_kernel_quality_report()
  since no upstream code uses it per the previous review comment.
- Add this new patch to support the "exp-bqr" command in btmgmt to
  enable/disable the Bluetooth quality report (BQR). This support is
  to be consistent with other experimental features.
- Note that the bqr experimental feature is designed in the way that
  it can be enabled/disabled at run time instead of at bluez daemon
  launch time. And the default is to disable it in order to avoid the
  overhead on the controller. Hence, it is not enabled through
  btd_opts.experimental like what rpa_resolution_func() does.

 tools/btmgmt.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index a6ac026dc..997af70bf 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1842,6 +1842,52 @@ static void cmd_exp_privacy(int argc, char **argv)
 	}
 }
 
+static void exp_bqr_rsp(uint8_t status, uint16_t len, const void *param,
+							void *user_data)
+{
+	if (status != 0)
+		error("Set BQR feature failed with status 0x%02x (%s)",
+						status, mgmt_errstr(status));
+	else
+		print("BQR feature successfully set");
+
+	bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_exp_bqr(int argc, char **argv)
+{
+	/* 330859bc-7506-492d-9370-9a6f0614037f */
+	static const uint8_t uuid[16] = {
+				0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
+				0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33,
+	};
+	struct mgmt_cp_set_exp_feature cp;
+	uint8_t val;
+
+	if (mgmt_index == MGMT_INDEX_NONE) {
+		error("BQR feature requires a valid controller index");
+		return;
+	}
+
+	if (parse_setting(argc, argv, &val) == false)
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	if (val != 0 && val != 1) {
+		error("Invalid value %u", val);
+		return;
+	}
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, uuid, 16);
+	cp.action = val;
+
+	if (mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, mgmt_index,
+			sizeof(cp), &cp, exp_bqr_rsp, NULL, NULL) == 0) {
+		error("Unable to send BQR feature cmd");
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+}
+
 static void print_mgmt_tlv(void *data, void *user_data)
 {
 	const struct mgmt_tlv *entry = data;
@@ -5547,6 +5593,8 @@ static const struct bt_shell_menu main_menu = {
 		cmd_exp_debug,		"Set debug feature"		},
 	{ "exp-privacy",	"<on/off>",
 		cmd_exp_privacy,	"Set LL privacy feature"	},
+	{ "exp-bqr",		"<on/off>", cmd_exp_bqr,
+		"Set bluetooth quality report feature"			},
 	{ "read-sysconfig",	NULL,
 		cmd_read_sysconfig,	"Read System Configuration"	},
 	{ "set-sysconfig",	"<-v|-h> [options...]",
-- 
2.32.0.93.g670b81a890-goog


  parent reply	other threads:[~2021-07-15  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15  9:50 [BlueZ PATCH v6 1/3] monitor: add new Intel extended telemetry events Joseph Hwang
2021-07-15  9:50 ` [BlueZ PATCH v6 2/3] adapter: read quality report feature Joseph Hwang
2021-07-15  9:50 ` Joseph Hwang [this message]
2021-07-15 10:41 ` [BlueZ,v6,1/3] monitor: add new Intel extended telemetry events bluez.test.bot
2021-07-20 18:06   ` Luiz Augusto von Dentz

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=20210715174945.BlueZ.v6.3.I6dc7f0bfe78347213063ff6bd4031daf9b5da43c@changeid \
    --to=josephsih@chromium.org \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=josephsih@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=pali@kernel.org \
    --subject='Re: [BlueZ PATCH v6 3/3] tools: btmgmt: support bqr experiment feature command' \
    /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

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).