FreeBSD: support libusb hid input driver
This commit is contained in:
parent
34491a6025
commit
28c6237b47
|
@ -916,7 +916,11 @@ ifeq ($(HAVE_THREADS), 1)
|
||||||
ifeq ($(HAVE_HID), 1)
|
ifeq ($(HAVE_HID), 1)
|
||||||
DEFINES += -DHAVE_LIBUSB
|
DEFINES += -DHAVE_LIBUSB
|
||||||
OBJ += input/drivers_hid/libusb_hid.o
|
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
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -16,7 +16,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <libusb.h>
|
||||||
|
#else
|
||||||
#include <libusb-1.0/libusb.h>
|
#include <libusb-1.0/libusb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <rthreads/rthreads.h>
|
#include <rthreads/rthreads.h>
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
|
@ -38,7 +42,11 @@ typedef struct libusb_hid
|
||||||
libusb_context *ctx;
|
libusb_context *ctx;
|
||||||
joypad_connection_t *slots;
|
joypad_connection_t *slots;
|
||||||
sthread_t *poll_thread;
|
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 */
|
int hp; /* libusb_hotplug_callback_handle is just int */
|
||||||
|
#endif
|
||||||
int quit;
|
int quit;
|
||||||
} libusb_hid_t;
|
} libusb_hid_t;
|
||||||
|
|
||||||
|
@ -538,8 +546,14 @@ static void *libusb_hid_init(void)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
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))
|
if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG))
|
||||||
goto error;
|
goto error;
|
||||||
|
#endif
|
||||||
|
|
||||||
hid->slots = pad_connection_init(MAX_USERS);
|
hid->slots = pad_connection_init(MAX_USERS);
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ if [ "$HAVE_SDL2" = 'yes' ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_pkgconf LIBUSB libusb-1.0 1.0.16
|
check_pkgconf LIBUSB libusb-1.0 1.0.13
|
||||||
|
|
||||||
if [ "$OS" = 'Win32' ]; then
|
if [ "$OS" = 'Win32' ]; then
|
||||||
check_lib '' DINPUT -ldinput8
|
check_lib '' DINPUT -ldinput8
|
||||||
|
|
Loading…
Reference in New Issue