Commit graph

31 commits

Author SHA1 Message Date
Sam Lantinga
cda9fd15e6 Added names for some missing Xbox controllers 2019-11-18 11:51:39 -08:00
Sam Lantinga
53768d7d97 Added a utility function to simplify the hint handling logic 2019-11-13 21:53:01 -08:00
Sam Lantinga
87cff63608 Added support for the Power A Nintendo Switch Enhanced Wireless Controller 2019-10-22 10:57:07 -07:00
Sam Lantinga
571fc2a8b1 Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum
e0039a7c75 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Sam Lantinga
b43ec841b4 Don't call hid_enumerate() if the HIDAPI drivers are all disabled 2019-07-25 15:21:44 -07:00
Sam Lantinga
f36c6a4c04 Rolling back GameCube HIDAPI support
It causes the HIDAPI devices to always be opened on enumeration, which causes crashes in the Windows drivers when multiple applications are reading and writing at the same time. We can revisit this after 2.0.10 release.
2019-06-19 15:54:21 -07:00
Zack Middleton
2b3540e8f2 hidapi: Use GameCube adapter controller port for player index
The Nintendo USB GameCube adapter has four controller ports. Return
the port number as 0 to 3 from SDL_JoystickGetPlayerIndex() and
SDL_JoystickGetDevicePlayerIndex().
2019-06-08 13:36:59 -07:00
Ethan Lee
cc665e2a57 hidapi: Add support for Wii U/Switch USB GameCube controller adapter.
Note that a single USB device is responsible for all 4 joysticks, so a large
rewrite of the DeviceDriver functions was necessary to allow a single device to
produce multiple joysticks.
2019-03-12 20:27:54 -04:00
Sam Lantinga
af32a2f4cd Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga
99a161adc7 This change looks okay in the general case.
If we run into problems where these events aren't dispatched (initialized on a different thread than the main thread?) we may need to create a separate thread to handle device notifications like we do with the windows joystick subsystem.
2018-10-26 20:20:28 -07:00
Ryan C. Gordon
c81e3972ba hidapi: Don't run a separate event loop for device notifications.
Fixes Bugzilla #4286.
2018-10-26 14:43:39 -04:00
Sam Lantinga
678ba78382 Generalized the XInput user index into a player index 2018-10-25 16:53:14 -07:00
Sam Lantinga
ab13676713 Make sure we don't read and write to HIDAPI at the same time, it's not thread-safe on Windows 2018-10-02 20:51:33 -07:00
Ozkan Sezer
acf03aea49 safer this way, just in case.. 2018-09-25 09:20:56 +03:00
Sam Lantinga
e5786b21c3 Fixed bug 4267 - linkage failure with --enable-hidapi because of missing libudev symbols
Ozkan Sezer

hidapi dynamic udev initial patch
2018-09-24 16:33:14 -07:00
Sam Lantinga
81d9677756 Fixed crash launching under Steam on Mac OS X 2018-09-14 12:41:29 -07:00
Ozkan Sezer
efaed040cb hidapi/SDL_hidapijoystick.c: fix build in C90 mode:
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_InitializeDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: (Each undeclared identifier is reported only once
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: for each function it appears in.)
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_UpdateDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:339: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:341: error: ISO C90 forbids mixed declarations and code
2018-09-07 11:03:24 +03:00
Sam Lantinga
cd08cc2a4e Better fix to make sure we're only returning controllers from the HIDAPI joystick API 2018-08-31 18:10:21 -07:00
Sam Lantinga
d4ebcc0148 Fixed whitespace 2018-08-29 20:23:36 -07:00
Sam Lantinga
8235f84320 Use a unified name list for Xbox 360 and Xbox One controllers for drivers that can handle both 2018-08-15 23:14:43 -07:00
Sam Lantinga
4d30496429 Fixed input from the Steam Virtual Gamepad on Mac OS X 2018-08-15 19:53:34 -07:00
Sam Lantinga
ea70c5b7a4 Use SDL specific window class to avoid conflicting with Steam 2018-08-15 19:53:31 -07:00
Sam Lantinga
5cffb66660 Catch device removal as well as device arrival on Windows 2018-08-15 19:53:30 -07:00
Sam Lantinga
242d67f07b Turned off debug messages 2018-08-15 19:53:28 -07:00
Sam Lantinga
ae47f3aa91 Remove the HIDAPI device if we get a read error from it
This fixes detecting PS4 controller disconnect on Mac OS X, where there isn't any device removed notification
2018-08-15 19:53:26 -07:00
Sam Lantinga
a7e38096ba Fixed Mac OS X build 2018-08-15 19:53:24 -07:00
Sam Lantinga
b29504064b Polling hid_enumerate() every 3 seconds causes freezes and stutters on some USB audio devices and mice.
We'll only enumerate devices when we get notification that the system devices have changed
2018-08-15 19:53:22 -07:00
Sam Lantinga
1e8a089ec1 Don't update the device list for devices we know aren't supported
This should reduce HID enumeration (hitting the USB bus) if for some reason we're getting spammed with false device insert/removal events
2018-08-09 16:04:30 -07:00
Sam Lantinga
29023f51e8 Worked around bug with Sony PS Now PS3 controller where DirectInput polling will continue to return success after the controller is unplugged.
The code is now reliant on SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() being called correctly when devices are added or removed on Windows
2018-08-09 16:03:50 -07:00
Sam Lantinga
db39b4811f Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00