diff --git a/Makefile.common b/Makefile.common index ace2a5c4a6..cac0ea4aaf 100644 --- a/Makefile.common +++ b/Makefile.common @@ -916,7 +916,11 @@ ifeq ($(HAVE_THREADS), 1) ifeq ($(HAVE_HID), 1) DEFINES += -DHAVE_LIBUSB OBJ += input/drivers_hid/libusb_hid.o - LIBS += -lusb-1.0 + ifneq ($(findstring BSD,$(OS)),) + LIBS += -lusb + else + LIBS += -lusb-1.0 + endif endif endif endif diff --git a/input/drivers_hid/libusb_hid.c b/input/drivers_hid/libusb_hid.c index d112a46f97..bc6ddb4d0e 100644 --- a/input/drivers_hid/libusb_hid.c +++ b/input/drivers_hid/libusb_hid.c @@ -16,7 +16,11 @@ #include #include +#ifdef __FreeBSD__ +#include +#else #include +#endif #include #include @@ -38,7 +42,11 @@ typedef struct libusb_hid libusb_context *ctx; joypad_connection_t *slots; sthread_t *poll_thread; +#if defined(__FreeBSD__) && LIBUSB_API_VERSION <= 0x01000102 + libusb_hotplug_callback_handle hp; +#else int hp; /* libusb_hotplug_callback_handle is just int */ +#endif int quit; } libusb_hid_t; @@ -538,8 +546,14 @@ static void *libusb_hid_init(void) if (ret < 0) goto error; +#if 0 + /* NOTE: In what situation could this possibly happen? + * Don't use it for now since it requires a newer API + * version than FreeBSD has. + */ if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) goto error; +#endif hid->slots = pad_connection_init(MAX_USERS); diff --git a/qb/config.libs.sh b/qb/config.libs.sh index d93a6f2732..9d382ad36a 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -264,7 +264,7 @@ if [ "$HAVE_SDL2" = 'yes' ]; then fi fi -check_pkgconf LIBUSB libusb-1.0 1.0.16 +check_pkgconf LIBUSB libusb-1.0 1.0.13 if [ "$OS" = 'Win32' ]; then check_lib '' DINPUT -ldinput8