From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 01/12] input/hog-lib: Add discovery support for HIDS 1.1 SCI attributes
Date: Fri, 24 Jul 2026 15:12:14 -0400 [thread overview]
Message-ID: <20260724191225.1815634-2-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 support for discovering and reading HIDS 1.1 SCI (Subrated
Connection Interval) characteristics:
- HID SCI Mode (0x2c39)
- HID SCI Information (0x2c3a)
When the HID Information flags indicate SCI is supported (bit 2),
the SCI Mode and SCI Information characteristics are read after
the HID Information is obtained.
---
profiles/input/hog-lib.c | 106 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 105 insertions(+), 1 deletion(-)
diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 70a1bdcbf4df..054356371ea7 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
@@ -56,6 +56,8 @@
#define HOG_REPORT_UUID 0x2A4D
#define HOG_PROTO_MODE_UUID 0x2A4E
#define HOG_CONTROL_POINT_UUID 0x2A4C
+#define HOG_SCI_MODE_UUID 0x2C39
+#define HOG_SCI_INFO_UUID 0x2C3A
#define HOG_REPORT_TYPE_INPUT 1
#define HOG_REPORT_TYPE_OUTPUT 2
@@ -64,6 +66,8 @@
#define HOG_PROTO_MODE_BOOT 0
#define HOG_PROTO_MODE_REPORT 1
+#define HOG_INFO_FLAG_SCI_SUPPORTED 0x04
+
#define HID_INFO_SIZE 4
#define ATT_NOTIFICATION_HEADER_SIZE 3
@@ -98,6 +102,8 @@ struct bt_hog {
struct queue *gatt_op;
struct gatt_db *gatt_db;
struct gatt_db_attribute *report_map_attr;
+ uint16_t sci_mode_handle;
+ uint16_t sci_info_handle;
};
struct report {
@@ -152,6 +158,10 @@ static void destroy_gatt_req(void *data)
}
static void read_report_map(struct bt_hog *hog);
+static void sci_mode_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+ gpointer user_data);
+static void sci_info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+ gpointer user_data);
static void remove_gatt_req(struct gatt_request *req, uint8_t status)
{
@@ -1105,6 +1115,85 @@ static void info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
DBG("bcdHID: 0x%04X bCountryCode: 0x%02X Flags: 0x%02X",
hog->bcdhid, hog->bcountrycode, hog->flags);
+ /* Read SCI attributes if SCI is supported */
+ if (hog->flags & HOG_INFO_FLAG_SCI_SUPPORTED) {
+ if (hog->sci_mode_handle)
+ read_char(hog, hog->attrib, hog->sci_mode_handle,
+ sci_mode_read_cb, hog);
+ if (hog->sci_info_handle)
+ read_char(hog, hog->attrib, hog->sci_info_handle,
+ sci_info_read_cb, hog);
+ }
+
+remove:
+ remove_gatt_req(req, status);
+}
+
+static void sci_mode_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+ gpointer user_data)
+{
+ struct gatt_request *req = user_data;
+ uint8_t value;
+ ssize_t vlen;
+
+ if (status != 0) {
+ error("HID SCI Mode read failed: %s", att_ecode2str(status));
+ goto remove;
+ }
+
+ vlen = dec_read_resp(pdu, plen, &value, sizeof(value));
+ if (vlen != 1) {
+ error("ATT protocol error");
+ goto remove;
+ }
+
+ DBG("SCI Mode: 0x%02X", value);
+
+remove:
+ remove_gatt_req(req, status);
+}
+
+static void sci_info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+ gpointer user_data)
+{
+ struct gatt_request *req = user_data;
+ uint8_t value[14];
+ ssize_t vlen;
+ uint8_t min_conn_interval;
+ uint8_t num_grps;
+ uint8_t i;
+
+ if (status != 0) {
+ error("HID SCI Information read failed: %s",
+ att_ecode2str(status));
+ goto remove;
+ }
+
+ vlen = dec_read_resp(pdu, plen, value, sizeof(value));
+ if (vlen < 2) {
+ error("ATT protocol error");
+ goto remove;
+ }
+
+ min_conn_interval = value[0];
+ num_grps = value[1];
+
+ DBG("SCI Info: Minimum Supported Connection Interval: %.3f ms "
+ "(0x%02x) Number of Supported Subgroups: %d",
+ min_conn_interval * 0.125, min_conn_interval, num_grps);
+
+ for (i = 0; i < num_grps && (2 + i * 6 + 5) < vlen; i++) {
+ uint16_t min, max, stride;
+ size_t off = 2 + i * 6;
+
+ min = get_le16(&value[off]);
+ max = get_le16(&value[off + 2]);
+ stride = get_le16(&value[off + 4]);
+
+ DBG(" Subgroup[%u]: Min %.3f ms Max %.3f ms Stride %.3f ms",
+ i, min * 0.125, max * 0.125, stride * 0.125);
+ }
+
remove:
remove_gatt_req(req, status);
}
@@ -1150,6 +1239,7 @@ static void char_discovered_cb(uint8_t status, GSList *chars, void *user_data)
struct gatt_primary *primary = hog->primary;
bt_uuid_t report_uuid, report_map_uuid, info_uuid;
bt_uuid_t proto_mode_uuid, ctrlpt_uuid;
+ bt_uuid_t sci_mode_uuid, sci_info_uuid;
struct report *report;
GSList *l;
uint16_t info_handle = 0, proto_mode_handle = 0;
@@ -1167,6 +1257,8 @@ static void char_discovered_cb(uint8_t status, GSList *chars, void *user_data)
bt_uuid16_create(&info_uuid, HOG_INFO_UUID);
bt_uuid16_create(&proto_mode_uuid, HOG_PROTO_MODE_UUID);
bt_uuid16_create(&ctrlpt_uuid, HOG_CONTROL_POINT_UUID);
+ bt_uuid16_create(&sci_mode_uuid, HOG_SCI_MODE_UUID);
+ bt_uuid16_create(&sci_info_uuid, HOG_SCI_INFO_UUID);
for (l = chars; l; l = g_slist_next(l)) {
struct gatt_char *chr, *next;
@@ -1201,6 +1293,10 @@ static void char_discovered_cb(uint8_t status, GSList *chars, void *user_data)
proto_mode_handle = chr->value_handle;
else if (bt_uuid_cmp(&uuid, &ctrlpt_uuid) == 0)
hog->ctrlpt_handle = chr->value_handle;
+ else if (bt_uuid_cmp(&uuid, &sci_mode_uuid) == 0)
+ hog->sci_mode_handle = chr->value_handle;
+ else if (bt_uuid_cmp(&uuid, &sci_info_uuid) == 0)
+ hog->sci_info_handle = chr->value_handle;
}
if (proto_mode_handle) {
@@ -1360,7 +1456,7 @@ static void foreach_hog_chrc(struct gatt_db_attribute *attr, void *user_data)
{
struct bt_hog *hog = user_data;
bt_uuid_t uuid, report_uuid, report_map_uuid, info_uuid;
- bt_uuid_t proto_mode_uuid, ctrlpt_uuid;
+ bt_uuid_t proto_mode_uuid, ctrlpt_uuid, sci_mode_uuid, sci_info_uuid;
uint16_t handle, value_handle;
struct iovec map = {};
@@ -1414,6 +1510,14 @@ static void foreach_hog_chrc(struct gatt_db_attribute *attr, void *user_data)
bt_uuid16_create(&ctrlpt_uuid, HOG_CONTROL_POINT_UUID);
if (!bt_uuid_cmp(&ctrlpt_uuid, &uuid))
hog->ctrlpt_handle = value_handle;
+
+ bt_uuid16_create(&sci_mode_uuid, HOG_SCI_MODE_UUID);
+ if (!bt_uuid_cmp(&sci_mode_uuid, &uuid))
+ hog->sci_mode_handle = value_handle;
+
+ bt_uuid16_create(&sci_info_uuid, HOG_SCI_INFO_UUID);
+ if (!bt_uuid_cmp(&sci_info_uuid, &uuid))
+ hog->sci_info_handle = value_handle;
}
static struct bt_hog *hog_new(int fd, const char *name, uint16_t vendor,
--
2.54.0
next prev 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 ` Luiz Augusto von Dentz [this message]
2026-07-24 20:41 ` 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 ` [PATCH BlueZ v1 09/12] mgmt-tester: Add HIDS recommended SCI parameter tests Luiz Augusto von Dentz
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-2-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