1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

FreeBSD: support libusb hid input driver

This commit is contained in:
Brad Parker 2017-11-22 23:44:54 -05:00
parent 34491a6025
commit 28c6237b47
3 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -16,7 +16,11 @@
#include <stdlib.h>
#include <string.h>
#ifdef __FreeBSD__
#include <libusb.h>
#else
#include <libusb-1.0/libusb.h>
#endif
#include <rthreads/rthreads.h>
#include <compat/strl.h>
@ -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);

View File

@ -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