Fixed building SDL_hidapi.c with new hidapi

main
Sam Lantinga 2023-05-24 10:03:22 -07:00
parent 651d9c4a6e
commit 55ed69fc9a
1 changed files with 162 additions and 109 deletions

View File

@ -524,32 +524,41 @@ static void HIDAPI_ShutdownDiscovery(void)
/* Platform HIDAPI Implementation */ /* Platform HIDAPI Implementation */
struct PLATFORM_hid_device_;
typedef struct PLATFORM_hid_device_ PLATFORM_hid_device;
#define api_version PLATFORM_api_version
#define create_device_info_for_device PLATFORM_create_device_info_for_device
#define free_hid_device PLATFORM_free_hid_device
#define hid_close PLATFORM_hid_close
#define hid_device PLATFORM_hid_device #define hid_device PLATFORM_hid_device
#define hid_device_ PLATFORM_hid_device_ #define hid_device_ PLATFORM_hid_device_
#define hid_init PLATFORM_hid_init
#define hid_exit PLATFORM_hid_exit
#define hid_enumerate PLATFORM_hid_enumerate #define hid_enumerate PLATFORM_hid_enumerate
#define hid_error PLATFORM_hid_error
#define hid_exit PLATFORM_hid_exit
#define hid_free_enumeration PLATFORM_hid_free_enumeration #define hid_free_enumeration PLATFORM_hid_free_enumeration
#define hid_open PLATFORM_hid_open #define hid_get_device_info PLATFORM_hid_get_device_info
#define hid_open_path PLATFORM_hid_open_path
#define hid_write PLATFORM_hid_write
#define hid_read_timeout PLATFORM_hid_read_timeout
#define hid_read PLATFORM_hid_read
#define hid_set_nonblocking PLATFORM_hid_set_nonblocking
#define hid_send_feature_report PLATFORM_hid_send_feature_report
#define hid_get_feature_report PLATFORM_hid_get_feature_report #define hid_get_feature_report PLATFORM_hid_get_feature_report
#define hid_close PLATFORM_hid_close #define hid_get_indexed_string PLATFORM_hid_get_indexed_string
#define hid_get_manufacturer_string PLATFORM_hid_get_manufacturer_string #define hid_get_manufacturer_string PLATFORM_hid_get_manufacturer_string
#define hid_get_product_string PLATFORM_hid_get_product_string #define hid_get_product_string PLATFORM_hid_get_product_string
#define hid_get_report_descriptor PLATFORM_hid_get_report_descriptor
#define hid_get_serial_number_string PLATFORM_hid_get_serial_number_string #define hid_get_serial_number_string PLATFORM_hid_get_serial_number_string
#define hid_get_indexed_string PLATFORM_hid_get_indexed_string #define hid_init PLATFORM_hid_init
#define hid_error PLATFORM_hid_error #define hid_open_path PLATFORM_hid_open_path
#define new_hid_device PLATFORM_new_hid_device #define hid_open PLATFORM_hid_open
#define free_hid_device PLATFORM_free_hid_device #define hid_read PLATFORM_hid_read
#define hid_read_timeout PLATFORM_hid_read_timeout
#define hid_send_feature_report PLATFORM_hid_send_feature_report
#define hid_set_nonblocking PLATFORM_hid_set_nonblocking
#define hid_version PLATFORM_hid_version
#define hid_version_str PLATFORM_hid_version_str
#define hid_write PLATFORM_hid_write
#define input_report PLATFORM_input_report #define input_report PLATFORM_input_report
#define return_data PLATFORM_return_data
#define make_path PLATFORM_make_path #define make_path PLATFORM_make_path
#define new_hid_device PLATFORM_new_hid_device
#define read_thread PLATFORM_read_thread #define read_thread PLATFORM_read_thread
#define return_data PLATFORM_return_data
#undef HIDAPI_H__ #undef HIDAPI_H__
#ifdef __LINUX__ #ifdef __LINUX__
@ -557,21 +566,22 @@ static void HIDAPI_ShutdownDiscovery(void)
#ifdef SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static const SDL_UDEV_Symbols *udev_ctx = NULL; static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define udev_device_get_devnode udev_ctx->udev_device_get_devnode
#define udev_device_get_parent_with_subsystem_devtype udev_ctx->udev_device_get_parent_with_subsystem_devtype
#define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value #define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value
#define udev_device_get_syspath udev_ctx->udev_device_get_syspath
#define udev_device_new_from_devnum udev_ctx->udev_device_new_from_devnum
#define udev_device_new_from_syspath udev_ctx->udev_device_new_from_syspath
#define udev_device_unref udev_ctx->udev_device_unref
#define udev_enumerate_add_match_subsystem udev_ctx->udev_enumerate_add_match_subsystem
#define udev_enumerate_get_list_entry udev_ctx->udev_enumerate_get_list_entry
#define udev_enumerate_new udev_ctx->udev_enumerate_new
#define udev_enumerate_scan_devices udev_ctx->udev_enumerate_scan_devices
#define udev_enumerate_unref udev_ctx->udev_enumerate_unref
#define udev_list_entry_get_name udev_ctx->udev_list_entry_get_name
#define udev_list_entry_get_next udev_ctx->udev_list_entry_get_next
#define udev_new udev_ctx->udev_new #define udev_new udev_ctx->udev_new
#define udev_unref udev_ctx->udev_unref #define udev_unref udev_ctx->udev_unref
#define udev_device_new_from_devnum udev_ctx->udev_device_new_from_devnum
#define udev_device_get_parent_with_subsystem_devtype udev_ctx->udev_device_get_parent_with_subsystem_devtype
#define udev_device_unref udev_ctx->udev_device_unref
#define udev_enumerate_new udev_ctx->udev_enumerate_new
#define udev_enumerate_add_match_subsystem udev_ctx->udev_enumerate_add_match_subsystem
#define udev_enumerate_scan_devices udev_ctx->udev_enumerate_scan_devices
#define udev_enumerate_get_list_entry udev_ctx->udev_enumerate_get_list_entry
#define udev_list_entry_get_name udev_ctx->udev_list_entry_get_name
#define udev_device_new_from_syspath udev_ctx->udev_device_new_from_syspath
#define udev_device_get_devnode udev_ctx->udev_device_get_devnode
#define udev_list_entry_get_next udev_ctx->udev_list_entry_get_next
#define udev_enumerate_unref udev_ctx->udev_enumerate_unref
#include "linux/hid.c" #include "linux/hid.c"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND 1
@ -582,6 +592,19 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1 #define udev_ctx 1
#elif defined(__WINDOWS__) || defined(__WINGDK__) #elif defined(__WINDOWS__) || defined(__WINGDK__)
/* Define standard library functions in terms of SDL */
#define calloc SDL_calloc
#define free SDL_free
#define malloc SDL_malloc
#define memcmp SDL_memcmp
#define swprintf SDL_swprintf
#define towupper SDL_toupper
#define wcscmp SDL_wcscmp
#define _wcsdup SDL_wcsdup
#define wcslen SDL_wcslen
#define wcsncpy SDL_wcslcpy
#define wcsstr SDL_wcsstr
#define wcstol SDL_wcstol
#include "windows/hid.c" #include "windows/hid.c"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1 #define udev_ctx 1
@ -597,32 +620,38 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define udev_ctx 1 #define udev_ctx 1
#endif #endif
#undef api_version
#undef create_device_info_for_device
#undef free_hid_device
#undef hid_close
#undef hid_device #undef hid_device
#undef hid_device_ #undef hid_device_
#undef hid_init
#undef hid_exit
#undef hid_enumerate #undef hid_enumerate
#undef hid_error
#undef hid_exit
#undef hid_free_enumeration #undef hid_free_enumeration
#undef hid_open #undef hid_get_device_info
#undef hid_open_path
#undef hid_write
#undef hid_read_timeout
#undef hid_read
#undef hid_set_nonblocking
#undef hid_send_feature_report
#undef hid_get_feature_report #undef hid_get_feature_report
#undef hid_close #undef hid_get_indexed_string
#undef hid_get_manufacturer_string #undef hid_get_manufacturer_string
#undef hid_get_product_string #undef hid_get_product_string
#undef hid_get_report_descriptor
#undef hid_get_serial_number_string #undef hid_get_serial_number_string
#undef hid_get_indexed_string #undef hid_init
#undef hid_error #undef hid_open
#undef new_hid_device #undef hid_open_path
#undef free_hid_device #undef hid_read
#undef hid_read_timeout
#undef hid_send_feature_report
#undef hid_set_nonblocking
#undef hid_version
#undef hid_version_str
#undef hid_write
#undef input_report #undef input_report
#undef return_data
#undef make_path #undef make_path
#undef new_hid_device
#undef read_thread #undef read_thread
#undef return_data
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX #ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
#define HAVE_DRIVER_BACKEND 1 #define HAVE_DRIVER_BACKEND 1
@ -632,26 +661,30 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
/* DRIVER HIDAPI Implementation */ /* DRIVER HIDAPI Implementation */
struct DRIVER_hid_device_;
typedef struct DRIVER_hid_device_ DRIVER_hid_device;
#define hid_close DRIVER_hid_close
#define hid_device DRIVER_hid_device #define hid_device DRIVER_hid_device
#define hid_device_ DRIVER_hid_device_ #define hid_device_ DRIVER_hid_device_
#define hid_init DRIVER_hid_init
#define hid_exit DRIVER_hid_exit
#define hid_enumerate DRIVER_hid_enumerate #define hid_enumerate DRIVER_hid_enumerate
#define hid_error DRIVER_hid_error
#define hid_exit DRIVER_hid_exit
#define hid_free_enumeration DRIVER_hid_free_enumeration #define hid_free_enumeration DRIVER_hid_free_enumeration
#define hid_open DRIVER_hid_open
#define hid_open_path DRIVER_hid_open_path
#define hid_write DRIVER_hid_write
#define hid_read_timeout DRIVER_hid_read_timeout
#define hid_read DRIVER_hid_read
#define hid_set_nonblocking DRIVER_hid_set_nonblocking
#define hid_send_feature_report DRIVER_hid_send_feature_report
#define hid_get_feature_report DRIVER_hid_get_feature_report #define hid_get_feature_report DRIVER_hid_get_feature_report
#define hid_close DRIVER_hid_close #define hid_get_indexed_string DRIVER_hid_get_indexed_string
#define hid_get_manufacturer_string DRIVER_hid_get_manufacturer_string #define hid_get_manufacturer_string DRIVER_hid_get_manufacturer_string
#define hid_get_product_string DRIVER_hid_get_product_string #define hid_get_product_string DRIVER_hid_get_product_string
#define hid_get_report_descriptor DRIVER_hid_get_report_descriptor
#define hid_get_serial_number_string DRIVER_hid_get_serial_number_string #define hid_get_serial_number_string DRIVER_hid_get_serial_number_string
#define hid_get_indexed_string DRIVER_hid_get_indexed_string #define hid_init DRIVER_hid_init
#define hid_error DRIVER_hid_error #define hid_open DRIVER_hid_open
#define hid_open_path DRIVER_hid_open_path
#define hid_read DRIVER_hid_read
#define hid_read_timeout DRIVER_hid_read_timeout
#define hid_send_feature_report DRIVER_hid_send_feature_report
#define hid_set_nonblocking DRIVER_hid_set_nonblocking
#define hid_write DRIVER_hid_write
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX #ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
#undef HIDAPI_H__ #undef HIDAPI_H__
@ -660,26 +693,27 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#error Need a driver hid.c for this platform! #error Need a driver hid.c for this platform!
#endif #endif
#undef hid_close
#undef hid_device #undef hid_device
#undef hid_device_ #undef hid_device_
#undef hid_init
#undef hid_exit
#undef hid_enumerate #undef hid_enumerate
#undef hid_error
#undef hid_exit
#undef hid_free_enumeration #undef hid_free_enumeration
#undef hid_open
#undef hid_open_path
#undef hid_write
#undef hid_read_timeout
#undef hid_read
#undef hid_set_nonblocking
#undef hid_send_feature_report
#undef hid_get_feature_report #undef hid_get_feature_report
#undef hid_close #undef hid_get_indexed_string
#undef hid_get_manufacturer_string #undef hid_get_manufacturer_string
#undef hid_get_product_string #undef hid_get_product_string
#undef hid_get_report_descriptor
#undef hid_get_serial_number_string #undef hid_get_serial_number_string
#undef hid_get_indexed_string #undef hid_init
#undef hid_error #undef hid_open
#undef hid_open_path
#undef hid_read
#undef hid_read_timeout
#undef hid_send_feature_report
#undef hid_set_nonblocking
#undef hid_write
#endif /* HAVE_DRIVER_BACKEND */ #endif /* HAVE_DRIVER_BACKEND */
@ -707,9 +741,12 @@ static struct
); );
void (LIBUSB_CALL *free_config_descriptor)(struct libusb_config_descriptor *config); void (LIBUSB_CALL *free_config_descriptor)(struct libusb_config_descriptor *config);
uint8_t (LIBUSB_CALL *get_bus_number)(libusb_device *dev); uint8_t (LIBUSB_CALL *get_bus_number)(libusb_device *dev);
int (LIBUSB_CALL *get_port_numbers)(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
uint8_t (LIBUSB_CALL *get_device_address)(libusb_device *dev); uint8_t (LIBUSB_CALL *get_device_address)(libusb_device *dev);
int (LIBUSB_CALL *wrap_sys_device)(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle);
int (LIBUSB_CALL *open)(libusb_device *dev, libusb_device_handle **dev_handle); int (LIBUSB_CALL *open)(libusb_device *dev, libusb_device_handle **dev_handle);
void (LIBUSB_CALL *close)(libusb_device_handle *dev_handle); void (LIBUSB_CALL *close)(libusb_device_handle *dev_handle);
libusb_device *(LIBUSB_CALL *get_device)(libusb_device_handle *dev_handle);
int (LIBUSB_CALL *claim_interface)(libusb_device_handle *dev_handle, int interface_number); int (LIBUSB_CALL *claim_interface)(libusb_device_handle *dev_handle, int interface_number);
int (LIBUSB_CALL *release_interface)(libusb_device_handle *dev_handle, int interface_number); int (LIBUSB_CALL *release_interface)(libusb_device_handle *dev_handle, int interface_number);
int (LIBUSB_CALL *kernel_driver_active)(libusb_device_handle *dev_handle, int interface_number); int (LIBUSB_CALL *kernel_driver_active)(libusb_device_handle *dev_handle, int interface_number);
@ -754,9 +791,12 @@ static struct
#define libusb_get_config_descriptor libusb_ctx.get_config_descriptor #define libusb_get_config_descriptor libusb_ctx.get_config_descriptor
#define libusb_free_config_descriptor libusb_ctx.free_config_descriptor #define libusb_free_config_descriptor libusb_ctx.free_config_descriptor
#define libusb_get_bus_number libusb_ctx.get_bus_number #define libusb_get_bus_number libusb_ctx.get_bus_number
#define libusb_get_port_numbers libusb_ctx.get_port_numbers
#define libusb_get_device_address libusb_ctx.get_device_address #define libusb_get_device_address libusb_ctx.get_device_address
#define libusb_wrap_sys_device libusb_ctx.wrap_sys_device
#define libusb_open libusb_ctx.open #define libusb_open libusb_ctx.open
#define libusb_close libusb_ctx.close #define libusb_close libusb_ctx.close
#define libusb_get_device libusb_ctx.get_device
#define libusb_claim_interface libusb_ctx.claim_interface #define libusb_claim_interface libusb_ctx.claim_interface
#define libusb_release_interface libusb_ctx.release_interface #define libusb_release_interface libusb_ctx.release_interface
#define libusb_kernel_driver_active libusb_ctx.kernel_driver_active #define libusb_kernel_driver_active libusb_ctx.kernel_driver_active
@ -773,32 +813,37 @@ static struct
#define libusb_handle_events_completed libusb_ctx.handle_events_completed #define libusb_handle_events_completed libusb_ctx.handle_events_completed
#define libusb_error_name libusb_ctx.error_name #define libusb_error_name libusb_ctx.error_name
struct LIBUSB_hid_device_;
typedef struct LIBUSB_hid_device_ LIBUSB_hid_device;
#define free_hid_device LIBUSB_free_hid_device
#define hid_close LIBUSB_hid_close
#define hid_device LIBUSB_hid_device #define hid_device LIBUSB_hid_device
#define hid_device_ LIBUSB_hid_device_ #define hid_device_ LIBUSB_hid_device_
#define hid_init LIBUSB_hid_init
#define hid_exit LIBUSB_hid_exit
#define hid_enumerate LIBUSB_hid_enumerate #define hid_enumerate LIBUSB_hid_enumerate
#define hid_error LIBUSB_hid_error
#define hid_exit LIBUSB_hid_exit
#define hid_free_enumeration LIBUSB_hid_free_enumeration #define hid_free_enumeration LIBUSB_hid_free_enumeration
#define hid_open LIBUSB_hid_open
#define hid_open_path LIBUSB_hid_open_path
#define hid_write LIBUSB_hid_write
#define hid_read_timeout LIBUSB_hid_read_timeout
#define hid_read LIBUSB_hid_read
#define hid_set_nonblocking LIBUSB_hid_set_nonblocking
#define hid_send_feature_report LIBUSB_hid_send_feature_report
#define hid_get_feature_report LIBUSB_hid_get_feature_report #define hid_get_feature_report LIBUSB_hid_get_feature_report
#define hid_close LIBUSB_hid_close #define hid_get_input_report LIBUSB_hid_get_input_report
#define hid_get_indexed_string LIBUSB_hid_get_indexed_string
#define hid_get_manufacturer_string LIBUSB_hid_get_manufacturer_string #define hid_get_manufacturer_string LIBUSB_hid_get_manufacturer_string
#define hid_get_product_string LIBUSB_hid_get_product_string #define hid_get_product_string LIBUSB_hid_get_product_string
#define hid_get_report_descriptor LIBUSB_hid_get_report_descriptor
#define hid_get_serial_number_string LIBUSB_hid_get_serial_number_string #define hid_get_serial_number_string LIBUSB_hid_get_serial_number_string
#define hid_get_indexed_string LIBUSB_hid_get_indexed_string #define hid_init LIBUSB_hid_init
#define hid_error LIBUSB_hid_error #define hid_open LIBUSB_hid_open
#define new_hid_device LIBUSB_new_hid_device #define hid_open_path LIBUSB_hid_open_path
#define free_hid_device LIBUSB_free_hid_device #define hid_read LIBUSB_hid_read
#define hid_read_timeout LIBUSB_hid_read_timeout
#define hid_send_feature_report LIBUSB_hid_send_feature_report
#define hid_set_nonblocking LIBUSB_hid_set_nonblocking
#define hid_write LIBUSB_hid_write
#define input_report LIBUSB_input_report #define input_report LIBUSB_input_report
#define return_data LIBUSB_return_data
#define make_path LIBUSB_make_path #define make_path LIBUSB_make_path
#define new_hid_device LIBUSB_new_hid_device
#define read_thread LIBUSB_read_thread #define read_thread LIBUSB_read_thread
#define return_data LIBUSB_return_data
#ifndef __FreeBSD__ #ifndef __FreeBSD__
/* this is awkwardly inlined, so we need to re-implement it here /* this is awkwardly inlined, so we need to re-implement it here
@ -825,9 +870,12 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
#undef libusb_get_config_descriptor #undef libusb_get_config_descriptor
#undef libusb_free_config_descriptor #undef libusb_free_config_descriptor
#undef libusb_get_bus_number #undef libusb_get_bus_number
#undef libusb_get_port_numbers
#undef libusb_get_device_address #undef libusb_get_device_address
#undef libusb_wrap_sys_device
#undef libusb_open #undef libusb_open
#undef libusb_close #undef libusb_close
#undef libusb_get_device
#undef libusb_claim_interface #undef libusb_claim_interface
#undef libusb_release_interface #undef libusb_release_interface
#undef libusb_kernel_driver_active #undef libusb_kernel_driver_active
@ -844,32 +892,34 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
#undef libusb_handle_events_completed #undef libusb_handle_events_completed
#undef libusb_error_name #undef libusb_error_name
#undef free_hid_device
#undef hid_close
#undef hid_device #undef hid_device
#undef hid_device_ #undef hid_device_
#undef hid_init
#undef hid_exit
#undef hid_enumerate #undef hid_enumerate
#undef hid_error
#undef hid_exit
#undef hid_free_enumeration #undef hid_free_enumeration
#undef hid_open
#undef hid_open_path
#undef hid_write
#undef hid_read_timeout
#undef hid_read
#undef hid_set_nonblocking
#undef hid_send_feature_report
#undef hid_get_feature_report #undef hid_get_feature_report
#undef hid_close #undef hid_get_input_report
#undef hid_get_indexed_string
#undef hid_get_manufacturer_string #undef hid_get_manufacturer_string
#undef hid_get_product_string #undef hid_get_product_string
#undef hid_get_report_descriptor
#undef hid_get_serial_number_string #undef hid_get_serial_number_string
#undef hid_get_indexed_string #undef hid_init
#undef hid_error #undef hid_open
#undef new_hid_device #undef hid_open_path
#undef free_hid_device #undef hid_read
#undef hid_read_timeout
#undef hid_send_feature_report
#undef hid_set_nonblocking
#undef hid_write
#undef input_report #undef input_report
#undef return_data
#undef make_path #undef make_path
#undef new_hid_device
#undef read_thread #undef read_thread
#undef return_data
#endif /* HAVE_LIBUSB */ #endif /* HAVE_LIBUSB */
@ -995,7 +1045,7 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device)
} }
static void static void
CopyHIDDeviceInfo(struct SDL_hid_device_info *pSrc, struct SDL_hid_device_info *pDst) CopyHIDDeviceInfo(struct hid_device_info *pSrc, struct SDL_hid_device_info *pDst)
{ {
COPY_IF_EXISTS(path) COPY_IF_EXISTS(path)
pDst->vendor_id = pSrc->vendor_id; pDst->vendor_id = pSrc->vendor_id;
@ -1007,9 +1057,9 @@ CopyHIDDeviceInfo(struct SDL_hid_device_info *pSrc, struct SDL_hid_device_info *
pDst->usage_page = pSrc->usage_page; pDst->usage_page = pSrc->usage_page;
pDst->usage = pSrc->usage; pDst->usage = pSrc->usage;
pDst->interface_number = pSrc->interface_number; pDst->interface_number = pSrc->interface_number;
pDst->interface_class = pSrc->interface_class; //pDst->interface_class = pSrc->interface_class;
pDst->interface_subclass = pSrc->interface_subclass; //pDst->interface_subclass = pSrc->interface_subclass;
pDst->interface_protocol = pSrc->interface_protocol; //pDst->interface_protocol = pSrc->interface_protocol;
pDst->next = NULL; pDst->next = NULL;
} }
@ -1089,9 +1139,12 @@ int SDL_hid_init(void)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device *, uint8_t, struct libusb_config_descriptor **), get_config_descriptor) LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device *, uint8_t, struct libusb_config_descriptor **), get_config_descriptor)
LOAD_LIBUSB_SYMBOL(void (LIBUSB_CALL *)(struct libusb_config_descriptor *), free_config_descriptor) LOAD_LIBUSB_SYMBOL(void (LIBUSB_CALL *)(struct libusb_config_descriptor *), free_config_descriptor)
LOAD_LIBUSB_SYMBOL(uint8_t (LIBUSB_CALL *)(libusb_device *), get_bus_number) LOAD_LIBUSB_SYMBOL(uint8_t (LIBUSB_CALL *)(libusb_device *), get_bus_number)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len), get_port_numbers)
LOAD_LIBUSB_SYMBOL(uint8_t (LIBUSB_CALL *)(libusb_device *), get_device_address) LOAD_LIBUSB_SYMBOL(uint8_t (LIBUSB_CALL *)(libusb_device *), get_device_address)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle), wrap_sys_device)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device *, libusb_device_handle **), open) LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device *, libusb_device_handle **), open)
LOAD_LIBUSB_SYMBOL(void (LIBUSB_CALL *)(libusb_device_handle *), close) LOAD_LIBUSB_SYMBOL(void (LIBUSB_CALL *)(libusb_device_handle *), close)
LOAD_LIBUSB_SYMBOL(libusb_device * (LIBUSB_CALL *)(libusb_device_handle *dev_handle), get_device)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), claim_interface) LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), claim_interface)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), release_interface) LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), release_interface)
LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), kernel_driver_active) LOAD_LIBUSB_SYMBOL(int (LIBUSB_CALL *)(libusb_device_handle *, int), kernel_driver_active)
@ -1210,16 +1263,16 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
{ {
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
#ifdef HAVE_LIBUSB #ifdef HAVE_LIBUSB
struct SDL_hid_device_info *usb_devs = NULL; struct hid_device_info *usb_devs = NULL;
struct SDL_hid_device_info *usb_dev; struct hid_device_info *usb_dev;
#endif #endif
#ifdef HAVE_DRIVER_BACKEND #ifdef HAVE_DRIVER_BACKEND
struct SDL_hid_device_info *driver_devs = NULL; struct hid_device_info *driver_devs = NULL;
struct SDL_hid_device_info *driver_dev; struct hid_device_info *driver_dev;
#endif #endif
#ifdef HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
struct SDL_hid_device_info *raw_devs = NULL; struct hid_device_info *raw_devs = NULL;
struct SDL_hid_device_info *raw_dev; struct hid_device_info *raw_dev;
#endif #endif
struct SDL_hid_device_info *devs = NULL, *last = NULL, *new_dev; struct SDL_hid_device_info *devs = NULL, *last = NULL, *new_dev;
@ -1409,7 +1462,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
#ifdef HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) { if (udev_ctx) {
pDevice = PLATFORM_hid_open_path(path, bExclusive); pDevice = PLATFORM_hid_open_path(path);
if (pDevice != NULL) { if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &PLATFORM_Backend); return CreateHIDDeviceWrapper(pDevice, &PLATFORM_Backend);
} }
@ -1417,7 +1470,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
#endif /* HAVE_PLATFORM_BACKEND */ #endif /* HAVE_PLATFORM_BACKEND */
#ifdef HAVE_DRIVER_BACKEND #ifdef HAVE_DRIVER_BACKEND
pDevice = DRIVER_hid_open_path(path, bExclusive); pDevice = DRIVER_hid_open_path(path);
if (pDevice != NULL) { if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend); return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
} }
@ -1425,7 +1478,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
#ifdef HAVE_LIBUSB #ifdef HAVE_LIBUSB
if (libusb_ctx.libhandle != NULL) { if (libusb_ctx.libhandle != NULL) {
pDevice = LIBUSB_hid_open_path(path, bExclusive); pDevice = LIBUSB_hid_open_path(path);
if (pDevice != NULL) { if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &LIBUSB_Backend); return CreateHIDDeviceWrapper(pDevice, &LIBUSB_Backend);
} }