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 135 - Must quit subsystem to detect new joysticks
Summary: Must quit subsystem to detect new joysticks
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.0
Hardware: All All
: P4 API change
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-03 21:16 UTC by Daniel Broschart
Modified: 2013-05-21 00:47 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Broschart 2006-02-03 21:16:45 UTC
In order to find any new joysticks that have been plugged into the system since the SDL application has been running, I have to quit the Joystick subsystem and then re-initialize it before the new joysticks will be detected.
Comment 1 Patrice Mandin 2006-03-01 16:00:46 UTC
Yes, maybe an event could be generated when a new device usable by SDL is plugged/unplugged on the system. As you said, it can be joysticks, but it could be  a monitor (for example for laptops), an audio card (there are USB ones), a keyboard, a mouse, and many more.

Example: When you play solo a 2D fighting game, and a friend comes and plug his joystick, the game would announce "a new challenger is coming...".
Comment 2 Daniel Broschart 2006-04-28 16:14:57 UTC
When I execute my code on a different computer the application does not detect ANY joysticks (I have a CH Fighterstick USB, and a Belkin Nostromo n52 Speedpad) when I swap the ports that the joysticks are plugged into, and then hit the button that rescans for connected joysticks (which includes exiting and re-entering the Joystick subsystem).
Comment 3 Daniel Broschart 2006-04-28 17:18:44 UTC
I recompiled with some debugging info and found that the line 184 in SDL_mmjoystick.c:

result = joyGetPosEx(SYS_JoystickID[i], &joyinfo);

returned 167 for the joysticks after they had been swapped, which is the JOYERR_UNPLUGGED return code.
Comment 4 Daniel Broschart 2006-04-28 17:29:55 UTC
Oh, and at that line of code for all of the other joystick slots the system returned JOYERR_PARMS before and after the switch (which I assume is to be expected).
Comment 5 Max Horn 2006-05-13 08:26:08 UTC
A patch of mine for the Windows Joystick code was recently commited to CVS/SVN, which should help the issue mentioned by Daniel in comments #2-#4. But of course it doesn't address the (design/API) issue that is the main subject of this report.

Daniel, can you confirm this?
Comment 6 Ryan C. Gordon 2006-10-28 20:35:48 UTC
Grabbing this bug for consideration in SDL 1.3...

--ryan.

Comment 7 Ryan C. Gordon 2009-12-15 22:37:34 UTC
Changing bug priorities...

--ryan.
Comment 8 Rodrigo Cardoso 2012-01-27 10:44:24 UTC
Any news about this one?

If not, where can I start looking to make this work in Mac OS X? I need this functionality.

Thanks
Comment 9 Sam Lantinga 2013-05-21 00:47:04 UTC
This is implemented in the current SDL snapshot:
http://www.libsdl.org/tmp/SDL-2.0.zip