SDL, Linux, and udev

I have several joysticks. Different ones are used for different games. So, I
would like to setup my Linux box with udev to use a consistent device names for
the joysticks, rather than /dev/input/js0, /dev/input/js1, etc. If this isn’t
done, then I have to make sure all my joysticks are plugged in at the same time,
or the order will be different and the programs will get confused.

Is there anyway I can use udev to assign my joysticks a specific device name and
allow SDL to find them still.

I tried having them each have a specific /dev/input/jsX number. But if
/dev/input/js0 isn’t there, SDL seems to abandon the joystick search, so I can’t
have 1 2 3 or 4 without a their preceeding numbers.

Ideally, I would like to do something like
/dev/input/joysticks/adaptoid
/dev/input/joysticks/retropad
/dev/input/joysticks/superretropad
/dev/input/joysticks/wingman

But I would be happy just being able to plug the joysticks I intend to use at
the time in and leave the rest out.

Is this possible?

John Ratliff

John Ratliff wrote:

I have several joysticks. Different ones are used for different games. So, I
would like to setup my Linux box with udev to use a consistent device names for
the joysticks, rather than /dev/input/js0, /dev/input/js1, etc. If this isn’t
done, then I have to make sure all my joysticks are plugged in at the same time,
or the order will be different and the programs will get confused.

Is there anyway I can use udev to assign my joysticks a specific device name and
allow SDL to find them still.

I tried having them each have a specific /dev/input/jsX number. But if
/dev/input/js0 isn’t there, SDL seems to abandon the joystick search, so I can’t
have 1 2 3 or 4 without a their preceeding numbers.

Ideally, I would like to do something like
/dev/input/joysticks/adaptoid
/dev/input/joysticks/retropad
/dev/input/joysticks/superretropad
/dev/input/joysticks/wingman

But I would be happy just being able to plug the joysticks I intend to use at
the time in and leave the rest out.

Is this possible?

Couldn’t you use the SDL env variable for joysticks ? For example :
export SDL_JOYSTICK_DEVICE=/dev/input/joysticks/wingman

Stephane

Stephane Marchesin <stephane.marchesin wanadoo.fr> writes:

Couldn’t you use the SDL env variable for joysticks ? For example :
export SDL_JOYSTICK_DEVICE=/dev/input/joysticks/wingman

Stephane

Thanks, This is a good start. But does this limit it to one joystick? Is there a
way to specify a set of joysticks? That would be even better.

John Ratliff