fn usb_bulk_send(device_handle: &DeviceHandle, endpoint: u8, data: &[u8]) -> Result<(), Error> {
        let mut sent = 0;
        while sent < data.len() {
            let slice = if data.len() - sent < AW_USB_MAX_BULK_SEND {
                &data[sent..]
            } else {
                &data[sent..sent + AW_USB_MAX_BULK_SEND]
            };
            sent += device_handle
                .write_bulk(endpoint, slice, Duration::from_secs(USB_TIMEOUT))
                .context({
                    format!(
                        "unable to send data chunk to USB, sent {} bytes: {:?}",
                        sent,
                        &data[..sent]
                    )
                })?;
        }

        Ok(())
    }
/// Sends data to the USB in bulk.
///
/// It will divide the data in chunks.
Sends data to the USB in bulk.
It will divide the data in chunks.
Sends data to the USB in bulk . It will divide the data in chunks .
fn usb_bulk_send(device_handle: &DeviceHandle, endpoint: u8, data: &[u8]) -> Result<(), Error> {
        let mut sent = 0;
        while sent < data.len() {
            let slice = if data.len() - sent < AW_USB_MAX_BULK_SEND {
                &data[sent..]
            } else {
                &data[sent..sent + AW_USB_MAX_BULK_SEND]
            };
            sent += device_handle
                .write_bulk(endpoint, slice, Duration::from_secs(USB_TIMEOUT))
                .context({
                    format!(
                        "unable to send data chunk to USB, sent {} bytes: {:?}",
                        sent,
                        &data[..sent]
                    )
                })?;
        }
        Ok(())
    }
fn usb_bulk_send ( device_handle : & DeviceHandle , endpoint : u8 , data : & [ u8 ] ) -> Result < ( ) , Error > { let mut sent = 0 ; while sent < data . len ( ) { let slice = if data . len ( ) - sent < AW_USB_MAX_BULK_SEND { & data [ sent .. ] } else { & data [ sent .. sent + AW_USB_MAX_BULK_SEND ] } ; sent += device_handle . write_bulk ( endpoint , slice , Duration :: from_secs ( USB_TIMEOUT ) ) . context ( { format ! ( " " sent data [ sent ] ) } ) ? ; } Ok ( ( ) ) }
Sends data to the USB in bulk.
Sends data to the USB in bulk .
device_handle
&DeviceHandle
endpoint
u8
data
&[u8]
device_handle
&DeviceHandle
endpoint
u8
data
&[u8]