Commit Graph

154 Commits

Author SHA1 Message Date
Sam Lantinga
19c3484469 Fixed slow enumeration when Apple Cinema HD display 30" is plugged in 2020-03-13 19:19:29 -07:00
Ethan Lee
133b475586 Use LIBUSB_CALL for hidapi's read_callback function 2020-03-11 14:17:19 -04:00
Sam Lantinga
cb986aff9f Fixed exception at shutdown if the controllers are closed after the HIDDeviceManager is shutdown 2020-03-13 13:05:32 -07:00
Sam Lantinga
69a8c8468c 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
2020-03-04 09:42:08 -08:00
Sam Lantinga
96836ec643 Add 500ms max wait time for hid_write to complete on Windows
It appears that with some (presumably) flaky drivers or hardware that the WriteFile in hid_write never completes leading to GetOverlappedResult to block forever waiting for it.
2020-03-03 09:22:43 -08:00
Sam Lantinga
07000bfc33 Fixed bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for 10 seconds when playing audio from another application
Jake Breen

I have tracked it down to a call on
hid_device_info() -> HidD_GetManufacturerString (Line 499 in src\hidapi\windows\hid.c)
2020-03-02 17:31:58 -08:00
Sam Lantinga
bebc486774 We already have a hidapi implementation for Windows, we don't need libusb 2020-03-01 17:53:30 -08:00
Sam Lantinga
1190343f36 Build hidapi as a framework on iOS, so it can be linked by the application as well. 2020-01-30 16:02:56 -08:00
Sam Lantinga
c9c89783cb Miscellaneous pending fixes 2020-01-29 20:09:08 -08:00
Sam Lantinga
5e649983e7 Don't enumerate devices we can't open 2020-01-26 12:40:32 -08:00
Sam Lantinga
43aa1fa9e7 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android 2020-01-18 11:21:14 -08:00
Sam Lantinga
4e682461cc Reattach the kernel driver after closing USB controllers 2020-01-17 10:43:14 -08:00
Sam Lantinga
a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga
4e1cc124d2 Improved Xbox One controller initialization 2020-01-16 15:32:39 -08:00
Sam Lantinga
98ce0e50b7 Removed unnecessary setlocale() on Mac
240bad3b66
2019-12-30 11:09:03 -08:00
Sam Lantinga
a9482a1d60 Added support for the Nintendo GameCube adapter, tested on Steam Link hardware 2019-12-30 09:44:32 -08:00
Cameron Gutman
f21e172767 Use IOHIDManagerRegisterDeviceRemovalCallback() to monitor for HID removal
The function we currently use, IOHIDDeviceRegisterRemovalCallback(), often
fails on Catalina with a "__CFRunLoopModeFindSourceForMachPort returned NULL"
error message. Once a removal callback is missed, we will eventually crash when
the joystick is closed attempting to use the invalid IOHIDDeviceRef.

