src/hidapi/SDL_hidapi.c


Log

Author Commit Date CI Message
Sam Lantinga 3f1fd5ab 2023-05-23T10:59:03 Updated source to match SDL function prototype style
Sam Lantinga 0479df53 2023-01-09T09:48:21 Updated copyright for 2023
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Ryan C. Gordon bb0b8ada 2022-11-16T22:02:21 mac: Fix handling of deprecated symbol. This needs to check what our deployment target is, not what SDK is available, since this is a linker symbol and not an enum value or whatever. Also removed a copy/paste error that mentioned CoreAudio in the haptic subsystem. Fixes #6534.
Sam Lantinga 9f8b68a2 2022-11-11T10:24:17 Fixed building without linux/input.h https://github.com/libsdl-org/SDL/issues/6169
Ozkan Sezer 65a38a40 2022-10-22T14:28:10 hidapi, libusb: remove os/2 symbol load hack after os/2 loadso updates
Ozkan Sezer 8bcbdc70 2022-09-28T17:40:10 hidapi, libusb: backport read_thread indefinite loop fix from mainstream Mainstream commit: https://github.com/libusb/hidapi/commit/5ce9051e2f2e65013485bc4c83897610df82f3c9
Ozkan Sezer 28476963 2022-09-01T22:55:00 hidapi: really fix dynamic / non-dynamic libusb loading.
Ozkan Sezer 9d77945d 2022-09-01T21:56:50 fixed linkage libusb not dynamicaly loaded after commit 3f89d1704d build/.libs/SDL_hidapi.o: In function `SDL_EnableGameCubeAdaptors': src/hidapi/SDL_hidapi.c:1593: undefined reference to `libusb_init' src/hidapi/SDL_hidapi.c:1594: undefined reference to `libusb_get_device_list' src/hidapi/SDL_hidapi.c:1596: undefined reference to `libusb_get_device_descriptor' src/hidapi/SDL_hidapi.c:1604: undefined reference to `libusb_open' src/hidapi/SDL_hidapi.c:1608: undefined reference to `libusb_kernel_driver_active' src/hidapi/SDL_hidapi.c:1614: undefined reference to `libusb_claim_interface' src/hidapi/SDL_hidapi.c:1623: undefined reference to `libusb_close' src/hidapi/SDL_hidapi.c:1626: undefined reference to `libusb_free_device_list' src/hidapi/SDL_hidapi.c:1628: undefined reference to `libusb_exit' src/hidapi/SDL_hidapi.c:1609: undefined reference to `libusb_detach_kernel_driver' src/hidapi/SDL_hidapi.c:1620: undefined reference to `libusb_attach_kernel_driver' src/hidapi/SDL_hidapi.c:1615: undefined reference to `libusb_control_transfer' src/hidapi/SDL_hidapi.c:1616: undefined reference to `libusb_release_interface' build/.libs/SDL_hidapi.o: In function `SDL_hid_init_REAL': src/hidapi/SDL_hidapi.c:1086: undefined reference to `libusb_init' src/hidapi/SDL_hidapi.c:1087: undefined reference to `libusb_exit' src/hidapi/SDL_hidapi.c:1088: undefined reference to `libusb_get_device_list' src/hidapi/SDL_hidapi.c:1089: undefined reference to `libusb_free_device_list' src/hidapi/SDL_hidapi.c:1090: undefined reference to `libusb_get_device_descriptor' src/hidapi/SDL_hidapi.c:1091: undefined reference to `libusb_get_active_config_descriptor' src/hidapi/SDL_hidapi.c:1092: undefined reference to `libusb_get_config_descriptor' src/hidapi/SDL_hidapi.c:1093: undefined reference to `libusb_free_config_descriptor' src/hidapi/SDL_hidapi.c:1094: undefined reference to `libusb_get_bus_number' src/hidapi/SDL_hidapi.c:1095: undefined reference to `libusb_get_device_address' src/hidapi/SDL_hidapi.c:1096: undefined reference to `libusb_open' src/hidapi/SDL_hidapi.c:1097: undefined reference to `libusb_close' src/hidapi/SDL_hidapi.c:1098: undefined reference to `libusb_claim_interface' src/hidapi/SDL_hidapi.c:1099: undefined reference to `libusb_release_interface' src/hidapi/SDL_hidapi.c:1100: undefined reference to `libusb_kernel_driver_active' src/hidapi/SDL_hidapi.c:1101: undefined reference to `libusb_detach_kernel_driver' src/hidapi/SDL_hidapi.c:1102: undefined reference to `libusb_attach_kernel_driver' src/hidapi/SDL_hidapi.c:1103: undefined reference to `libusb_set_interface_alt_setting' src/hidapi/SDL_hidapi.c:1104: undefined reference to `libusb_alloc_transfer' src/hidapi/SDL_hidapi.c:1105: undefined reference to `libusb_submit_transfer' src/hidapi/SDL_hidapi.c:1106: undefined reference to `libusb_cancel_transfer' src/hidapi/SDL_hidapi.c:1107: undefined reference to `libusb_free_transfer' src/hidapi/SDL_hidapi.c:1108: undefined reference to `libusb_control_transfer' src/hidapi/SDL_hidapi.c:1109: undefined reference to `libusb_interrupt_transfer' src/hidapi/SDL_hidapi.c:1110: undefined reference to `libusb_handle_events' src/hidapi/SDL_hidapi.c:1111: undefined reference to `libusb_handle_events_completed' collect2: ld returned 1 exit status
Sam Lantinga 3f89d170 2022-09-01T11:30:02 Fixed building with libusb not dynamicaly loaded
Ludovico de Nittis e8cb4da7 2022-08-26T12:28:33 Add utility function to detect if SDL is inside a sandbox Refactor the previous sandbox check in a standalone function that also includes Snap support. Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
chalonverse 3b191580 2022-06-27T17:19:39 Windows GDK Support (#5830) * Added GDK * Simplfied checks in SDL_config_wingdk.h * Added testgdk sample * Added GDK readme * Fixed error in merge of SDL_windows.h * Additional GDK fixes * OpenWatcom should not export _SDL_GDKGetTaskQueue * Formatting fixes * Moved initialization code into SDL_GDKRunApp
Sam Lantinga ce576323 2022-06-10T12:42:45 The backlight event is "change", not "add" or "remove"
Ethan Lee 964e979d 2022-05-30T16:17:04 hidapi: Allow disabling libusb support at runtime
Sam Lantinga bef9f2b2 2022-05-26T20:45:13 Don't trigger device notifications when Steam Deck backlight changes
Sam Lantinga 22d6e09a 2022-05-25T11:04:58 Don't try to call hid_ble_scan() if HIDAPI is disabled Fixes https://github.com/libsdl-org/SDL/issues/5699
Eddy Jansson a40405d7 2022-04-20T18:06:02 hidapi: Wrap CopyHIDDeviceInfo in define checks. The purpose of this is to silence a 'defined but not used' warning.
Sam Lantinga 7b3449b8 2022-04-04T20:46:56 Minor cleanup
Ozkan Sezer f14c7bb4 2022-01-09T20:33:32 added missing hidapi stuff for os/2 with libusb
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sam Lantinga 67c4b996 2021-12-15T10:39:42 Fixed enabling udev hotplug detection on Linux
Ozkan Sezer 8f17af5e 2021-11-27T20:56:56 hidapi: mark libusb function pointers with LIBUSB_CALL.
Sylvain d5813776 2021-11-25T09:56:15 Release UDEV ressources
Ozkan Sezer b6796597 2021-11-19T11:55:50 SDL_hidapi.c: fix SDL_udev.h include path fixes https://github.com/libsdl-org/SDL/issues/4981
Mathieu Eyraud 5fc7a90a 2021-11-12T10:00:41 Fix refcounting in SDL_hid_exit
Sam Lantinga 9c3bcf8e 2021-11-11T17:31:14 Added SDL_hid_ble_scan() for pairing Steam Controllers on iOS and tvOS
Sam Lantinga b9b0df40 2021-11-11T12:52:31 Fixed Linux build
Sam Lantinga c9ada1c1 2021-11-11T12:45:38 Made HIDAPI device change notifications available via SDL_hid_device_change_count()
Sam Lantinga 6c4b4ee7 2021-11-10T09:41:43 Don't assert on API parameters This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
Sam Lantinga 0f2bf629 2021-11-09T06:20:46 Fixed building hidapi when libusb is available
Sam Lantinga b8327a4a 2021-11-08T07:19:45 Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems
Sam Lantinga f61b10dc 2021-11-08T06:34:32 Do more robust validation of devices passed to the SDL HIDAPI functions
Ozkan Sezer dd8c3548 2021-11-08T17:00:56 SDL_hidapi.c: avoid possible NULL pointer dereferences.
Sam Lantinga 5b646cd1 2021-11-07T22:58:44 Build hidapi code into SDL as a new public API This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
Sam Lantinga d4794028 2021-01-22T08:45:38 Fixed build
Sam Lantinga 9e45372a 2021-01-21T22:47:37 Fixed build on Android and iOS
Sam Lantinga bf53651d 2021-01-21T22:32:17 Make sure we only do GameCube adapter initialization if we were able to load libusb
Sam Lantinga 3527b494 2021-01-21T22:30:34 Fixed initializing the Nyko and EVORETRO GameCube adaptors This requires root on most Linux distributions, as we have to directly send USB messages to the devices to enable input reports.
Sam Lantinga c8a64ad9 2021-01-07T10:23:55 Fixed building when SDL_LIBUSB_DYNAMIC is defined
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga ff913a22 2020-12-23T16:16:55 Fixed compile warnings on platforms without hidapi support
Sam Lantinga 047b20e3 2020-12-23T16:11:16 Fixed compile warnings on platforms without hidapi support
Sam Lantinga 706f6375 2020-12-13T01:58:05 Fixed build for platforms with only libusb hidapi implementations
Sam Lantinga 43aad966 2020-12-08T19:03:50 Fixed bug 5222 - Crash when running with -DHIDAPI=ON Mathieu Eyraud SDL dynamically loads libusb but does not check the return value of 'SDL_LoadFunction'. Also libusb is loaded and initialized several time because 'SDL_hidapi_wasinit' is never set to true. I made a patch if you want to test: - check that 'hid_init' is called once and only once, - check return value of 'hid_init', - check return value of 'SDL_LoadFunction', - check return value of 'SDL_malloc', - add some debug logging.
Sam Lantinga 59f28b7f 2020-12-03T18:17:01 Fixed whitespace
Sam Lantinga 9fc4a4c9 2020-11-24T22:25:26 Revamped Xbox One HIDAPI init sequence Added support for querying the controller serial number on newer firmware
Sam Lantinga 5b3616c3 2020-11-23T18:24:05 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
Sam Lantinga 69a8c846 2020-03-04T09:42:08 Fixed using more than one Xbox Bluetooth controller Don't prevent duplicate devices using hidraw, instead libusb takes precedence and all hidraw devices that aren't handled by libusb are available
Sam Lantinga bebc4867 2020-03-01T17:53:30 We already have a hidapi implementation for Windows, we don't need libusb
Sam Lantinga 43aa1fa9 2020-01-18T11:21:14 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android
Sam Lantinga 4e682461 2020-01-17T10:43:14 Reattach the kernel driver after closing USB controllers
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 4e1cc124 2020-01-16T15:32:39 Improved Xbox One controller initialization
Sam Lantinga a9482a1d 2019-12-30T09:44:32 Added support for the Nintendo GameCube adapter, tested on Steam Link hardware
Sam Lantinga 868551b1 2019-12-20T21:00:16 Fixed duplicate controller entries on Mac OS X when using libusb, due to the HID interface number not being available in the Mac OS X HID code.
Sam Lantinga c5024a18 2019-12-19T15:21:44 Backed out debug code
Sam Lantinga e22e77da 2019-12-19T15:01:35 Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee
Sam Lantinga 4237b183 2019-12-19T04:31:00 Fixed compiler warning
Sam Lantinga 52b6ab21 2019-12-16T17:11:23 Added support for the SteelSeries Stratus Duo
Ethan Lee f7d82e56 2019-07-31T12:20:55 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends. This is currently supported on Linux and macOS. iOS and Android are not supported at all, Windows support could be added with some changes to the libusb backend. The Visual Studio and Xcode projects do not use this feature. Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.