usbhidd: reset global endpoint counter per candidate configuration

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.
This commit is contained in:
Red Bear OS
2026-07-20 21:09:05 +09:00
parent 2a3b0d4e0a
commit 94a99f02ed
+3
View File
@@ -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| {