From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sat, 23 Sep 2006 13:40:33 +0000 Subject: Re: joypad naming problems Message-Id: <200609231740.36303.arvidjaar@mail.ru> List-Id: References: <200609231424.08294.ljubomir.simin@gmail.com> In-Reply-To: <200609231424.08294.ljubomir.simin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 23 September 2006 16:24, Ljubomir Simin wrote: > Hi, > > I have problem with setting udev rules. After reading > http://reactivated.net/writing_udev_rules.html I've decided to ask here f= or > help, as this mailing list is noticed under "support". Sorry if this is n= ot > 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 =3D first joypad, js1 =3D second joy= pad, > 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}=3D"046d", SYSFS{idProduct}=3D"0216", NAME=3D"input/js0", > MODE=3D"666", SYMLINK+=3D"js0" > SYSFS{idVendor}=3D"06a3", SYSFS{idProduct}=3D"0109", NAME=3D"input/js1", > MODE=3D"666", SYMLINK+=3D"js1" > > (SYMLINK is there "just to be sure". The most important part is NAME) > Which version of udev? Which version of kernel? > 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 > please show udevinfo -a -p /sys/class/input/input1/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= > '0', mode =3D '0660', uid =3D '0', gid =3D '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=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= > '2', mode =3D '0660', uid =3D '0', gid =3D '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 n= ot > get created during startup, and no joysticks work. > yes it will override your rule in any case; but atm your rule does not even= =20 kick in. - -andrey=20 > 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, -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFFTlUR6LMutpd94wRApppAJ4wzwL63WvFXXAafKCuyCBl36GApQCdEi3w Y+wND37vpBq6X2h5ZNkjTak.s4 -----END PGP SIGNATURE----- ------------------------------------------------------------------------- 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