From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ljubomir Simin Date: Sat, 23 Sep 2006 12:24:07 +0000 Subject: joypad naming problems Message-Id: <200609231424.08294.ljubomir.simin@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Hi, I have problem with setting udev rules. After reading=20 http://reactivated.net/writing_udev_rules.html I've decided to ask here for= =20 help, as this mailing list is noticed under "support". Sorry if this is not= =20 suitable place for this. I have dedicated gaming machine which is operated only with 2 joypads. I wa= nt=20 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=20 set, which thinks js0 =3D first joypad, js1 =3D second joypad, and so on. M= ost=20 of them are not configurable enough to use custom device names (so I can no= t=20 use symlinks). Currently, joypads get names "input/js0" and "input/js1" at startup. Howeve= r,=20 when I unplug the first one, and plug it again, it becomes "input/js2" thus= =20 making most programs and emulators useless. So I want to "bound" it to=20 input/js0. To achieve this I've created rules file: mythtv@revstation:~$ cat /etc/udev/rules.d/10-local.rules SYSFS{idVendor}=3D"046d", SYSFS{idProduct}=3D"0216", NAME=3D"input/js0",=20 MODE=3D"666", SYMLINK+=3D"js0" SYSFS{idVendor}=3D"06a3", SYSFS{idProduct}=3D"0109", NAME=3D"input/js1",=20 MODE=3D"666", SYMLINK+=3D"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 lik= e=20 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=3D'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 =3D '13', minor = =3D '0',=20 mode =3D '0660', uid =3D '0', gid =3D '46' But after re-plugging the first joypad:=20 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:~$ =20 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=3D'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 =3D '13', minor = =3D '2',=20 mode =3D '0660', uid =3D '0', gid =3D '46' I have this line in /etc/udev/rules.d/20-names.rules (provided by default w= ith=20 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=3D"js[0-9]*", NAME=3D"input/%k" What is wrong with my setup? How can I force joysticks to always have same = device names? Best regards, --=20 Ljubomir Simin=20 Registered Linux User #351181 http://counter.li.org=20 ------------------------------------------------------------------------- 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=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ 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