You are not logged in.

#1 2008-03-20 05:11:31

schmmd
Member
From: Seattle
Registered: 2006-03-25
Posts: 55
Website

Constant joystick device

I have a few joysticks.  Unfortunately, although they have the same physical layout, they map the buttons and the axes differently.  This would not be a problem, except that when I reboot, the device names can change--so I am never quite sure which joystick is /dev/input/js0.  This makes it very hard to configure programs (such as xmame) to use the joystick correctly.

Is there any way to either remap the joystick buttons to new values or to map a joystick to a particular device?

Offline

#2 2008-03-20 05:24:27

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Constant joystick device

This is exactly what udev custom rules are for. Non-joystick example in /etc/udev/rules.d/10-local.rules

SUBSYSTEMS=="usb", ATTRS{serial}=="blah", SYMLINK+="myjoystick"

Offline

#3 2008-03-20 05:41:35

schmmd
Member
From: Seattle
Registered: 2006-03-25
Posts: 55
Website

Re: Constant joystick device

Very cool.  I actually stumbled upon custom rules in the last few minutes, but I didn't see the SYMLINK option.  Thanks a ton.  However, I have another wrench for you.  I have 4 joysticks.  I would like to name them blah0, blah1, blah2, and blah3.  However, two of my joysticks are completely identical.  There is no way to distinguish them.  How can I assign each of them to one of {blah1, blah2, blah3, blah4}?

Offline

#4 2008-03-20 06:16:43

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Constant joystick device

grep \%n /etc/udev/rules.d/*

Can only use %n, if udev cannot distinguish them by e.g. serial number.

Hm, maybe identify them by the USB port they're in? assuming you always use the same ports.

Last edited by brebs (2008-03-20 06:18:16)

Offline

#5 2008-03-29 22:54:48

schmmd
Member
From: Seattle
Registered: 2006-03-25
Posts: 55
Website

Re: Constant joystick device

I avoided this for a while, but now I am back to it.  Unfortunately, I cannot symlink the joystick devices to something else (i.e. /dev/input/joy0) to use the naming I want because some of the software I am using is not configurable to look for joysticks at nonstandard places.  And I don't really want to hack them.

So I am using /dev/input/js[1-9] as my consistent name for the joysticks.  I am using these so that my particular joystick X always mounts to /dev/input/js0 and my particular joystick Y always mounts to /dev/input/js1.  This was easy to set up since X and Y have different manufacturers and product names.  However, I would like to use my other two joysticks as well, which are conjoined (somebody though it was a good idea to have a single usb cord split and go to two controllers).  These two controllers are absolutely identical.  The only difference shown in a udevinfo is that, in one:

KERNEL=="js0"
ATTR{dev}=="13:0"
KERNELS="input59"

and the other is

KERNEL=="js1"
ATTR{dev}=="13:1"
KERNELS="input60"

However, all of these numbers are liable to change.  They depend (I believe) on what other controllers are plugged in.  Does anyone have an idea how I can map one of these twin controllers to /dev/input/js2 and the other to /dev/input/js3?

Offline

Board footer

Powered by FluxBB