| Summary: | Must quit subsystem to detect new joysticks | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Daniel Broschart <danpub> |
| Component: | joystick | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | API change | ||
| Priority: | P4 | CC: | danpub, max, patmandin, rodrigo.alfenas |
| Version: | 2.0.0 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Daniel Broschart
2006-02-03 21:16:45 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...". 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). 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. 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). 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? Grabbing this bug for consideration in SDL 1.3... --ryan. Changing bug priorities... --ryan. 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 This is implemented in the current SDL snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip |