[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-hotplug
Subject:    joypad naming problems
From:       Ljubomir Simin <ljubomir.simin () gmail ! com>
Date:       2006-09-23 12:24:07
Message-ID: 200609231424.08294.ljubomir.simin () gmail ! com
[Download RAW message or body]

Hi,

I have problem with setting udev rules. After reading 
http://reactivated.net/writing_udev_rules.html I've decided to ask here for 
help, as this mailing list is noticed under "support". Sorry if this is not 
suitable place for this.

I have dedicated gaming machine which is operated only with 2 joypads. I want 
to make sure that no matter when or where the joypads are plugged in, they 
always get the same device names. This is crucial for numerous emulators I've 
set, which thinks js0 == first joypad, js1 == second joypad, and so on. Most 
of them are not configurable enough to use custom device names (so I can not 
use symlinks).
Currently, joypads get names "input/js0" and "input/js1" at startup. However, 
when I unplug the first one, and plug it again, it becomes "input/js2" thus 
making most programs and emulators useless. So I want to "bound" it to 
input/js0. To achieve this I've created rules file:

mythtv@revstation:~$ cat /etc/udev/rules.d/10-local.rules
SYSFS{idVendor}=="046d", SYSFS{idProduct}=="0216", NAME="input/js0", 
MODE="666", SYMLINK+="js0"
SYSFS{idVendor}=="06a3", SYSFS{idProduct}=="0109", NAME="input/js1", 
MODE="666", SYMLINK+="js1"

(SYMLINK is there "just to be sure". The most important part is NAME)

However, it seems they're not enough. Before unplugging situation looks like 
this:

mythtv@revstation:~$ udevinfo -q all -n /dev/input/js0
P: /class/input/input1/js0
N: input/js0

mythtv@revstation:~$ udevtest /class/input/input1/js0 input
main: looking at device '/class/input/input1/js0' from subsystem 'input'
main: opened class_dev->name='js0'
udev_rules_get_name: rule applied, 'js0' becomes 'input/js0'
run_program: '/sbin/grepmap --udev'
run_program: '/sbin/grepmap' (stdout) 'evdev'
run_program: '/sbin/grepmap' (stdout) 'evbug'
run_program: '/sbin/grepmap' returned with status 0
match_rule: 1 untrusted character(s) replaced
create_node: creating device node '/dev/input/js0', major = '13', minor = '0', 
mode = '0660', uid = '0', gid = '46'

But after re-plugging the first joypad: 

mythtv@revstation:~$ udevtest /class/input/input1/js0 input
main: looking at device '/class/input/input1/js0' from subsystem 'input'
main: sysfs_open_class_device_path failed
mythtv@revstation:~$  

It didn't get js0, it got js2 again:

mythtv@revstation:~$ udevinfo -q all -n /dev/input/js0
no record for 'input/js0' in database

mythtv@revstation:~$ udevinfo -q all -n /dev/input/js2
P: /class/input/input5/js2
N: input/js2

mythtv@revstation:~$ udevtest /class/input/input5/js2 input
main: looking at device '/class/input/input5/js2' from subsystem 'input'
main: opened class_dev->name='js2'
udev_rules_get_name: rule applied, 'js2' becomes 'input/js2'
run_program: '/sbin/grepmap --udev'
run_program: '/sbin/grepmap' (stdout) 'evdev'
run_program: '/sbin/grepmap' (stdout) 'evbug'
run_program: '/sbin/grepmap' returned with status 0
match_rule: 1 untrusted character(s) replaced
create_node: creating device node '/dev/input/js2', major = '13', minor = '2', 
mode = '0660', uid = '0', gid = '46'


I have this line in /etc/udev/rules.d/20-names.rules (provided by default with 
Ubuntu). Is it guilty? When I comment it out, input/js* files does not get 
created during startup, and no joysticks work.

mythtv@revstation:~$ cat /etc/udev/rules.d/20-names.rules |grep js
KERNEL=="js[0-9]*",                     NAME="input/%k"


What is wrong with my setup? How can I force joysticks to always have same 
device names?


Best regards,
-- 
Ljubomir Simin 
Registered Linux User #351181
http://counter.li.org 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic