From: Paolo Pisati <p.pisati@gmail.com>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
"Luke Jones" <luke@ljones.dev>,
"Joshua Leivenzon" <hacker1024@users.sourceforge.net>,
"Ivan Levchenko" <me@livan.pro>,
"Rebecca Mara Müller" <rebecca.mara@posteo.de>,
"Nathan Chancellor" <nathan@kernel.org>,
"Denis Benato" <denis.benato@linux.dev>
Subject: [PATCH v3 5/7] HID: asus: Do not send feature reports larger than declared
Date: Tue, 13 Oct 2026 12:40:02 +0200 [thread overview]
Message-ID: <20261013104033.36079-6-p.pisati@gmail.com> (raw)
In-Reply-To: <20261013104033.36079-1-p.pisati@gmail.com>
The keyboard backlight and Fn-lock commands are sent as 64 byte
feature reports, the size of report 0x5a on the ROG keyboards. The
Zenbook Duo keyboards declare feature report 0x5a with 15 data bytes,
16 with the report ID, and do not answer writes larger than that: the
control transfer times out over USB and fails with -EIO over
Bluetooth, so the backlight cannot be set, while the 16 byte handshake
goes through.
Cap feature report writes at the length the device declares for the
report, when it declares it. hid_report_len() counts the report ID, so
the handshake and the other commands up to that size are sent as they
are.
Assisted-by: LLM
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Tested-by: Rebecca Mara Müller <rebecca.mara@posteo.de> # UX8407AA
---
drivers/hid/hid-asus.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index b127f5c38f60..7b17553e94b6 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -632,6 +632,18 @@ static int asus_raw_event(struct hid_device *hdev,
static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
{
+ struct hid_report *report;
+
+ /*
+ * Do not send more than the declared size of the report, report ID
+ * included: the Zenbook Duo keyboards declare 15 data bytes for
+ * report 0x5a, 16 on the wire like the handshake, and do not answer
+ * the 64 byte writes sized for the ROG keyboards.
+ */
+ report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[buf[0]];
+ if (report)
+ buf_size = min_t(size_t, buf_size, hid_report_len(report));
+
u8 *dmabuf __free(kfree) = kmemdup(buf, buf_size, GFP_KERNEL);
if (!dmabuf)
return -ENOMEM;
--
2.43.0
next prev parent reply other threads:[~2026-10-13 10:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 10:39 [PATCH v3 0/7] HID: asus: ASUS Zenbook Duo keyboard support Paolo Pisati
2026-10-13 10:39 ` [PATCH v3 1/7] HID: asus: Fix up Zenbook Duo report descriptors Paolo Pisati
2026-10-13 10:39 ` [PATCH v3 2/7] HID: asus: Add missing Zenbook Duo hotkeys Paolo Pisati
2026-10-13 10:40 ` [PATCH v3 3/7] HID: asus: Force hid-input to bind to the Zenbook Duo hotkey interface Paolo Pisati
2026-10-13 10:40 ` [PATCH v3 4/7] HID: asus: Cycle the platform profile from the Zenbook Duo profile key Paolo Pisati
2026-10-13 10:40 ` Paolo Pisati [this message]
2026-10-13 10:40 ` [PATCH v3 6/7] HID: asus: add prod-id, quirk for Zenbook Duo keyboard Paolo Pisati
2026-10-13 10:40 ` [PATCH v3 7/7] HID: asus: Re-send the Zenbook Duo keyboard handshake after probe Paolo Pisati
2026-10-13 11:45 ` [PATCH v3 0/7] HID: asus: ASUS Zenbook Duo keyboard support Rebecca Mara Müller
2026-10-13 13:56 ` Denis Benato
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=20261013104033.36079-6-p.pisati@gmail.com \
--to=p.pisati@gmail.com \
--cc=bentiss@kernel.org \
--cc=denis.benato@linux.dev \
--cc=hacker1024@users.sourceforge.net \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=me@livan.pro \
--cc=nathan@kernel.org \
--cc=rebecca.mara@posteo.de \
/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