Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wired PS4 Gamepad detected as two controllers on Mac #3792

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Wired PS4 Gamepad detected as two controllers on Mac #3792

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.12
Reported for operating system, platform: macOS 10.15, x86_64

Comments on the original bug report:

On 2020-08-11 13:18:39 +0000, wrote:

Created attachment 4435
Patch to move SDL_HIDAPI_JoystickDriver to be checked before SDL_DARWIN_JoystickDriver

If a USB connected PS4 gamepad is plugged into the mac while an SDL game is running you will receive two SDL_CONTROLLERDEVICEADDED messages for two new controllers. These will both be a copy of the new gamepad, and all button presses etc. will register on both controllers.

This still happens even if Bluetooth is disabled, so it's nothing to do with the joystick connecting twice through two channels.

It seems that the problem is that there are two drivers on Mac:

  • SDL_DARWIN_JoystickDriver
  • SDL_HIDAPI_JoystickDriver

And both of these detect and add the new controller, hence two controllers.

The problem seems to be that SDL_HIDAPI_JoystickDriver does NOT check to see if the new controller is a duplicate when adding it, whereas SDL_DARWIN_JoystickDriver does.

If I swap the order of drivers in SDL_joystick_drivers[], so the HIDAPI driver comes first then it solves the problem and the gamepad only appears once, as SDL_Darwin_JoystickDriver notices the duplication. This isn't a great fix though, as it essentially relies on the drivers being called in a specific order.

A proper fix would be to have SDL_HIDAPI_JoystickDriver check for duplicates.

On 2020-12-09 14:50:59 +0000, Sam Lantinga wrote:

This is fixed for the 2.0.14 release.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant