usb: make ControlPipe accept, reject async.
This commit is contained in:
@ -142,6 +142,12 @@ pub trait ControlPipe {
|
||||
where
|
||||
Self: 'a;
|
||||
type DataInFuture<'a>: Future<Output = Result<(), EndpointError>> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
type AcceptFuture<'a>: Future<Output = ()> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
type RejectFuture<'a>: Future<Output = ()> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
@ -171,12 +177,12 @@ pub trait ControlPipe {
|
||||
/// Accepts a control request.
|
||||
///
|
||||
/// Causes the STATUS packet for the current request to be ACKed.
|
||||
fn accept(&mut self);
|
||||
fn accept<'a>(&'a mut self) -> Self::AcceptFuture<'a>;
|
||||
|
||||
/// Rejects a control request.
|
||||
///
|
||||
/// Sets a STALL condition on the pipe to indicate an error.
|
||||
fn reject(&mut self);
|
||||
fn reject<'a>(&'a mut self) -> Self::RejectFuture<'a>;
|
||||
}
|
||||
|
||||
pub trait EndpointIn: Endpoint {
|
||||
|
@ -306,7 +306,7 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> {
|
||||
}
|
||||
}
|
||||
}
|
||||
InResponse::Rejected => self.control.reject(),
|
||||
InResponse::Rejected => self.control.reject().await,
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,8 +337,8 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> {
|
||||
trace!(" control out data: {:02x?}", data);
|
||||
|
||||
match self.inner.handle_control_out(req, data) {
|
||||
OutResponse::Accepted => self.control.accept(),
|
||||
OutResponse::Rejected => self.control.reject(),
|
||||
OutResponse::Accepted => self.control.accept().await,
|
||||
OutResponse::Rejected => self.control.reject().await,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user