linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ljubomir Simin <ljubomir.simin@gmail.com>
To: linux-hotplug@vger.kernel.org
Subject: joypad naming problems
Date: Sat, 23 Sep 2006 12:24:07 +0000	[thread overview]
Message-ID: <200609231424.08294.ljubomir.simin@gmail.com> (raw)

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ÞVDEV
_______________________________________________
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

             reply	other threads:[~2006-09-23 12:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-23 12:24 Ljubomir Simin [this message]
2006-09-23 13:40 ` joypad naming problems Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200609231424.08294.ljubomir.simin@gmail.com \
    --to=ljubomir.simin@gmail.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).