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 535

Summary: Incorrect number reported by SDL_NumJoysticks()
Product: SDL Reporter: Atze van der Ploeg <atzeus>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2    
Version: 1.2.11   
Hardware: x86   
OS: Linux   

Description Atze van der Ploeg 2008-01-03 04:39:16 UTC
There's a small bug in reading joysticks under linux: I have 4 joysticks, which normally should be

/dev/input/js0
/dev/input/js1
/dev/input/js2
/dev/input/js3

However when for some reason the the joystick numbering is not consecutive, like this:

/dev/input/js0
/dev/input/js2
/dev/input/js3
/dev/input/js4

(This happens for instance when i unplug js1 and plug it in again, it then becomes js4)

SDL will only see the first joystick and SDL_NumJoysticks() will report 1 instead of 4. I think it simply looks for js0 then js1 etc and stops when that does not exist, thus not finding any joystick after the nonexisting one.

This is kind of annoying, since i have to restart my PC to play my 4player games again :)
Comment 1 Sam Lantinga 2008-01-03 07:26:49 UTC
I believe this is fixed in the recent 1.2.13 release.