mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-15 17:45:31 +00:00
Fixed building with libusb on FreeBSD
This commit is contained in:
@@ -82,7 +82,6 @@
|
||||
#define wcsncpy SDL_wcslcpy
|
||||
|
||||
|
||||
#ifndef SDL_PLATFORM_FREEBSD
|
||||
/* this is awkwardly inlined, so we need to re-implement it here
|
||||
* so we can override the libusb_control_transfer call */
|
||||
static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
|
||||
@@ -93,7 +92,23 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
|
||||
data, (uint16_t)length, 1000); /* Endpoint 0 IN */
|
||||
}
|
||||
#define libusb_get_string_descriptor SDL_libusb_get_string_descriptor
|
||||
#endif /* SDL_PLATFORM_FREEBSD */
|
||||
|
||||
/* this is inlined, except on FreeBSD, so we need to re-implement it here */
|
||||
static void SDL_libusb_fill_interrupt_transfer(
|
||||
struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
|
||||
unsigned char endpoint, unsigned char *buffer, int length,
|
||||
libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
|
||||
{
|
||||
transfer->dev_handle = dev_handle;
|
||||
transfer->endpoint = endpoint;
|
||||
transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT;
|
||||
transfer->timeout = timeout;
|
||||
transfer->buffer = buffer;
|
||||
transfer->length = length;
|
||||
transfer->user_data = user_data;
|
||||
transfer->callback = callback;
|
||||
}
|
||||
#define libusb_fill_interrupt_transfer SDL_libusb_fill_interrupt_transfer
|
||||
|
||||
#define HIDAPI_THREAD_MODEL_INCLUDE "hidapi_thread_sdl.h"
|
||||
#ifndef LIBUSB_API_VERSION
|
||||
|
||||
@@ -288,7 +288,7 @@ static int get_usage(uint8_t *report_descriptor, size_t size,
|
||||
return -1; /* failure */
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ < 10
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ < 10 && !defined(libusb_get_string_descriptor)
|
||||
/* The libusb version included in FreeBSD < 10 doesn't have this function. In
|
||||
mainline libusb, it's inlined in libusb.h. This function will bear a striking
|
||||
resemblance to that one, because there's about one way to code it.
|
||||
|
||||
Reference in New Issue
Block a user