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

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

    usb_val = errorch;
    if (enable)
        usb_val |= 1 << 8;

    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_ERROR_CHAR_REQUEST, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) < 0)
        ftdi_error_return(-1, "setting error character failed");

    return 0;
}
/**
    Set error character

    \param ftdi pointer to ftdi_context
    \param errorch Error character
    \param enable 0 to disable the error character, non-zero otherwise

    \retval  0: all fine
    \retval -1: unable to set error character
    \retval -2: USB device unavailable
*/
Set error character
\param ftdi pointer to ftdi_context
\param errorch Error character
\param enable 0 to disable the error character, non-zero otherwise

\retval  0: all fine
\retval -1: unable to set error character
\retval -2: USB device unavailable
Set error character \ param ftdi pointer to ftdi_context \ param errorch Error character \ param enable 0 to disable the error character non - zero otherwise \ retval 0 : all fine \ retval - 1 : unable to set error character \ retval - 2 : USB device unavailable
int ftdi_set_error_char(struct ftdi_context *ftdi,
                        unsigned char errorch, unsigned char enable)
{
    unsigned short usb_val;
    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-2, "USB device unavailable");
    usb_val = errorch;
    if (enable)
        usb_val |= 1 << 8;
    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_ERROR_CHAR_REQUEST, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) < 0)
        ftdi_error_return(-1, "setting error character failed");
    return 0;
}
int ftdi_set_error_char ( struct ftdi_context * ftdi , unsigned char errorch , unsigned char enable ) { unsigned short usb_val ; if ( ftdi == NULL || ftdi -> usb_dev == NULL ) ftdi_error_return ( -2 , " " ) ; usb_val = errorch ; if ( enable ) usb_val |= 1 << 8 ; if ( libusb_control_transfer ( ftdi -> usb_dev , FTDI_DEVICE_OUT_REQTYPE , SIO_SET_ERROR_CHAR_REQUEST , usb_val , ftdi -> index , NULL , 0 , ftdi -> usb_write_timeout ) < 0 ) ftdi_error_return ( -1 , " " ) ; return 0 ; }
Set error character
\param ftdi pointer to ftdi_context
\param errorch Error character
\param enable 0 to disable the error character, non-zero otherwise
Set error character \ param ftdi pointer to ftdi_context \ param errorch Error character \ param enable 0 to disable the error character non - zero otherwise