xhcid: improve endpoint parsing

This commit is contained in:
Jeremy Soller
2024-04-16 08:10:32 -06:00
parent 806be9bdc6
commit 61e2ee224a
2 changed files with 10 additions and 4 deletions
+2 -1
View File
@@ -156,7 +156,8 @@ impl EndpDesc {
self.ssc.is_some()
}
pub fn is_superspeedplus(&self) -> bool {
todo!()
log::warn!("TODO: is_superspeedplus not implemented, defaulting to false");
false
}
fn interrupt_usage_bits(&self) -> u8 {
assert!(self.is_interrupt());
+8 -3
View File
@@ -1093,14 +1093,18 @@ impl Xhci {
let mut endpoints = SmallVec::<[EndpDesc; 4]>::new();
let mut hid_descs = SmallVec::<[HidDesc; 1]>::new();
for _ in 0..idesc.endpoints {
while endpoints.len() < idesc.endpoints as usize {
let next = match iter.next() {
Some(AnyDescriptor::Endpoint(n)) => n,
Some(AnyDescriptor::Hid(h)) if idesc.class == 3 => {
hid_descs.push(h.into());
break;
continue;
}
_ => break,
Some(unexpected) => {
log::warn!("expected endpoint, got {:X?}", unexpected);
break;
},
None => break,
};
let mut endp = EndpDesc::from(next);
@@ -1124,6 +1128,7 @@ impl Xhci {
interface_descs.push(self.new_if_desc(port_id, slot, idesc, endpoints, hid_descs).await?);
} else {
log::warn!("expected interface, got {:?}", item);
// TODO
break;
}