Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] test: functional: change the HoG connection rate from the HID device
@ 2026-10-12 15:28 Luiz Augusto von Dentz
  2026-10-12 18:51 ` [BlueZ,v1] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-12 15:28 UTC (permalink / raw)
  To: linux-bluetooth

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

As specified by the HIDS/HOGP SCI FIPD, the HID device initiates the
Connection Rate Update procedure once the HID host writes the mode to
the HID Control Point, so load the connection subrate on the HID device
instead of the HID host.

This requires the kernel to issue the LE Connection Rate Request as
peripheral.

Assisted-by: OpenCode:claude-opus-5.5
---
 doc/functional-hog.rst      | 13 ++++++-------
 test/functional/test_hog.py | 21 +++++++++++----------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/doc/functional-hog.rst b/doc/functional-hog.rst
index 795a066a6f1a..6d0b0132d5dd 100644
--- a/doc/functional-hog.rst
+++ b/doc/functional-hog.rst
@@ -135,7 +135,7 @@ test_hog[sci]
 	10. host0: ``gatt.select-attribute 2c39`` and ``gatt.notify on``.
 	11. host0: ``gatt.select-attribute 2a4c`` and ``gatt.write "0x03"``,
 	    i.e. Enable SCI Fast mode written to the HID Control Point.
-	12. host0: ``mgmt.conn-subrate <host1 bdaddr> 0x0008 0x0010 1 1 0 0
+	12. host1: ``mgmt.conn-subrate <host0 bdaddr> 0x0008 0x0010 1 1 0 0
 	    0x01f4``, i.e. interval 1 ms to 2 ms, within the range given in
 	    HID SCI Information, no subrating, no latency and 5 s
 	    supervision timeout.
@@ -196,9 +196,8 @@ test_hog[sci]
 	Notify only. The Control Point is written with bluetoothctl, as the
 	input plugin has no D-Bus API to request a mode.
 
-	The HID device is meant to change the connection rate once the
-	mode is written, but the kernel only issues the LE Connection Rate
-	Request as central, so the connection rate is changed by the HID
-	host. This requires
-	the controllers to support Shorter Connection Intervals, which
-	btvirt emulates as a BR/EDR/LE 6.2 controller.
+	The HID device, the peripheral, then changes the connection rate
+	according to the mode, which requires the kernel to issue the LE
+	Connection Rate Request as peripheral, as well as the controllers
+	to support Shorter Connection Intervals, which btvirt emulates as a
+	BR/EDR/LE 6.2 controller.
diff --git a/test/functional/test_hog.py b/test/functional/test_hog.py
index 7ff0965275d1..a76c91602896 100644
--- a/test/functional/test_hog.py
+++ b/test/functional/test_hog.py
@@ -45,10 +45,10 @@ REPORTS = [
 # HID SCI Mode
 SCI_FAST_MODE = "03"
 
-# LE Connection Rate parameters requested with mgmt.conn-subrate once in
-# SCI Fast Mode: interval 1 ms to 2 ms (units of 0.125 ms), within the
-# range given in HID SCI Information, no subrating, no latency and 5 s
-# supervision timeout (units of 10 ms)
+# LE Connection Rate parameters requested by the HID device with
+# mgmt.conn-subrate once in SCI Fast Mode: interval 1 ms to 2 ms (units of
+# 0.125 ms), within the range given in HID SCI Information, no subrating,
+# no latency and 5 s supervision timeout (units of 10 ms)
 SCI_RATE = ["0x0008", "0x0010", "1", "1", "0", "0", "0x01f4"]
 
 # Reported when an operation cannot complete, so a test does not have to
@@ -251,17 +251,18 @@ def test_hog(hosts, init_script, flags, sci):
     )
     assert expect_hexdump(device) == SCI_FAST_MODE
 
-    # The HID device is meant to change the connection rate, but the kernel
-    # only requests it as central, so the HID host does it instead
-    ctl.send(f"mgmt.conn-subrate {host1.bdaddr} {' '.join(SCI_RATE)}\n")
+    # The HID device then changes the connection rate according to the
+    # mode, see the HIDS/HOGP SCI FIPD, which requires the kernel to issue
+    # the LE Connection Rate Request as peripheral
+    device.send(f"mgmt.conn-subrate {host0.bdaddr} {' '.join(SCI_RATE)}\n")
     # The connection rate may change before the command completes, so the
     # event may be printed before the reply
     rate = rf"{{}} type .* connection subrate interval {SCI_RATE[0]}"
     expect_all(
-        ctl,
-        [r"Connection Subrate loaded successfully", rate.format(host1.bdaddr.upper())],
+        device,
+        [r"Connection Subrate loaded successfully", rate.format(host0.bdaddr.upper())],
     )
-    expect(device, rate.format(host0.bdaddr.upper()))
+    expect(ctl, rate.format(host1.bdaddr.upper()))
 
     # Then the HID device confirms the mode has been changed
     ctl.send("gatt.select-attribute 2c39\n")
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-12 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 15:28 [PATCH BlueZ v1] test: functional: change the HoG connection rate from the HID device Luiz Augusto von Dentz
2026-10-12 18:51 ` [BlueZ,v1] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox