Commit Graph

323 Commits

Author SHA1 Message Date
Sam Lantinga
a04596c9a7 Added support for the ROG RAIKIRI 2024-07-03 13:54:00 -07:00
Hubert Maier
3acdb8a90b JANITORIAL: Fix typos in comments in various files (#10058) 2024-06-19 07:13:46 -07:00
Sam Lantinga
4236fb2d63 Fixed build warnings with Android debug logging 2024-06-17 15:01:21 -07:00
Ozkan Sezer
ca28bcb3b8 hidapi/windows/hid.c: avoid warnings with gcc < 8. 2024-06-04 06:10:24 +03:00
Sam Lantinga
b0e93e4e63 Prevent crashes if freed objects are passed to SDL API functions
Instead of using the magic tag in the object, we'll actually keep track of valid objects

Fixes https://github.com/libsdl-org/SDL/issues/9869
Fixes https://github.com/libsdl-org/SDL/issues/9235
2024-06-03 08:54:46 -07:00
Ryan C. Gordon
0ec716819e thread: Reworked SDL_CreateThread to be consistent across platforms.
Also documented missing and weird bits, rename typedefs to fit SDL standards.
2024-05-22 11:39:43 -04:00
bootrako
1de8a53015 windows hidapi: fix header compilation 2024-04-18 09:00:49 -07:00
Ryan C. Gordon
ad090d2444 include: A ton of little documentation tweaks, fixes, and improvements.
This is just stuff I noticed while working on the wikiheaders updates. A
thorough pass over all the docs would not be terrible, and maybe a simple
script to check for consistency (does everything have a `\since` on it? etc)
might be nice, too.
2024-04-09 00:50:02 -04:00
Anonymous Maarten
3bc27d3856 hidapi_libusb: use SDL_wcscmp and SDL_wcslcpy from SDL 2024-03-10 09:07:33 -07:00
Ozkan Sezer
98bec6749f hidapi, windows: sync with mainstream: change MAX_STRING_WCHARS to 126.
This merges mainstream commit
4f2e91bae8
(authored by Vladimir Gladkov) into ours. From the original commit log:

Win32 HID API doc says: For USB devices, the maximum string length is
126 wide characters (not including the terminating NULL character).

For certain USB devices, using a buffer larger or equal to 127 wchars
results in successful completion of HID API functions, but a broken
string is stored in the output buffer. This behaviour persists even if
HID API is bypassed and HID IOCTLs are passed to the HID driver directly
(IOCTL_HID_GET_MANUFACTURER_STRING, IOCTL_HID_GET_PRODUCT_STRING, etc).

So, the buffer MUST NOT exceed 126 wchars.

windows: refactor ULONGLONG hid_internal_get_info(...) ->
 hid_internal_detect_bus_type_result hid_internal_detect_bus_type(...)

hid_internal_detect_bus_type is now only responsible for detection of
the bus type; rename it accordingly. Also, mixing an internal flag and
DEV_INST into an ULONGLONG retval feels kinda hackish; use a cleaner
approach instead (add an internal flag to help distinguishing between
BLUETOOTH and BLE devices, then clear it once we are done).
2024-03-05 14:39:20 +03:00
Ozkan Sezer
26e3ca7387 hidapi: minor sync with mainstream (for sake of symmetry, only.) 2024-03-05 14:33:06 +03:00
Ryan C. Gordon
bc984f78bf android: Remove blocking permission request code. Async only in SDL3!
(this actually still blocks at our internal points of usage, though, for
replacement at a later time.)
2024-02-13 12:06:51 -05:00
Sam Lantinga
c951bbe3de Look at all available usages when determining whether to ignore a device 2024-02-07 16:02:12 -08:00
Sam Lantinga
faeb2b1f22 Fixed warning C4204: nonstandard extension used: non-constant aggregate initializer when built with Visual Studio 2019 2024-02-07 13:16:35 -08:00
Ryan C. Gordon
1c5bc53738 windows: Manage WideCharToMultiByte vs Windows XP.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ozkan Sezer
07a0c0e402 SDL_hidapi.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Anonymous Maarten
31d133db40 Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
Sam Lantinga
fc0c774976 Renamed SDL_ThreadID() to SDL_GetCurrentThreadID()
Also renamed SDL_threadID to SDL_ThreadID and made it Uint64 for consistency with other ID types
2024-01-18 08:18:37 -08:00
Sam Lantinga
5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Ozkan Sezer
2f806c89b5 initial import of hidapi netbsd uhid native backend from mainstream
c19ae126d8
https://github.com/libusb/hidapi/pull/612
2023-11-26 20:20:28 +03:00
Ozkan Sezer
aaba01aee4 hidapi: syncing with mainstream:
- macos, pthread_barrier_wait: properly check the wait condition
- windows: Assert that struct has the correct size
- windows: Fix printf/string-related issues
- other miscellaneous stuff irrelevant in SDL. (for symmetry...)
2023-11-23 11:35:02 +03:00
Ozkan Sezer
5730eb67f0 add HAVE_GCC_DIAGNOSTIC_PRAGMA to SDL_internal.h, use it 2023-11-23 11:33:20 +03:00
Ryan C. Gordon
c6d9fb1ad7 hidapi: Avoid memcpy'ing to NULL.
(This fix was originally from @themightyoarfish on GitHub. Thanks!)

Fixes #8428.
Reference PR #8431.
2023-11-06 13:48:07 -05:00
Ryan C. Gordon
c53843a961 docs: Remove Doxygen \brief tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00
Sam Lantinga
0b460f34ba The HP HyperX controllers have a share button 2023-11-03 14:47:20 -07:00
Sam Lantinga
23ceae94c9 Fixed Xbox 360 Controller support using libusb on Linux 2023-10-25 14:50:07 -07:00
Sam Lantinga
f52b330ed8 Added support for the HP HyperX Clutch Gladiate controller 2023-10-25 09:00:26 -07:00
Sam Lantinga
34719cba96 Fixed crash in hid_init() if the HIDDeviceManager isn't available 2023-09-22 10:14:16 -07:00
Sam Lantinga
f622f21e6f Fixed build 2023-09-15 05:17:33 -07:00
Sam Lantinga
5774c9638c Prefer hidraw over libusb when libusb whitelisting is not enabled
Since opening devices via libusb will unbind them from other drivers, we will either whitelist specific devices that we want to support via libusb or we will prefer other drivers over libusb.
2023-09-15 05:14:26 -07:00
Sam Lantinga
9301f7ace2 hidapi/libusb: only enumerate each interface once
If a device has multiple altsettings, like an Xbox Series X controller, make sure we only enumerate each interface once, not once for each altsetting.
2023-09-15 05:07:05 -07:00
Ozkan Sezer
923d612ca1 hidapi: sync macOS code with mainstream.
this merges mainstream commit 4009466d59c41f (mainstream PR/611)
2023-08-27 22:33:32 +03:00
Ozkan Sezer
3b1d1e4e31 hidapi: sync the hidraw changes with mainstream
Apply mainstream commit 8a4de63b (mainstream PR/601) to our hidapi.
The patch is a direct apply of the mentioned commit, with one sdl-
specific part guarded by HIDAPI_IGNORE_DEVICE adapted accordingly.
2023-08-26 08:09:10 -07:00
Sam Lantinga
845f3c7450 Fixed mismatch between stdlib calloc() and SDL free()
Fixes https://github.com/libsdl-org/SDL/issues/8145
2023-08-23 14:49:29 -07:00
Sam Lantinga
3e1ae0c867 Clearified the libusb whitelist default logic 2023-08-14 12:19:37 -07:00
Ozkan Sezer
f464eb2c54 SDL_hidapi.c: change 'use_libusb_whitelist_default' into a macro.
Avoids 'initializer element is not constant' error from older compilers.
2023-08-14 17:01:24 +03:00
Ethan Lee
f0f15e365d hidapi: Use a whitelist for libusb when other backends are available 2023-08-13 14:16:11 -07:00
Sam Lantinga
c94cb3a5d8 Simplified the Xcode project to a single Framework target
Static and shared libraries can be built using CMake support in SDL 3.0

Built tests for macOS, iOS, and tvOS
2023-07-31 18:38:18 -07:00
Sam Lantinga
4749df0a63 Just disable the 4214 warning instead of trying to change the structure definition 2023-07-25 14:01:46 -07:00
Ozkan Sezer
4ca0e937e1 hidapi: remove unwanted files (e.g.: .git*, etc...) 2023-07-19 00:55:04 +03:00
Ozkan Sezer
40ac818bf8 hidapi: sync with mainstream (typo fixes) 2023-07-19 00:40:10 +03:00
Sam Lantinga
2bf05f38ad Increased the timeout when opening /dev/hidraw nodes
We're still seeing it taking longer than 10ms for permissions to become available on Steam Deck.
2023-07-18 14:28:55 -07:00
Sam Lantinga
be79f62cb7 Fixed warning C4214: nonstandard extension used: bit field types other than int 2023-07-06 18:14:22 -07:00
Sam Lantinga
c6ee9780df Fixed DualSense controllers not being picked up by the HIDAPI driver
The hidraw device may take additional time to get the correct permissions for us to open it. In my tests on Steam Deck hardware, this ranges between 5-8ms.
2023-06-18 12:19:54 -07:00
Sam Lantinga
dec0dbff13 Fixed enumerating Steam Controllers on iOS 2023-06-12 16:57:41 -07:00
Sam Lantinga
d032492aab Fixed detecting Bluetooth Steam Controllers on Windows 2023-06-05 21:28:12 -07:00
Sam Lantinga
17c397f7ec Save the error code before doing any other operation
SDL_ClearError() resets the Win32 error code to 0
2023-06-05 21:18:49 -07:00
Sam Lantinga
6e7769cde1 Fixed detecting Bluetooth Steam Controllers 2023-06-05 19:52:00 -07:00
Sam Lantinga
fa41ece65f Allow other applications to open controllers on macOS 2023-06-03 11:53:36 -07:00
Ozkan Sezer
0c862d9a55 added compiler support comment about #pragma push_macro/pop_macro. 2023-06-03 17:23:40 +03:00