Fix two FreeBSD build issues related to libusb-1.0.

FreeBSD's libusb-1.0 compatible library has a few differences compared
to the "normal" libusb-1.0 from libusb.org which we have to work around.

LIBUSB_CLASS_APPLICATION doesn't exist in FreeBSD's libusb, and
libusb_handle_events_timeout_completed() doesn't exist either.
The latter is basically libusb_handle_events_timeout() with an extra
(unused by us) parameter, so the workaround is relatively simple.

This fixes bug #185.
This commit is contained in:
Uwe Hermann 2013-10-28 22:59:32 +01:00
parent 71185b48a1
commit 6bf4273ee8
1 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,13 @@
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a) #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
#endif #endif
/* Portability fixes for FreeBSD. */
#ifdef __FreeBSD__
#define LIBUSB_CLASS_APPLICATION 0xfe
#define libusb_handle_events_timeout_completed(ctx, tv, c) \
libusb_handle_events_timeout(ctx, tv)
#endif
struct sr_context { struct sr_context {
#ifdef HAVE_LIBUSB_1_0 #ifdef HAVE_LIBUSB_1_0
libusb_context *libusb_ctx; libusb_context *libusb_ctx;