Linux bluetooth development
 help / color / mirror / Atom feed
From: Sebastian <seb.witt@googlemail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Sebastian <seb.witt@googlemail.com>
Subject: [PATCH v3 2/6] main.conf: Add LongReportMap option to [Input]
Date: Thu,  3 Dec 2026 16:34:04 +0100	[thread overview]
Message-ID: <20261203153408.31769-3-seb.witt@googlemail.com> (raw)
In-Reply-To: <20261203153408.31769-1-seb.witt@googlemail.com>

Add an option to accept HID over GATT Report Maps longer than the 512
octets an attribute value may have, as exposed by some non-compliant
devices. It defaults to true, as other operating systems accept them,
or to false when Testing is enabled so the limit is enforced for
qualification.
---
 src/btd.h     |  5 +++++
 src/main.c    | 26 +++++++++++++++++++++++++-
 src/main.conf |  7 +++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/btd.h b/src/btd.h
index 9bf310271..378c567c3 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -126,6 +126,10 @@ struct btd_avrcp_opts {
 	bool		volume_category;
 };
 
+struct btd_input_opts {
+	bool		long_report_map;
+};
+
 struct btd_advmon_opts {
 	uint8_t		rssi_sampling_period;
 };
@@ -172,6 +176,7 @@ struct btd_opts {
 
 	struct btd_avdtp_opts avdtp;
 	struct btd_avrcp_opts avrcp;
+	struct btd_input_opts input;
 
 	uint8_t		key_size;
 
diff --git a/src/main.c b/src/main.c
index 3a051c5a4..8c7e5206f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -185,6 +185,11 @@ static const char *avrcp_options[] = {
 	NULL
 };
 
+static const char * const input_options[] = {
+	"LongReportMap",
+	NULL
+};
+
 static const char *advmon_options[] = {
 	"RSSISamplingPeriod",
 	NULL
@@ -210,6 +215,7 @@ static const struct group_table {
 	{ "CSIS",	csip_options },
 	{ "AVDTP",	avdtp_options },
 	{ "AVRCP",	avrcp_options },
+	{ "Input",	input_options },
 	{ "ChannelSounding",	bcs_options },
 	{ "AdvMon",	advmon_options },
 	{ "HDT",	hdt_options },
@@ -1400,6 +1406,18 @@ static void parse_avrcp(GKeyFile *config)
 		&btd_opts.avrcp.volume_category);
 }
 
+static void parse_input(GKeyFile *config)
+{
+	/* Cap the Report Map to 512 octets by default when testing, e.g.
+	 * for qualification.
+	 */
+	btd_opts.input.long_report_map = !btd_opts.testing;
+
+	if (config)
+		parse_config_bool(config, "Input", "LongReportMap",
+					&btd_opts.input.long_report_map);
+}
+
 static void parse_advmon(GKeyFile *config)
 {
 	parse_config_u8(config, "AdvMon", "RSSISamplingPeriod",
@@ -1442,8 +1460,11 @@ static void parse_hdt(GKeyFile *config)
 
 static void parse_config(GKeyFile *config)
 {
-	if (!config)
+	if (!config) {
+		/* Apply the defaults depending on Testing, set with -T */
+		parse_input(NULL);
 		return;
+	}
 
 	check_config(config);
 
@@ -1457,6 +1478,7 @@ static void parse_config(GKeyFile *config)
 	parse_csis(config);
 	parse_avdtp(config);
 	parse_avrcp(config);
+	parse_input(config);
 	parse_le_cs_config(config);
 	parse_advmon(config);
 	parse_hdt(config);
@@ -1514,6 +1536,8 @@ static void init_defaults(void)
 	btd_opts.avrcp.volume_without_target = false;
 	btd_opts.avrcp.volume_category = true;
 
+	btd_opts.input.long_report_map = true;
+
 	btd_opts.advmon.rssi_sampling_period = 0xFF;
 	btd_opts.csis.encrypt = true;
 
diff --git a/src/main.conf b/src/main.conf
index c9906148d..451a5281f 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -419,6 +419,13 @@
 # notifications.
 #VolumeCategory = true
 
+[Input]
+# Accept HID over GATT Report Maps longer than the 512 octets an attribute
+# value may have, as exposed by some non-compliant devices, which other
+# operating systems accept as well.
+# Defaults to true, or false when Testing is enabled.
+#LongReportMap = true
+
 [Policy]
 #
 # The ReconnectUUIDs defines the set of remote services that should try
-- 
2.56.1


  parent reply	other threads:[~2026-12-03 15:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABBYNZ+GNO-eVNC5B_4SqCdHOE+OHmXUaW0NwStd_BsbUzx35A@mail.gmail.com>
2026-11-30 20:45 ` [PATCH v2 0/4] Accept HoG Report Map longer than 512 octets Sebastian
2026-11-30 20:45   ` [PATCH v2 1/4] shared/gatt-client: Add bt_gatt_client_read_long_value_max_len Sebastian
2026-12-01  0:02     ` Accept HoG Report Map longer than 512 octets bluez.test.bot
2026-12-02 16:13       ` Luiz Augusto von Dentz
2026-11-30 20:45   ` [PATCH v2 2/4] main.conf: Add LongReportMap option to [Input] Sebastian
2026-11-30 20:45   ` [PATCH v2 3/4] shared/hog: Add bt_hog_set_long_report_map Sebastian
2026-11-30 20:45   ` [PATCH v2 4/4] input/hog: Accept Report Map longer than 512 octets Sebastian
2026-12-03 15:34 ` [PATCH v3 0/6] Accept HoG " Sebastian
2026-12-03 15:34   ` [PATCH v3 1/6] shared/gatt-client: Add bt_gatt_client_read_long_value_max_len Sebastian
2026-12-03 15:34   ` Sebastian [this message]
2026-12-03 15:34   ` [PATCH v3 3/6] shared/hog: Add bt_hog_set_long_report_map Sebastian
2026-12-03 15:34   ` [PATCH v3 4/6] input/hog: Accept Report Map longer than 512 octets Sebastian
2026-12-03 15:34   ` [PATCH v3 5/6] unit/test-gatt: Add tests for long reads beyond " Sebastian
2026-12-03 15:34   ` [PATCH v3 6/6] unit/test-hog: Add tests for long Report Map Sebastian

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=20261203153408.31769-3-seb.witt@googlemail.com \
    --to=seb.witt@googlemail.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