Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 09/12] mgmt-tester: Add HIDS recommended SCI parameter tests
Date: Fri, 24 Jul 2026 15:12:22 -0400	[thread overview]
Message-ID: <20260724191225.1815634-10-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20260724191225.1815634-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Add Load Connection Subrate test cases using the recommended
connection subrate parameters from the HOGP v1.2 specification for
each of the four HID modes:

 - Fast: interval 1.25-5 ms, latency 0, subrate 1-4, cont_num 3
 - Default: interval 7.5-15 ms, latency 0, subrate 1-4, cont_num 0
 - Low Power: interval 7.5-15 ms, latency 100, subrate 1-4, cont_num 0
 - Full Range: interval 1.25-15 ms, latency 0, subrate 1-4, cont_num 1

Supervision timeouts are computed as (1 + Peripheral Latency) *
Subrate Max * Connection Interval Max * 2 per the spec.
---
 tools/mgmt-tester.c | 104 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 15c9254e307e..4b432002d49f 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -4478,6 +4478,98 @@ static const struct generic_data load_conn_subrate_success_1 = {
 	.expect_status = MGMT_STATUS_SUCCESS,
 };
 
+/* HIDS 1.2 recommended SCI parameters (see HOGP v1.2 spec).
+ * Connection intervals are in units of 0.125 ms, supervision timeout in
+ * units of 10 ms.
+ *
+ * Fast mode: interval 1.25-5 ms, latency 0, subrate 1-4, cont_num 3,
+ * timeout >= (1 + 0) * 4 * 5 ms * 2 = 40 ms.
+ */
+static const uint8_t load_conn_subrate_hids_fast[] = {
+	0x01, 0x00,				/* param_count */
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,	/* address */
+	0x01,					/* address type (LE Public) */
+	0x0a, 0x00,				/* min_interval (1.25 ms) */
+	0x28, 0x00,				/* max_interval (5 ms) */
+	0x01, 0x00,				/* subrate_min */
+	0x04, 0x00,				/* subrate_max */
+	0x00, 0x00,				/* max_latency */
+	0x03, 0x00,				/* cont_num */
+	0x04, 0x00,				/* supv_timeout (40 ms) */
+};
+static const struct generic_data load_conn_subrate_hids_fast_test = {
+	.send_opcode = MGMT_OP_LOAD_CONN_SUBRATE,
+	.send_param = load_conn_subrate_hids_fast,
+	.send_len = sizeof(load_conn_subrate_hids_fast),
+	.expect_status = MGMT_STATUS_SUCCESS,
+};
+
+/* Default mode: interval 7.5-15 ms, latency 0, subrate 1-4, cont_num 0,
+ * timeout >= (1 + 0) * 4 * 15 ms * 2 = 120 ms.
+ */
+static const uint8_t load_conn_subrate_hids_default[] = {
+	0x01, 0x00,				/* param_count */
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,	/* address */
+	0x01,					/* address type (LE Public) */
+	0x3c, 0x00,				/* min_interval (7.5 ms) */
+	0x78, 0x00,				/* max_interval (15 ms) */
+	0x01, 0x00,				/* subrate_min */
+	0x04, 0x00,				/* subrate_max */
+	0x00, 0x00,				/* max_latency */
+	0x00, 0x00,				/* cont_num */
+	0x0c, 0x00,				/* supv_timeout (120 ms) */
+};
+static const struct generic_data load_conn_subrate_hids_default_test = {
+	.send_opcode = MGMT_OP_LOAD_CONN_SUBRATE,
+	.send_param = load_conn_subrate_hids_default,
+	.send_len = sizeof(load_conn_subrate_hids_default),
+	.expect_status = MGMT_STATUS_SUCCESS,
+};
+
+/* Low Power mode: interval 7.5-15 ms, latency 100, subrate 1-4,
+ * cont_num 0, timeout >= (1 + 100) * 4 * 15 ms * 2 = 12120 ms.
+ */
+static const uint8_t load_conn_subrate_hids_low_power[] = {
+	0x01, 0x00,				/* param_count */
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,	/* address */
+	0x01,					/* address type (LE Public) */
+	0x3c, 0x00,				/* min_interval (7.5 ms) */
+	0x78, 0x00,				/* max_interval (15 ms) */
+	0x01, 0x00,				/* subrate_min */
+	0x04, 0x00,				/* subrate_max */
+	0x64, 0x00,				/* max_latency (100) */
+	0x00, 0x00,				/* cont_num */
+	0xbc, 0x04,				/* supv_timeout (12120 ms) */
+};
+static const struct generic_data load_conn_subrate_hids_low_power_test = {
+	.send_opcode = MGMT_OP_LOAD_CONN_SUBRATE,
+	.send_param = load_conn_subrate_hids_low_power,
+	.send_len = sizeof(load_conn_subrate_hids_low_power),
+	.expect_status = MGMT_STATUS_SUCCESS,
+};
+
+/* Full Range mode: interval 1.25-15 ms, latency 0, subrate 1-4,
+ * cont_num 1, timeout >= (1 + 0) * 4 * 15 ms * 2 = 120 ms.
+ */
+static const uint8_t load_conn_subrate_hids_full_range[] = {
+	0x01, 0x00,				/* param_count */
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,	/* address */
+	0x01,					/* address type (LE Public) */
+	0x0a, 0x00,				/* min_interval (1.25 ms) */
+	0x78, 0x00,				/* max_interval (15 ms) */
+	0x01, 0x00,				/* subrate_min */
+	0x04, 0x00,				/* subrate_max */
+	0x00, 0x00,				/* max_latency */
+	0x01, 0x00,				/* cont_num */
+	0x0c, 0x00,				/* supv_timeout (120 ms) */
+};
+static const struct generic_data load_conn_subrate_hids_full_range_test = {
+	.send_opcode = MGMT_OP_LOAD_CONN_SUBRATE,
+	.send_param = load_conn_subrate_hids_full_range,
+	.send_len = sizeof(load_conn_subrate_hids_full_range),
+	.expect_status = MGMT_STATUS_SUCCESS,
+};
+
 static const uint8_t add_device_nval_1[] = {
 					0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
 					0x00,
@@ -13870,6 +13962,18 @@ int main(int argc, char *argv[])
 	test_bredrle62("Load Connection Subrate - Success 1",
 				&load_conn_subrate_success_1,
 				NULL, test_command_generic);
+	test_bredrle62("Load Connection Subrate - HIDS Fast",
+				&load_conn_subrate_hids_fast_test,
+				NULL, test_command_generic);
+	test_bredrle62("Load Connection Subrate - HIDS Default",
+				&load_conn_subrate_hids_default_test,
+				NULL, test_command_generic);
+	test_bredrle62("Load Connection Subrate - HIDS Low Power",
+				&load_conn_subrate_hids_low_power_test,
+				NULL, test_command_generic);
+	test_bredrle62("Load Connection Subrate - HIDS Full Range",
+				&load_conn_subrate_hids_full_range_test,
+				NULL, test_command_generic);
 
 	test_bredrle("Add Device - Invalid Params 1",
 				&add_device_fail_1,
-- 
2.54.0


  parent reply	other threads:[~2026-07-24 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 19:12 [PATCH BlueZ v1 00/12] Add support for Shorter Connection Interval (SCI) Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 01/12] input/hog-lib: Add discovery support for HIDS 1.1 SCI attributes Luiz Augusto von Dentz
2026-07-24 20:41   ` Add support for Shorter Connection Interval (SCI) bluez.test.bot
2026-07-24 19:12 ` [PATCH BlueZ v1 02/12] emulator/btdev: Add emulation support for HIDS 1.1 SCI commands Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 03/12] mgmt: Add Shorter Connection Interval setting and Load Connection Subrate Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 04/12] mgmt-tester: Add tests for SCI " Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 05/12] adapter: Add support for loading connection subrate parameters Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 06/12] monitor: Add decoding for Load Connection Subrate, SCI setting and event Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 07/12] doc: Document ConnectionSubrate storage format Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 08/12] client/mgmt: Add conn-subrate command Luiz Augusto von Dentz
2026-07-24 19:12 ` Luiz Augusto von Dentz [this message]
2026-07-24 19:12 ` [PATCH BlueZ v1 10/12] l2cap-tester: Add SCI mode tests for LE client connections Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 11/12] emulator/bthost: Add LE Connection Rate Request support Luiz Augusto von Dentz
2026-07-24 19:12 ` [PATCH BlueZ v1 12/12] l2cap-tester: Add SCI mode tests for LE server connections 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=20260724191225.1815634-10-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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