Commit Graph

52 Commits

Author SHA1 Message Date
Sam Lantinga
a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga
7775f7cedf Fixed deadlock in HIDAPI joystick system 2020-01-13 22:05:54 -08:00
Sam Lantinga
47abe4e3b3 Fixed crash when unplugging a HIDAPI controller 2020-01-09 14:53:30 -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
Zack Middleton
f0cee3edec Fix shutting down HIDAPI device with multiple joysticks
Using Wii U GameCube USB adapter with multiple controllers attached and
restarting SDL input in a game results in extra joysticks with NULL name.

HIDAPI_CleanupDeviceDriver() shut down joysticks by iterating through
device->num_joysticks but each HIDAPI_JoystickDisconnected() decreases
device->num_joysticks and shifts joysticks array down. Resulting in only
half of controllers being shutdown. It worked with only 1 controller
attached though.

Disconnect HIDAPI device joystick 0 until there are none left.
2019-12-22 13:15:11 -08:00
Sam Lantinga
46e1377d49 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sam Lantinga
2481ab9340 Fixed compiler warning 2019-12-19 15:58:16 -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
e7f7e3f40f Refactored HIDAPI controller code to support dongles and hubs that dynamically attach controllers 2019-12-19 15:01:30 -08:00
Sam Lantinga
0352814a8a Added general remapping of controller manufacturer 2019-12-13 16:07:25 -08:00
Sam Lantinga
0f52916027 Added custom names for some controllers 2019-12-11 17:47:01 -08:00
Sam Lantinga
e029fdbb38 Shorten "Performance Designed Products" to "PDP" 2019-12-11 17:46:59 -08:00
Sam Lantinga
8b50dcb21b Use the controller product string instead of hard-coding controller names 2019-12-11 17:46:54 -08:00
Sam Lantinga
3469481ef6 Don't include the manufacturer if it's already included in the product string 2019-12-10 10:00:49 -08:00
Sam Lantinga
3626506369 Added some missing Xbox controller names 2019-12-09 13:54:03 -08:00
Sam Lantinga
43cb7b3c51 Added support for the Hori Fighting Commander 2019-11-27 12:38:51 -08:00
Sam Lantinga
a76e547477 Added support for the PowerA XB1 Fusion Fight Pad 2019-11-27 12:38:48 -08:00
Sam Lantinga
a5e6b87ce6 Added support for a variant of the PowerA FUSION Pro Controller 2019-11-26 08:35:41 -08:00
Sam Lantinga
f3d95396d6 Added some missing controller names 2019-11-25 15:02:54 -08:00
Sam Lantinga
8243a3e801 Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga
1e24a1514d Added names for some missing Xbox controllers 2019-11-18 11:51:39 -08:00
Sam Lantinga
cf33f1f0ef Added a utility function to simplify the hint handling logic 2019-11-13 21:53:01 -08:00
Sam Lantinga
9da4bfc141 Added support for the Power A Nintendo Switch Enhanced Wireless Controller 2019-10-22 10:57:07 -07:00
Sam Lantinga
c10a87429d Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum
c172f36bf4 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Sam Lantinga
dc714389f0 Don't call hid_enumerate() if the HIDAPI drivers are all disabled 2019-07-25 15:21:44 -07:00
Sam Lantinga
be6cda9f95 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
82af42761e 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
c528615626 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
5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga
14c55ac890 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
be8ef94f18 hidapi: Don't run a separate event loop for device notifications.
Fixes Bugzilla #4286.
2018-10-26 14:43:39 -04:00
Sam Lantinga
14329256cb Generalized the XInput user index into a player index 2018-10-25 16:53:14 -07:00
Sam Lantinga
1944556171 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
870c44bfed safer this way, just in case.. 2018-09-25 09:20:56 +03:00
Sam Lantinga
cd90e2ca58 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
6a7b0c27af Fixed crash launching under Steam on Mac OS X 2018-09-14 12:41:29 -07:00
Ozkan Sezer
33381d3d10 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
34237b80f4 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
16ccff3c56 Fixed whitespace 2018-08-29 20:23:36 -07:00
Sam Lantinga
3f5ff751fe 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
63107524f6 Fixed input from the Steam Virtual Gamepad on Mac OS X 2018-08-15 19:53:34 -07:00
Sam Lantinga
0903e83553 Use SDL specific window class to avoid conflicting with Steam 2018-08-15 19:53:31 -07:00
Sam Lantinga
c88666580e Catch device removal as well as device arrival on Windows 2018-08-15 19:53:30 -07:00
Sam Lantinga
641c674f2a Turned off debug messages 2018-08-15 19:53:28 -07:00
Sam Lantinga
51902010c6 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
dfbd7f65a9 Fixed Mac OS X build 2018-08-15 19:53:24 -07:00
Sam Lantinga
ec74c318b9 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
ab07ce1166 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