Atlas - SDL_libusb.h

Home / ext / SDL / src / misc Lines: 1 | Size: 4559 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22#include "SDL_internal.h" 23 24#ifdef HAVE_LIBUSB 25// libusb HIDAPI Implementation 26 27// Include this now, for our dynamically-loaded libusb context 28#include <libusb.h> 29 30typedef struct SDL_LibUSBContext 31{ 32/* *INDENT-OFF* */ // clang-format off 33 int (LIBUSB_CALL *init)(libusb_context **ctx); 34 void (LIBUSB_CALL *exit)(libusb_context *ctx); 35 ssize_t (LIBUSB_CALL *get_device_list)(libusb_context *ctx, libusb_device ***list); 36 void (LIBUSB_CALL *free_device_list)(libusb_device **list, int unref_devices); 37 int (LIBUSB_CALL *get_device_descriptor)(libusb_device *dev, struct libusb_device_descriptor *desc); 38 int (LIBUSB_CALL *get_active_config_descriptor)(libusb_device *dev, struct libusb_config_descriptor **config); 39 int (LIBUSB_CALL *get_config_descriptor)( 40 libusb_device *dev, 41 uint8_t config_index, 42 struct libusb_config_descriptor **config 43 ); 44 void (LIBUSB_CALL *free_config_descriptor)(struct libusb_config_descriptor *config); 45 uint8_t (LIBUSB_CALL *get_bus_number)(libusb_device *dev); 46#ifdef SDL_PLATFORM_FREEBSD 47 int (LIBUSB_CALL *get_port_numbers)(libusb_device *dev, uint8_t *port_numbers, uint8_t port_numbers_len); 48#else 49 int (LIBUSB_CALL *get_port_numbers)(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len); 50#endif 51 uint8_t (LIBUSB_CALL *get_device_address)(libusb_device *dev); 52 int (LIBUSB_CALL *open)(libusb_device *dev, libusb_device_handle **dev_handle); 53 void (LIBUSB_CALL *close)(libusb_device_handle *dev_handle); 54 libusb_device *(LIBUSB_CALL *get_device)(libusb_device_handle *dev_handle); 55 int (LIBUSB_CALL *claim_interface)(libusb_device_handle *dev_handle, int interface_number); 56 int (LIBUSB_CALL *release_interface)(libusb_device_handle *dev_handle, int interface_number); 57 int (LIBUSB_CALL *kernel_driver_active)(libusb_device_handle *dev_handle, int interface_number); 58 int (LIBUSB_CALL *detach_kernel_driver)(libusb_device_handle *dev_handle, int interface_number); 59 int (LIBUSB_CALL *attach_kernel_driver)(libusb_device_handle *dev_handle, int interface_number); 60 int (LIBUSB_CALL *set_interface_alt_setting)(libusb_device_handle *dev, int interface_number, int alternate_setting); 61 struct libusb_transfer * (LIBUSB_CALL *alloc_transfer)(int iso_packets); 62 int (LIBUSB_CALL *submit_transfer)(struct libusb_transfer *transfer); 63 int (LIBUSB_CALL *cancel_transfer)(struct libusb_transfer *transfer); 64 void (LIBUSB_CALL *free_transfer)(struct libusb_transfer *transfer); 65 int (LIBUSB_CALL *control_transfer)( 66 libusb_device_handle *dev_handle, 67 uint8_t request_type, 68 uint8_t bRequest, 69 uint16_t wValue, 70 uint16_t wIndex, 71 unsigned char *data, 72 uint16_t wLength, 73 unsigned int timeout 74 ); 75 int (LIBUSB_CALL *interrupt_transfer)( 76 libusb_device_handle *dev_handle, 77 unsigned char endpoint, 78 unsigned char *data, 79 int length, 80 int *actual_length, 81 unsigned int timeout 82 ); 83 int (LIBUSB_CALL *bulk_transfer)( 84 libusb_device_handle *dev_handle, 85 unsigned char endpoint, 86 unsigned char *data, 87 int length, 88 int *transferred, 89 unsigned int timeout 90 ); 91 int (LIBUSB_CALL *handle_events)(libusb_context *ctx); 92 int (LIBUSB_CALL *handle_events_completed)(libusb_context *ctx, int *completed); 93 const char * (LIBUSB_CALL *error_name)(int errcode); 94/* *INDENT-ON* */ // clang-format on 95 96} SDL_LibUSBContext; 97 98extern bool SDL_InitLibUSB(SDL_LibUSBContext **ctx); 99extern void SDL_QuitLibUSB(void); 100 101#endif // HAVE_LIBUSB 102
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.