Linux gamepad/joystick order bug

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
AtZeuS

Linux gamepad/joystick order bug

Post by AtZeuS »

Hi all,

First of all my compliments to the zsnes team, I've been using it for ages and it still rocks :D

I think 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)

zsnes will only see the first joystick. 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.

Cheers,

Atze
philogynist

Same issue

Post by philogynist »

I ran across the same issue, and did an strace. It does in fact check in order for js0, js1, etc. and stops when it finds one that does not exist. I don't know if it's in zsnes itself or SDL, though, so I'm not sure who to contact. Is there something like SDL.FindAllJoysticks() that is used perhaps?

Also, since I just grep'ed for 'input' I got a lot of stuff for event nodes. I haven't really worked with the event interface, but I didn't expect zsnes to need it. Curious.
AtZeuS

Post by AtZeuS »

Ah good point :)

I've looked into it and SDL has a function SDL_NumJoysticks which returns the number of connected joysticks. I've written a small test program to see if that is where the error occurs and this is indeed the case. With js0 and js2 in /dev/input/ it reports 1 joystick, not 2. So the error is in SDL, not in zsnes :) I'll contact them about this bug.

Edit: This is the bugzilla bug i reported:

http://bugzilla.libsdl.org/show_bug.cgi?id=535

Update:

Got a response from the guys at SDL. It seems that the bug is already resolved in the most recent version of SDL (1.2.13). Newer builds of zsnes therefore will not have this bug.

Cheers,

Atze
SamB
ZSNES Developer
ZSNES Developer
Posts: 8
Joined: Sun Jul 02, 2006 8:59 pm

Post by SamB »

AtZeuS wrote:Newer builds of zsnes therefore will not have this bug.
Wouldn't you just need to install the new version of SDL?
Post Reply