src/app/host-serial/libftdi/ftdi.c
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
{
    unsigned short usb_val;

    if (latency < 1)
        ftdi_error_return(-1, "latency out of range. Only valid for 1-255");

    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-3, "USB device unavailable");

    if (latency == ftdi->latency_timer)
        return 0;

    usb_val = latency;
    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_LATENCY_TIMER_REQUEST, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) < 0)
        ftdi_error_return(-2, "unable to set latency timer");

    ftdi->latency_timer = latency;

    return 0;
}
/**
    Set latency timer

    The FTDI chip keeps data in the internal buffer for a specific
    amount of time if the buffer is not full yet to decrease
    load on the usb bus.

    \param ftdi pointer to ftdi_context
    \param latency Value between 1 and 255

    \retval  0: all fine
    \retval -1: latency out of range
    \retval -2: unable to set latency timer
    \retval -3: USB device unavailable
*/
Set latency timer
The FTDI chip keeps data in the internal buffer for a specific
amount of time if the buffer is not full yet to decrease
load on the usb bus.

\param ftdi pointer to ftdi_context
\param latency Value between 1 and 255

\retval  0: all fine
\retval -1: latency out of range
\retval -2: unable to set latency timer
\retval -3: USB device unavailable
Set latency timer The FTDI chip keeps data in the internal buffer for a specific amount of time if the buffer is not full yet to decrease load on the usb bus . \ param ftdi pointer to ftdi_context \ param latency Value between 1 and 255 \ retval 0 : all fine \ retval - 1 : latency out of range \ retval - 2 : unable to set latency timer \ retval - 3 : USB device unavailable
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
{
    unsigned short usb_val;
    if (latency < 1)
        ftdi_error_return(-1, "latency out of range. Only valid for 1-255");
    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-3, "USB device unavailable");
    if (latency == ftdi->latency_timer)
        return 0;
    usb_val = latency;
    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_LATENCY_TIMER_REQUEST, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) < 0)
        ftdi_error_return(-2, "unable to set latency timer");
    ftdi->latency_timer = latency;
    return 0;
}
int ftdi_set_latency_timer ( struct ftdi_context * ftdi , unsigned char latency ) { unsigned short usb_val ; if ( latency < 1 ) ftdi_error_return ( -1 , " " ) ; if ( ftdi == NULL || ftdi -> usb_dev == NULL ) ftdi_error_return ( -3 , " " ) ; if ( latency == ftdi -> latency_timer ) return 0 ; usb_val = latency ; if ( libusb_control_transfer ( ftdi -> usb_dev , FTDI_DEVICE_OUT_REQTYPE , SIO_SET_LATENCY_TIMER_REQUEST , usb_val , ftdi -> index , NULL , 0 , ftdi -> usb_write_timeout ) < 0 ) ftdi_error_return ( -2 , " " ) ; ftdi -> latency_timer = latency ; return 0 ; }
Set latency timer
The FTDI chip keeps data in the internal buffer for a specific
amount of time if the buffer is not full yet to decrease
load on the usb bus.
Set latency timer The FTDI chip keeps data in the internal buffer for a specific amount of time if the buffer is not full yet to decrease load on the usb bus .