Use more correct params in configure_endpoint.

Most importantly in the endpoint contexts of the input context,
specifying the properties of the endpoints that are being configured.
This commit is contained in:
4lDO2
2020-02-11 11:39:29 +01:00
parent d82ae0a5f6
commit 05392696fe
6 changed files with 204 additions and 36 deletions
+5 -3
View File
@@ -85,6 +85,7 @@ pub struct BulkOnlyTransport<'a> {
bulk_out_num: u8,
max_lun: u8,
current_tag: u32,
interface_num: u8,
}
pub const FEATURE_ENDPOINT_HALT: u16 = 0;
@@ -96,6 +97,8 @@ impl<'a> BulkOnlyTransport<'a> {
let bulk_in_num = (endpoints.iter().position(|endpoint| endpoint.direction() == EndpDirection::In).unwrap() + 1) as u8;
let bulk_out_num = (endpoints.iter().position(|endpoint| endpoint.direction() == EndpDirection::Out).unwrap() + 1) as u8;
bulk_only_mass_storage_reset(handle, if_desc.number.into())?;
let max_lun = get_max_lun(handle, 0)?;
println!("BOT_MAX_LUN {}", max_lun);
@@ -109,13 +112,14 @@ impl<'a> BulkOnlyTransport<'a> {
handle,
max_lun,
current_tag: 0,
interface_num: if_desc.number,
})
}
fn clear_stall(&mut self, endp_num: u8) -> Result<(), XhciClientHandleError> {
self.handle.clear_feature(PortReqRecipient::Endpoint, u16::from(endp_num), FEATURE_ENDPOINT_HALT)
}
fn reset_recovery(&mut self) -> Result<(), ProtocolError> {
bulk_only_mass_storage_reset(self.handle, 0)?;
bulk_only_mass_storage_reset(self.handle, self.interface_num.into())?;
self.clear_stall(self.bulk_in_num.into())?;
self.clear_stall(self.bulk_out_num.into())?;
@@ -128,8 +132,6 @@ impl<'a> BulkOnlyTransport<'a> {
impl<'a> Protocol for BulkOnlyTransport<'a> {
fn send_command(&mut self, cb: &[u8], data: DeviceReqData) -> Result<(), ProtocolError> {
dbg!(self.bulk_in_status.current_status()?);
dbg!(self.bulk_out_status.current_status()?);
self.current_tag += 1;
let tag = self.current_tag;