fn send_usb_request(&self, req_type: u16, len: u32) -> Result<(), Error> {
        use byteorder::{ByteOrder, LittleEndian};

        let mut request = [0_u8; 32];
        request[..4].clone_from_slice(b"AWUC");
        LittleEndian::write_u32(&mut request[8..12], len);
        LittleEndian::write_u32(&mut request[12..16], 0x0C00_0000); // Unknown data
        LittleEndian::write_u16(&mut request[16..18], req_type);
        LittleEndian::write_u32(&mut request[18..22], len); // Length is repeated
                                                            // Bytes from 22 to 32 are padding

        UsbHandle::usb_bulk_send(&self.device_handle, self.endpoint_out, &request)
            .context("unable to send data in bulk to USB")?;
        Ok(())
    }
/// Sends the request type USB request.
Sends the request type USB request.
Sends the request type USB request .
fn send_usb_request(&self, req_type: u16, len: u32) -> Result<(), Error> {
        use byteorder::{ByteOrder, LittleEndian};
        let mut request = [0_u8; 32];
        request[..4].clone_from_slice(b"AWUC");
        LittleEndian::write_u32(&mut request[8..12], len);
        LittleEndian::write_u32(&mut request[12..16], 0x0C00_0000); // Unknown data
        LittleEndian::write_u16(&mut request[16..18], req_type);
        LittleEndian::write_u32(&mut request[18..22], len); // Length is repeated
                                                            // Bytes from 22 to 32 are padding
        UsbHandle::usb_bulk_send(&self.device_handle, self.endpoint_out, &request)
            .context("unable to send data in bulk to USB")?;
        Ok(())
    }
fn send_usb_request ( & self , req_type : u16 , len : u32 ) -> Result < ( ) , Error > { use byteorder :: { ByteOrder , LittleEndian } ; let mut request = [ 0_u8 ; 32 ] ; request [ .. 4 ] . clone_from_slice ( b" " ) ; LittleEndian :: write_u32 ( & mut request [ 8 .. 12 ] , len ) ; LittleEndian :: write_u32 ( & mut request [ 12 .. 16 ] , 0x0C00_0000 ) ; // Unknown data LittleEndian :: write_u16 ( & mut request [ 16 .. 18 ] , req_type ) ; LittleEndian :: write_u32 ( & mut request [ 18 .. 22 ] , len ) ; // Length is repeated // Bytes from 22 to 32 are padding UsbHandle :: usb_bulk_send ( & self . device_handle , self . endpoint_out , & request ) . context ( " " ) ? ; Ok ( ( ) ) }
Sends the request type USB request.
Sends the request type USB request .
&self
req_type
u16
len
u32
&self
req_type
u16
len
u32