src/app/host-serial/libftdi/ftdi.c
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
{
    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-2, "USB device unavailable");

    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_IN_REQTYPE, SIO_READ_PINS_REQUEST, 0, ftdi->index, (unsigned char *)pins, 1, ftdi->usb_read_timeout) != 1)
        ftdi_error_return(-1, "read pins failed");

    return 0;
}
/**
    Directly read pin state, circumventing the read buffer. Useful for bitbang mode.

    \param ftdi pointer to ftdi_context
    \param pins Pointer to store pins into

    \retval  0: all fine
    \retval -1: read pins failed
    \retval -2: USB device unavailable
*/
Directly read pin state, circumventing the read buffer. Useful for bitbang mode.
\param ftdi pointer to ftdi_context
\param pins Pointer to store pins into

\retval  0: all fine
\retval -1: read pins failed
\retval -2: USB device unavailable
Directly read pin state circumventing the read buffer . Useful for bitbang mode . \ param ftdi pointer to ftdi_context \ param pins Pointer to store pins into \ retval 0 : all fine \ retval - 1 : read pins failed \ retval - 2 : USB device unavailable
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
{
    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-2, "USB device unavailable");
    if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_IN_REQTYPE, SIO_READ_PINS_REQUEST, 0, ftdi->index, (unsigned char *)pins, 1, ftdi->usb_read_timeout) != 1)
        ftdi_error_return(-1, "read pins failed");
    return 0;
}
int ftdi_read_pins ( struct ftdi_context * ftdi , unsigned char * pins ) { if ( ftdi == NULL || ftdi -> usb_dev == NULL ) ftdi_error_return ( -2 , " " ) ; if ( libusb_control_transfer ( ftdi -> usb_dev , FTDI_DEVICE_IN_REQTYPE , SIO_READ_PINS_REQUEST , 0 , ftdi -> index , ( unsigned char * ) pins , 1 , ftdi -> usb_read_timeout ) != 1 ) ftdi_error_return ( -1 , " " ) ; return 0 ; }
Directly read pin state, circumventing the read buffer.
Directly read pin state circumventing the read buffer .