From 94a99f02ed4f58f1237e2971af8e05a8a70d0329 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Mon, 20 Jul 2026 21:09:05 +0900 Subject: [PATCH] usbhidd: reset global endpoint counter per candidate configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit usbhidd already accumulated prior interfaces' endpoint counts (global enumeration index, matching xhcid's PortState::get_endp_desc), but the counter was never reset between candidate configurations — a HID device whose usable config is not the first would get endpoint numbers offset by the first config's endpoints. xhcid indexes within the selected configuration only, so reset per config. --- drivers/input/usbhidd/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/usbhidd/src/main.rs b/drivers/input/usbhidd/src/main.rs index c716b0d324..96da0d8093 100644 --- a/drivers/input/usbhidd/src/main.rs +++ b/drivers/input/usbhidd/src/main.rs @@ -242,6 +242,9 @@ fn main() -> Result<()> { .config_descs .iter() .find_map(|conf_desc| { + // xhcid indexes endpoints within the selected configuration + // only; reset the global counter for each candidate config. + endp_count = 0; let if_desc = conf_desc.interface_descs.iter().find_map(|if_desc| { if if_desc.number == interface_num { let endp_desc_opt = if_desc.endpoints.iter().find_map(|endp_desc| {