mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-25 07:18:08 +00:00
usb-4.rs: unify
This commit is contained in:
parent
bb7ea8f685
commit
88d713d65f
1 changed files with 14 additions and 7 deletions
|
@ -77,10 +77,11 @@ fn ep0setup(usbd: &USBD, ep0in: &mut Ep0In, _state: &mut usb2::State) -> Result<
|
||||||
wvalue
|
wvalue
|
||||||
);
|
);
|
||||||
|
|
||||||
let req = Request::parse(bmrequesttype, brequest, wvalue, windex, wlength)?;
|
let request = Request::parse(bmrequesttype, brequest, wvalue, windex, wlength)
|
||||||
log::info!("{:?}", req);
|
.expect("Error parsing request");
|
||||||
|
log::info!("EP0: {:?}", request);
|
||||||
|
|
||||||
match req {
|
match request {
|
||||||
Request::GetDescriptor { descriptor, length } => match descriptor {
|
Request::GetDescriptor { descriptor, length } => match descriptor {
|
||||||
Descriptor::Device => {
|
Descriptor::Device => {
|
||||||
let desc = usb2::device::Descriptor {
|
let desc = usb2::device::Descriptor {
|
||||||
|
@ -100,11 +101,17 @@ fn ep0setup(usbd: &USBD, ep0in: &mut Ep0In, _state: &mut usb2::State) -> Result<
|
||||||
let _ = ep0in.start(&bytes[..core::cmp::min(bytes.len(), length.into())], usbd);
|
let _ = ep0in.start(&bytes[..core::cmp::min(bytes.len(), length.into())], usbd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Configuration descriptor
|
// TODO implement Configuration descriptor
|
||||||
// Descriptor::Configuration => todo!(),
|
// Descriptor::Configuration { .. } => todo!(),
|
||||||
},
|
},
|
||||||
// TODO
|
Request::SetAddress { .. } => {
|
||||||
// Request::SetAddress { .. } => todo!(),
|
// On Mac OS you'll get this request before the GET_DESCRIPTOR request so we
|
||||||
|
// need to catch it here.
|
||||||
|
|
||||||
|
// TODO: handle this request properly now.
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
// TODO handle SET_CONFIGURATION request
|
||||||
// Request::SetConfiguration { .. } => todo!(),
|
// Request::SetConfiguration { .. } => todo!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue