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