We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5233 - PS3 Gamepad Motion Control not correctly ignored on Linux
Summary: PS3 Gamepad Motion Control not correctly ignored on Linux
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.13
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-15 05:34 UTC by Igor Morgado
Modified: 2020-07-15 17:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Morgado 2020-07-15 05:34:14 UTC
PS3 Controller motion sensor string is being reported as

`Gasia Co.,Ltd PS(R) Gamepad Motion Sensors`

But `src/joystick/SDL_gamecontroller.c` line1690 only ignores if matches the string  `Controller Motion Sensors`.

```
#if defined(__LINUX__)
    if (name && SDL_strstr(name, "Controller Motion Sensors")) {
        /* Don't treat the PS3 and PS4 motion controls as a separate game controller */
        return SDL_TRUE;
    }
#endif
```

Therefore, SDL is mapping 2 Game controllers instead one.

Maybe reduce the substring to match `Motion Sensors` instead.


A simple log from my application is shown below:

INFO: Game controller device 0 - PS3 Controller:PS3 Controller found.
INFO: Controller 0: Player 0: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad
INFO: Game controller device 1 - PS3 Controller:PS3 Controller found.
INFO: Controller 1: Player 1: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad Motion Sensors


Generated from this code:

    SDL_Log("Controller %d: Player %d: %04x:%04x:%04x - %s - %s - %s\n",
    SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller)),
    SDL_GameControllerGetPlayerIndex(gamecontroller),
    SDL_GameControllerGetVendor(gamecontroller),
    SDL_GameControllerGetProduct(gamecontroller),
    SDL_GameControllerGetProductVersion(gamecontroller),
    SDL_GameControllerName(gamecontroller),
    ControllerTypeStr[SDL_GameControllerGetType(gamecontroller)],
    SDL_JoystickName(SDL_GameControllerGetJoystick(gamecontroller))
    );
Comment 1 Igor Morgado 2020-07-15 05:47:16 UTC
If needed PS3 Controller GUID is: 030000004c0500006802000011810000
Comment 2 Sam Lantinga 2020-07-15 17:16:17 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/cee5dca9fad6