From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 2/3] HID: valve-index: Reboot headset on system power transitions
Date: Thu, 10 Sep 2026 17:17:55 +0000 [thread overview]
Message-ID: <20260910171756.57EEF1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260910170254.833871-3-mario.limonciello@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incorrect buffer formatting and report ID targeting in `hid_hw_raw_request` fallback for an unnumbered HID report.
--
commit 4526fbce2701e5a40089fba6ae186ded76bc0864
Author: Mario Limonciello <mario.limonciello@amd.com>
Subject: HID: valve-index: Reboot headset on system power transitions
This commit introduces a new HID driver for the Valve Index headset to
reboot it on system power transitions. It sends a specific 64-byte report
to recover the EDID service after a DisplayPort link shutdown.
Link: https://github.com/ValveSoftware/SteamVR-for-Linux/issues/939
> diff --git a/drivers/hid/hid-valve-index.c b/drivers/hid/hid-valve-index.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/hid/hid-valve-index.c
[ ... ]
> +static void valve_index_reboot(struct hid_device *hdev, bool wake)
> +{
> + u8 *report;
> + int ret;
> +
> + if (!valve_index_has_reboot_report(hdev))
> + return;
> +
> + /* USB transfer buffers must be DMA-able, so not on the stack. */
> + report = kzalloc(VALVE_INDEX_REPORT_SIZE, GFP_KERNEL);
> + if (!report)
> + return;
> + report[0] = VALVE_INDEX_REBOOT_REPORT_ID;
[Severity: Medium]
Is the report buffer sized correctly for an unnumbered report fallback?
The HID core and usbhid transport expect unnumbered report buffers to be
prefixed with a dummy 0x00 byte (so payload size + 1) for control transfers.
Allocating exactly 64 bytes and placing the payload command at index 0 might
break control transfer formatting in usbhid_set_raw_report if the fallback
path below is taken.
[ ... ]
> + /* Use the same interrupt-out then SET_REPORT fallback as hidraw. */
> + ret = hid_hw_output_report(hdev, report, VALVE_INDEX_REPORT_SIZE);
> + if (ret == -ENOSYS)
> + ret = hid_hw_raw_request(hdev, report[0], report,
> + VALVE_INDEX_REPORT_SIZE,
> + HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
[Severity: Medium]
Does this properly target the unnumbered report during the fallback?
By passing report[0] (which contains 0x16) as the reportnum argument, the
fallback control transfer will target Output Report ID 0x16 instead of the
required unnumbered report (ID 0). If hid_hw_output_report returns -ENOSYS
and this fallback is taken, the headset might reject the transfer, causing
the reboot command to fail.
> + if (ret < 0)
> + hid_warn(hdev, "failed to reboot headset: %d\n", ret);
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910170254.833871-1-mario.limonciello@amd.com?part=2
next prev parent reply other threads:[~2026-09-10 17:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 17:02 [PATCH 0/3] Add 'hid-valve-index' reset driver Mario Limonciello
2026-09-10 17:02 ` [PATCH 1/3] HID: Add shutdown callback for device drivers Mario Limonciello
2026-09-10 17:02 ` [PATCH 2/3] HID: valve-index: Reboot headset on system power transitions Mario Limonciello
2026-09-10 17:17 ` sashiko-bot [this message]
2026-09-10 17:21 ` Mario Limonciello
2026-09-11 4:55 ` Curtis Vogt
2026-09-10 20:04 ` Michal Pecio
2026-09-10 20:43 ` Mario Limonciello
2026-09-10 20:52 ` Michal Pecio
2026-09-10 20:58 ` Mario Limonciello
2026-09-12 14:07 ` Curtis Vogt
2026-09-11 4:54 ` Curtis Vogt
2026-09-11 9:08 ` Michal Pecio
2026-09-11 5:54 ` Greg Kroah-Hartman
2026-09-11 6:01 ` Mario Limonciello
2026-09-11 9:16 ` Michal Pecio
2026-09-11 9:23 ` Greg Kroah-Hartman
2026-09-11 15:12 ` Mario Limonciello
2026-09-11 18:20 ` Michal Pecio
2026-09-10 17:02 ` [PATCH 3/3] USB: quirks: Ignore remote wakeup from the Valve Index breakout box hub Mario Limonciello
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=20260910171756.57EEF1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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