X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Flibsigrok-internal.h;h=a2350e02ddf3aed2c48c89bcab2ac8eb8f59dfae;hp=4e4143009a9c506f2ab34ab58583a3c784bce296;hb=713a3f352496f928b9911bfdc7e87a67134113df;hpb=f478c3e613ac047572cfad9c5dcde965050b17fe diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 4e414300..a2350e02 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -32,6 +32,9 @@ #ifdef HAVE_LIBUSB_1_0 #include #endif +#ifdef HAVE_LIBFTDI +#include +#endif #include #include #include @@ -981,6 +984,21 @@ static inline void write_dblle_inc(uint8_t **p, double x) libusb_handle_events_timeout(ctx, tv) #endif +/* + * Convenience for FTDI library version dependency. + * - Version 1.5 introduced ftdi_tciflush(), ftdi_tcoflush(), and + * ftdi_tcioflush() all within the same commit, and deprecated + * ftdi_usb_purge_buffers() which suffered from inverse semantics. + * The API is drop-in compatible (arguments count and data types are + * identical). The libsigrok source code always flushes RX and TX at + * the same time, never individually. + */ +#if defined HAVE_FTDI_TCIOFLUSH && HAVE_FTDI_TCIOFLUSH +# define PURGE_FTDI_BOTH ftdi_tcioflush +#else +# define PURGE_FTDI_BOTH ftdi_usb_purge_buffers +#endif + /* Static definitions of structs ending with an all-zero entry are a * problem when compiling with -Wmissing-field-initializers: GCC * suppresses the warning only with { 0 }, clang wants { } */ @@ -2064,7 +2082,9 @@ SR_PRIV gboolean usb_match_manuf_prod(libusb_device *dev, /** Binary value type */ enum binary_value_type { - BVT_UINT8 = 0, + BVT_INVALID, + + BVT_UINT8, BVT_BE_UINT8 = BVT_UINT8, BVT_LE_UINT8 = BVT_UINT8,