Commit Graph

181 Commits

Author SHA1 Message Date
Sam Lantinga
f6b1e028ab Allow vendor matching for hid_enumerate() on all backends 2022-10-29 10:43:11 -07:00
Ozkan Sezer
65a38a4015 hidapi, libusb: remove os/2 symbol load hack after os/2 loadso updates 2022-10-22 08:40:16 -07:00
Ozkan Sezer
8bcbdc706c hidapi, libusb: backport read_thread indefinite loop fix from mainstream
Mainstream commit:
5ce9051e2f
2022-09-28 08:26:08 -07:00
Sam Lantinga
aa2e2f4843 Make sure HID devices can be opened before making them available to the application
This prevents a number of issues where devices are enumerated but not actually able to be opened, like https://github.com/libsdl-org/SDL/issues/5781.

We currently leave the devices open, allowing us to more easily do controller feature detection, protocol negotiation, detect dropped Bluetooth connections, etc. with the expectation that the application is likely to open the controllers shortly.
2022-09-22 18:27:38 -07:00
Sam Lantinga
99e85cc27b Accidentally reverted 172865ff13 2022-09-22 10:10:20 -07:00
Sam Lantinga
6cbdc66650 Fixed use of uninitialized 'size' variable (thanks @ozkan!) 2022-09-22 09:05:06 -07:00
Sam Lantinga
2e9f5b5989 Added support for the HORI Fighting Commander OCTA (Xbox Series X and PS versions) 2022-09-16 15:41:35 -07:00
Sam Lantinga
910d499c54 Fixed comment typo 2022-09-16 09:19:20 -07:00
Sam Lantinga
172865ff13 Don't enumerate HID devices on macOS if we don't have input monitoring permissions
Unfortunately the only way to detect this is to actually try opening a device, so we wait until the application tries, and then stop enumerating afterwards.

Fixes https://github.com/libsdl-org/SDL/issues/5781
2022-09-16 09:16:18 -07:00
Ozkan Sezer
2847696338 hidapi: really fix dynamic / non-dynamic libusb loading. 2022-09-01 22:55:00 +03:00
Ozkan Sezer
9d77945d36 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
2022-09-01 21:56:50 +03:00
Sam Lantinga
3f89d1704d Fixed building with libusb not dynamicaly loaded 2022-09-01 11:30:02 -07:00
Sam Lantinga
b2ac758f61 Added support for the Hori Fighting Stick Alpha to the HIDAPI driver 2022-08-29 17:33:00 -07:00
Ludovico de Nittis
e8cb4da71f 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>
2022-08-29 06:30:40 -07:00
Sam Lantinga
679582e702 Fixed crash if there are no devices available 2022-08-25 11:07:20 -07:00
Sam Lantinga
70c781c803 Fixed build warning because of redefining string functions 2022-08-24 10:25:56 -07:00
Sam Lantinga
3ed8e219a5 Fixed building HIDAPI libusb support on Windows 2022-08-24 01:25:14 -07:00
Sam Lantinga
b6f96b69aa Initial HIDAPI driver support for the PS3 controller 2022-08-23 22:45:37 -07:00
Sam Lantinga
b880709e9c Added libusb hack for Gamesir-G3w which needs the same adjustment as the Hori controllers 2022-08-12 18:21:00 -07:00
Sam Lantinga
a547c185ce Fixed crash if uevent info isn't available 2022-08-08 12:21:40 -07:00
Sam Lantinga
d6a8b43cf7 Added support for the HORIPAD FPS for Nintendo Switch 2022-08-05 10:37:38 -07:00
Sam Lantinga
be3a945a8b Added support for the 8BitDo Ultimate Wired Controller for Xbox 2022-07-20 11:05:55 -07:00
Pierre Wendling
6c536afdb7 Fix C89 declaration for macOS modules.
Since Clang 14, `-Wdeclaration-after-statement` is enforced on every
standard.
2022-06-27 15:19:40 -07:00
chalonverse
3b191580c3
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
2022-06-27 10:19:39 -07:00
Sam Lantinga
72fea0ed6f Added support for the Qanba Dragon Arcade Joystick 2022-06-15 13:58:28 -07:00
Sam Lantinga
ce5763230b The backlight event is "change", not "add" or "remove" 2022-06-10 12:42:45 -07:00
Ethan Lee
964e979d06 hidapi: Allow disabling libusb support at runtime 2022-05-30 13:45:24 -07:00
Sam Lantinga
bef9f2b2c4 Don't trigger device notifications when Steam Deck backlight changes 2022-05-26 20:45:48 -07:00
Sam Lantinga
22d6e09a8d Don't try to call hid_ble_scan() if HIDAPI is disabled
Fixes https://github.com/libsdl-org/SDL/issues/5699
2022-05-25 11:05:39 -07:00
Ozkan Sezer
9220f92bae hidapi/libusb/hid.c (read_thread): mark as SDLCALL 2022-05-25 01:01:02 +03:00
Cameron Cawley
ffab9f46b5 Avoid clashing with system headers when redefining standard library functions 2022-05-18 16:44:17 -04:00
Ozkan Sezer
7a5743031d hidapi, libusb: import mainstream commit 536bad201e 2022-04-23 20:01:40 +03:00
Eddy Jansson
a40405d724 hidapi: Wrap CopyHIDDeviceInfo in define checks.
The purpose of this is to silence a 'defined but not used'
warning.
2022-04-20 09:33:40 -07:00
Sam Lantinga
7b3449b89f Minor cleanup 2022-04-04 20:46:56 -07:00
Ryan C. Gordon
4fe7b2cbd1
static analysis: Fixed several complaints from codechecker.
There are still some pending Objective-C specific issues.

