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 2183

Summary: SDL_getjoystickbutton returns wrong state for latching buttons
Product: SDL Reporter: zouhair.mahboubi
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED ABANDONED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.1   
Hardware: x86_64   
OS: Linux   

Description zouhair.mahboubi 2013-10-25 22:47:45 UTC
Basically if there is a latching button on a joystick (such as the warthog thrustmaster), the buttons need to be cycled to 'generate' an event before their state is correct. 

This used to happen with axes as well, but that problem has somehow disappeared.

This can be reproduced by using the testjoystick.c available in the source (i.e. not dependent on my code behavior. That being said, I'm using SDL_DISABLE for events and calling joystickupdate at each cycle before polling the devices axes/hats/buttons)
Comment 1 Sam Lantinga 2013-11-11 01:45:47 UTC
I don't have a device with this behavior.  Can you send a joystick to me or submit a patch that fixes the issue for you?

Thanks!
Comment 2 zouhair.mahboubi 2013-11-11 02:14:23 UTC
I don't have a patch: right now I just cycle the button all the time.

One way to replicate this is to start an application that uses SDL with the button already pressed (you can tape it per example). You'll see that the button state will come up as 0 (likely because it never processed the event that told it the buttong went from 0 to 1).

I kind of understand how this is a limitation maybe of using event based instead of polling. But i am somehow surprised since it works for axes just fine.
Comment 3 Sam Lantinga 2017-08-15 05:14:26 UTC
I think I fixed this yesterday. Can you try the latest SDL snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip

Thanks!
Comment 4 Ryan C. Gordon 2018-08-06 21:20:21 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.