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 - Incorrect number reported by SDL_NumJoysticks()
Summary: Incorrect number reported by SDL_NumJoysticks()
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 1.2.11
Hardware: x86 Linux
: P2 minor
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-03 04:39 UTC by Atze van der Ploeg
Modified: 2008-01-03 07:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.