| Summary: | SDL does not reopen joystick device | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Vladislav Naumov <vnaum> |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | jspradlin, manuel.montezelo, rodrigo.alfenas |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: |
reopen joystick device
reopen joystick device for v 1.3 - same as above, but new indentation rules |
||
Thank you for your bug report! We're busy working on getting SDL 1.3 ready for a high quality release, and want to make sure as many things are fixed there as possible. Could you check to see if your bug is resolved by the latest SDL 1.3 snapshot? http://www.libsdl.org/tmp/SDL-1.3.zip Thanks! Bug persists with SDL 1.3 you referenced. Created attachment 603 [details]
reopen joystick device for v 1.3 - same as above, but new indentation rules
For the record, this bug was submitted also to Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=607908 Hotplug joystick support is in the current snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip Cheers! |
Created attachment 583 [details] reopen joystick device Problem description: SDL opens joystick device only once at startup. If usb connection is lost for some reason (bad USB cable, cheap gamepad, little brother tripping on the wire) - your game is ruined. Input device file is gone for a short time, opened file handle is no longer valid. Kernel re-creates device file after connection is back, but libsdl does not re-open it. Steps to reproduce: plug USB joystick, run SDL-based application that uses joystick, unplug your joystick for a brief time and plug it back in. The patch tries to re-open the device if read operation reports bad file / no such device. I know about possible caveats (like, the new device can have different name, multiple joysticks can re-appear in different order or maybe the device plugged is totally different one), but still I believe anything is better then forcing user to start the game from the very beginning. Especially annoying if user is 3 years old and can't start the game on his own. I (OK, not I but my son) tested it for a week, and it work just fine with mame, mess, mednafen and supertux.