https://forums.developer.apple.com/thread/124444
2019-12-20 22:25:49 -08:00
Sam Lantinga
868551b121 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. 2019-12-20 21:00:16 -08:00
Sam Lantinga
c5024a182d Backed out debug code 2019-12-19 15:21:44 -08:00
Sam Lantinga
e22e77dadc Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
Sam Lantinga
15d30298cf Added support for wireless Xbox 360 controllers using the HIDAPI driver 2019-12-19 15:01:32 -08:00
Sam Lantinga
4237b1834e Fixed compiler warning 2019-12-19 04:31:00 -08:00
Sam Lantinga
52b6ab2196 Added support for the SteelSeries Stratus Duo 2019-12-16 17:11:23 -08:00
Sam Lantinga
cd515bd1b9 Fixed Xbox 360 Controller support using libusb on Linux 2019-12-12 14:26:34 -08:00
Sam Lantinga
532164366e Use the same logic to get the config descriptor in hid_open() as in hid_enumerate() 2019-11-25 16:29:12 -08:00
Sam Lantinga
8243a3e801 Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga
494af7a6e7 Backed out change to dynamically load udev - it's already happening in SDL_hidapi.c 2019-11-25 15:02:45 -08:00
Sam Lantinga
308e7f2fec Linux hidapi code dynamically loads udev 2019-11-23 12:11:20 -08:00
Sam Lantinga
5c15e81cfb Prevent the SPEEDLINK COMPETITION PRO joystick from switching into Android controller mode when enumerated over HID on Windows 10. 2019-08-22 15:58:00 -07:00
Ethan Lee
c76f0f5b6b hidapi: Explicitly include locale.h, for setlocale 2019-08-06 23:08:01 -04:00
Ethan Lee
aa09e61223 Port libusb hid.c to SDL, add to MinGW configure 2019-08-04 00:01:38 -04:00
Ethan Lee
f7d82e5616 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.
2019-07-31 12:20:55 -04:00
Andrew Eikum
738dff4bbc hidapi: Update repository URLs
Upstream hidapi has been re-homed. Update the repo URLs to help guide folks
where to contribute fixes.
2019-07-25 08:05:13 -05:00
Andrew Eikum
0e9560aea2 hidapi: Zero out new hid_device_info structs 2019-07-23 14:41:00 -05:00
Sam Lantinga
52e62329c8 Fixed build error 2019-07-17 16:47:19 -07:00
Sam Lantinga
1dc24160a1 Add linked list of opened HID devices to prevent accessing already freed devices in device removal callback that is sometimes called even after being unregistered 2019-07-17 16:47:13 -07:00
Jimb Esser
6a7161dceb Blacklist Corsair device causing hang 2019-07-14 16:48:31 -07:00
Sam Lantinga
23a2b47790 Protect against NULL device in the Android hidapi implementation 2019-06-07 09:00:26 -07:00
Sam Lantinga
1a8e3a0270 HIDAPI: fix bug that caused non-HID class parts of composite devices to have windows HID functions called on them. 2019-03-12 14:44:12 -07:00
Sam Lantinga
b08bdc4401 Don't build SDL_JOYSTICK_HIDAPI by default on iOS
If you enable this, you'll need to link with CoreBluetooth.framework and add something like this to your Info.plist:
<key>NSBluetoothPeripheralUsageDescription</key>
<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
2018-10-26 09:27:31 -07:00
Sam Lantinga
c4918db580 Add exception handling to Android hidapi. 2018-10-22 14:55:42 -07:00
Sam Lantinga
337cea4411 Fixed life-cycle issues with two activities sharing HIDDeviceManager 2018-10-08 12:49:30 -07:00
Ozkan Sezer
cf7d64f266 hidapi/windows/hid.c: comment out ntdef.h include after windows.h.
not necessary and can cause redefinition errors in some toolchains.
2018-09-28 13:44:10 +03:00
Ozkan Sezer
283680f2c1 hidapi/windows/hid.c: fix misplaced #if 0
VendorID && ProductID are only used by the test main(),
otherwise they are unwanted globals.
2018-09-28 11:04:55 +03:00
Sam Lantinga
f964ce03b4 Fixed mingw-w64 build 2018-09-28 01:00:47 -07:00
Sam Lantinga
7df0f4fdac Fixed bug 4277 - warnings patch
Sylvain

Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command

They are automatically enabled with -Wall
2018-09-27 14:56:29 -07:00
Sam Lantinga
fb0e68ae0f Fixed building with newer Android NDK 2018-09-25 08:23:57 -07:00
Sam Lantinga
f6a537cbfa Store the API device refcount on the device itself, so if the device is disconnected and we have multiple application references to it, we only free it once. 2018-09-17 11:35:24 -07:00
Ozkan Sezer
305e5968aa do not export hidapi symbols from SDL dlls (bug #4259). 2018-09-15 14:28:10 +03:00
Sam Lantinga
e8a0e35e24 Use atomic reference counting for the HID device object 2018-09-14 18:31:01 -07:00
Sam Lantinga
e9f6805fc6 Removed dependency on C++ runtime on iOS 2018-08-21 19:42:19 -07:00
Sam Lantinga
0d22559e30 Fixed Android build error 2018-08-21 10:25:30 -07:00
Sam Lantinga
5dfa4043a3 Fixed warnings building on Mac OS X 64-bit 2018-08-20 21:19:17 -07:00
Sam Lantinga
4f41f07d43 Added missing files from previous commits 2018-08-09 16:05:48 -07:00