Reference issue #4600.
2022-03-24 11:00:43 -04:00
Jonatha Gabriel
b944dc8f2e Also fix Android crash when SDL_HIDAPI_DISABLED set to 1
The Java code needs the native functions to be implemented, even if
they're not surfaced via the C API, therefore, a stub version of
functions were made only to the purpose of "fill the gaps" when
SDL_HIDAPI_DISABLED set to 1.
2022-03-22 12:12:16 -07:00
Sam Lantinga
b559a4accc Fixed Android crash when SDL_HIDAPI_DISABLED set to 1
The Java code needs the native functions to be implemented, even if they're not surfaced via the C API.

Fixes https://github.com/libsdl-org/SDL/issues/5326
2022-03-19 10:39:22 -07:00
Sam Lantinga
09b652b70a Make sure the string properties are actually strings (thanks Nat!) 2022-03-09 13:54:23 -08:00
Sam Lantinga
14db417e12 Reenable getting the serial number on macOS
We filter now on game controllers, so we shouldn't hit the crash bug on random devices that this was working around.
2022-03-08 21:32:27 -08:00
Sam Lantinga
c3ca3445bd Prefer HIDAPI on macOS, as that has extended functionality 2022-03-08 18:56:49 -08:00
pionere
ebdd536676 use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError 2022-01-28 20:40:19 -05:00
Ozkan Sezer
e9511f7136 hidapi, libusb: don't use iconv on OS/2, it lacks wchar_t functionality.
Taken from a patch by Silvan Scherrer at bitwiseworks' OS/2 fork.
2022-01-14 14:39:04 +03:00
Ozkan Sezer
7527c8d3d7 hidapi, libusb: provide a wcsdup implementation if it is not available.
similar to mac and android versions..
2022-01-11 11:33:02 +03:00
Ozkan Sezer
f14c7bb443 added missing hidapi stuff for os/2 with libusb 2022-01-09 20:33:32 +03:00
Sam Lantinga
120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga
67c4b99639 Fixed enabling udev hotplug detection on Linux 2021-12-15 10:39:42 -08:00
Ozkan Sezer
09465a9083 hidapi, windows: replace a strncpy() with plain memcpy()
mainstream has a similar change, already.
2021-11-30 21:10:10 +03:00
Ozkan Sezer
8f17af5e21 hidapi: mark libusb function pointers with LIBUSB_CALL. 2021-11-27 11:02:04 -08:00
Sam Lantinga
30f04d63e6 HIDAPI is only reliable on Android 4.3 and newer
Fixes https://github.com/libsdl-org/SDL/issues/4955
2021-11-26 07:15:46 -08:00
Sylvain
d5813776db Release UDEV ressources 2021-11-25 07:24:18 -05:00