mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-09 15:55:37 +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
|
||||
);
|
||||
|
||||
let req = Request::parse(bmrequesttype, brequest, wvalue, windex, wlength)?;
|
||||
log::info!("{:?}", req);
|
||||
let request = Request::parse(bmrequesttype, brequest, wvalue, windex, wlength)
|
||||
.expect("Error parsing request");
|
||||
log::info!("EP0: {:?}", request);
|
||||
|
||||
match req {
|
||||
match request {
|
||||
Request::GetDescriptor { descriptor, length } => match descriptor {
|
||||
Descriptor::Device => {
|
||||
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);
|
||||
}
|
||||
|
||||
// TODO Configuration descriptor
|
||||
// Descriptor::Configuration => todo!(),
|
||||
// TODO implement Configuration descriptor
|
||||
// Descriptor::Configuration { .. } => todo!(),
|
||||
},
|
||||
// TODO
|
||||
// Request::SetAddress { .. } => todo!(),
|
||||
Request::SetAddress { .. } => {
|
||||
// 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!(),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue