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 3263

Summary: SDL_JoystickGetButton() always returns 0 for PS4 controller's "square" button
Product: SDL Reporter: Brandon <caibbor>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.2   
Hardware: x86   
OS: Linux   

Description Brandon 2016-02-18 00:25:35 UTC
SDL_JoystickGetButton() will always return 0 when called on a USB wired-in Playstation 4 controller's "square" button, which is joystick index 2 as mapped when opening with SDL_GameControllerOpen().

I've confirmed that this bug does not reproduce itself when an XBox 360 controller is plugged in.

I'm on 64 bit Linux Mint, compiling a 32 but application and using 32 bit libraries.

SDL packages:
ii  libsdl2-2.0-0:i386        2.0.2+dfsg1-3ubun i386 
ii  libsdl2-dev               2.0.2+dfsg1-3ubun i386 
ii  libsdl2-mixer-2.0-0:i386  2.0.0+dfsg1-3     i386 
ii  libsdl2-mixer-dev:i386    2.0.0+dfsg1-3     i386 
ii  libsdl2-net-2.0-0:i386    2.0.0+dfsg1-2     i386 
ii  libsdl2-net-dev:i386      2.0.0+dfsg1-2     i386 
ii  libsdl2-ttf-2.0-0:i386    2.0.12+dfsg1-2    i386 
ii  libsdl2-ttf-dev:i386      2.0.12+dfsg1-2    i386 

system info:
Linux helios 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Brandon 2016-02-18 00:29:13 UTC
I have not noticed any other button that does this, although I have not thoroughly tested every one.

Also, the SDL input events are triggered just fine, so this doesn't appear to be a defective controller (which is also brand new). I have worked around this problem temporarily by making a simple array of bools that I change based on the SDL press/release events.
Comment 2 Brandon 2016-02-20 20:49:04 UTC
After some investigation, it seems as though SDL_JoystickGetButton() isn't using the button mapping that the new Controller system has remapped the buttons to. I suppose there's some other function, such as SDL_ControllerGetButton or something like SDL_GetControllerMappingForJoystickButton or something.

To the google...
Comment 3 Brandon 2016-02-20 20:57:49 UTC
I'm going on the assumption which I posted a few minutes ago and marking this as resolved/invalid.