Joystick support (linux)

I’ve noticed that SDL on Linux looks for joystick devices at /dev/jsN (where
N is a number). I’ve also seen devices at /dev/input/jsN, which are symlinked
to /dev/jsN on some (most) machines, but don’t seem to be on others.

Should SDL be changed to look for joysticks in /dev/input/ as well?
Is there an ‘official’ place for joystick devices to appear in Linux?

Thanks,
Ben.

/dev/input is the new place in 2.4.x. If you use devfs, you probably
have symlinks because of devfsd.On Wed, Oct 10, 2001 at 08:11:19AM +0100, Ben Campbell wrote:

I’ve noticed that SDL on Linux looks for joystick devices at /dev/jsN (where
N is a number). I’ve also seen devices at /dev/input/jsN, which are symlinked
to /dev/jsN on some (most) machines, but don’t seem to be on others.

Should SDL be changed to look for joysticks in /dev/input/ as well?
Is there an ‘official’ place for joystick devices to appear in Linux?


Joseph Carter Free software developer

  • m2 stares at the monitor… it looks like a hamburger…
    m2 - that’s a bad sign

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011010/b34d1259/attachment.pgp

I would suggest that it look in both places right now. The /dev/input/jsN
location is for those of us that have a Linux kernel with devfs turned on.
Without it, the devices will be plain 'ol /dev/jsN. As such, neither
location is guaranteed. I would, however, suggest a check first for
/dev/input/jsN and if that fails, then look for /dev/jsN, since devfs seems
to be the future for the /dev tree.On Wed, Oct 10, 2001 at 08:11:19AM +0100, Ben Campbell wrote:

I’ve noticed that SDL on Linux looks for joystick devices at /dev/jsN (where
N is a number). I’ve also seen devices at /dev/input/jsN, which are symlinked
to /dev/jsN on some (most) machines, but don’t seem to be on others.

Should SDL be changed to look for joysticks in /dev/input/ as well?
Is there an ‘official’ place for joystick devices to appear in Linux?

Thanks,
Ben.


Thomas “Mondoshawan” Tate
phoenix at psy.ed.asu.edu
http://tank.dyndns.org
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011010/d1653d7f/attachment.pgp

Hello Thomas Mondoshawan Tate. It was Today when you wrote:

| I would suggest that it look in both places right now. The /dev/input/jsN
| location is for those of us that have a Linux kernel with devfs turned on.

They are also used if you use the 2.4.x event interface, but don’t run
devfs. The docs for the new joystick stuff tells you to symlink /dev/js*
to /dev/input/js* yourself so old programs still work.–
Experience! That most brutal of teachers. But you learn, my God, do you learn.
-C. S. Lewis]------------+
6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc@James1
E4C4 DEEA 7D08 D511 E149 | perl -p -e “y/a-zA-Z/n-za-mN-ZA-M/”

So, for updateness, SDL should look in /dev/input/ first.
And for niceity’s sake (for older kernels), check in /dev/ if the former fails.

SDL isn’t an “old program” yet :wink:

-bill!On Wed, Oct 10, 2001 at 06:01:44PM +0100, James wrote:

Hello Thomas Mondoshawan Tate. It was Today when you wrote:

| I would suggest that it look in both places right now. The /dev/input/jsN
| location is for those of us that have a Linux kernel with devfs turned on.

They are also used if you use the 2.4.x event interface, but don’t run
devfs. The docs for the new joystick stuff tells you to symlink /dev/js*
to /dev/input/js* yourself so old programs still work.

I would suggest that it look in both places right now. The /dev/input/jsN
location is for those of us that have a Linux kernel with devfs turned on.
Without it, the devices will be plain 'ol /dev/jsN. As such, neither
location is guaranteed. I would, however, suggest a check first for
/dev/input/jsN and if that fails, then look for /dev/jsN, since devfs seems
to be the future for the /dev tree.

Actually, /dev/input/* is for the 2.4 kernel’s unified input subsystem,
which doesn’t necessarily have anything to do with devfs. And, according
to my SDL source tree, it checks /dev/js* and /dev/input/js* (or
/dev/input/event* if you have the event subsystem enabled at configure
time).

Reference SDL_SYS_JoystickInit() in SDL12/src/joystick/linux/SDL_sysjoystick.c

–ryan.

Yeah, and there’s my question; why do I have to explicitly enable event
input every time I install SDL? If it’s not safe to always build it in,
wouldn’t it be possible for the configure script to detect it?

The point is that there are way too many steps to getting joystick
input working on Linux as it is, without SDL adding another one. I
thought joysticks were considered standard hardware these days… heh

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 10 October 2001 20:30, Ryan C. Gordon wrote:

I would suggest that it look in both places right now. The
/dev/input/jsN location is for those of us that have a Linux kernel
with devfs turned on. Without it, the devices will be plain 'ol
/dev/jsN. As such, neither location is guaranteed. I would, however,
suggest a check first for /dev/input/jsN and if that fails, then look
for /dev/jsN, since devfs seems to be the future for the /dev tree.

Actually, /dev/input/* is for the 2.4 kernel’s unified input subsystem,
which doesn’t necessarily have anything to do with devfs. And,
according to my SDL source tree, it checks /dev/js* and
/dev/input/js* (or /dev/input/event* if you have the event subsystem
enabled at configure time).

Hello David Olofson. It was Today when you wrote:

| The point is that there are way too many steps to getting joystick
| input working on Linux as it is, without SDL adding another one. I

Tell me about it! I spent a week trying to make the joystick port on my
ES1371-based card work. The ns558 driver just wouldn’t load.

Turns out you need a joystick plugged into the port before the driver
will load. It was one of those “DOH!” moments when I realised :-)–
Experience! That most brutal of teachers. But you learn, my God, do you learn.
-C. S. Lewis]------------+
6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc@James1
E4C4 DEEA 7D08 D511 E149 | perl -p -e “y/a-zA-Z/n-za-mN-ZA-M/”

Yeah, I’ve had that one too. :slight_smile:

The db9 parport driver is much nicer; it doesn’t give a damn, as it can’t
identify anything anyway. (And it’s also a much nicer port to deal with
than the gameport, performance wise - at least for digital controllers.)

Seriously, I’m wondering if “Joe Average” can get joystick support to
work on Linux at all… Is there any distro with a joystick configuration
tool that actually works? And does SDL packages for 2.4 based distros
come with 2.4 Input Events enabled?

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 10 October 2001 21:15, James wrote:

Hello David Olofson. It was Today when you wrote:
| The point is that there are way too many steps to getting joystick
| input working on Linux as it is, without SDL adding another one. I

Tell me about it! I spent a week trying to make the joystick port on my
ES1371-based card work. The ns558 driver just wouldn’t load.

Turns out you need a joystick plugged into the port before the driver
will load. It was one of those “DOH!” moments when I realised :slight_smile:

I would suggest that it look in both places right now. The /dev/input/jsN
location is for those of us that have a Linux kernel with devfs turned on.
Without it, the devices will be plain 'ol /dev/jsN. As such, neither
location is guaranteed. I would, however, suggest a check first for
/dev/input/jsN and if that fails, then look for /dev/jsN, since devfs seems
to be the future for the /dev tree.

Actually, /dev/input/* is for the 2.4 kernel’s unified input subsystem,
which doesn’t necessarily have anything to do with devfs. And, according
to my SDL source tree, it checks /dev/js* and /dev/input/js* (or
/dev/input/event* if you have the event subsystem enabled at configure
time).

Reference SDL_SYS_JoystickInit() in SDL12/src/joystick/linux/SDL_sysjoystick.c

And for those of us who run both USB joysticks -and- analogue ones, both
/dev/input/js0 and /dev/js0 are valid… Near as I can tell anyways…
(okay - SDL works. Just about -nothing- else does)

G’day, eh? :slight_smile:
- TeunisOn Wed, 10 Oct 2001, Ryan C. Gordon wrote:

oh sorry about that - my mta died and I replaced it - and my ISP’s been
having frequent downtime… (now running postfix and I’m annoyed with
Telus)

but I toss in a vote to make /dev/input support either autodetected or
enabled by default. I mean, when it’s checked by the driver, the driver
can fall back to non-devinput stuff if it doesn’t work, right?

G’day, eh? :slight_smile:
- Teunis

oh sorry about that - my mta died and I replaced it - and my ISP’s been
having frequent downtime… (now running postfix and I’m annoyed with
Telus)

but I toss in a vote to make /dev/input support either autodetected or
enabled by default. I mean, when it’s checked by the driver, the driver
can fall back to non-devinput stuff if it doesn’t work, right?

They are now enabled by default in the latest CVS, and shouldn’t have
the /dev/input/event* + /dev/input/js* conflict that there was before.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment