View previous topic :: View next topic |
Author |
Message |
nitro322 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Final Fantasy/Final_Fantasy_6_-_Sabin.jpg)
Joined: 24 Jul 2002 Posts: 596 Location: USA
|
Posted: Tue Mar 12, 2013 1:20 am Post subject: Setting joystick order through udev (or anything else...) |
|
|
I have a weird problem with joysticks on my computer - I have several that I use at different times and for different games, and depending on what's plugged in a boot time they'll get detected in a different order. Even my multimedia keyboard gets a js device assigned to it for some reason, which further screws up the ordering of the other devices.
In the past, I used some admittedly hackey udev rules to fix this. Specifically:
Code: | $ cat /etc/udev/rules.d/99-custom.rules
# Set joystick devices to be owned by games group
KERNEL=="js*", SUBSYSTEM=="input", MODE="660", GROUP="games"
# Set force-feedback devices to be owned by games group
KERNEL=="event*", SUBSYSTEM=="input", MODE="660", GROUP="games"
# Set joystick device priority
KERNEL=="js*", SUBSYSTEM=="input", ATTRS{name}=="Logitech Logitech Extreme 3D", NAME="input/js0"
KERNEL=="js*", SUBSYSTEM=="input", ATTRS{name}=="Logitech WingMan Cordless Gamepad", NAME="input/js1"
KERNEL=="js*", SUBSYSTEM=="input", ATTRS{name}=="Logitech Logitech USB Keyboard", NAME="input/js9 |
The first couple of lines is to make sure the devices are usable by my user account. The last set is where the magic (used to) happen: it remaps my joystick to always be js0, my gamepad to always be js1, my keyboard that I really don't care about from a joystick perspective to always be js9, just to get it out the way, etc. Have a couple more in there for js2, etc., but I left them out for brevity.
However, since the udev-197 upgrade this no longer works. I can't find any error or warning messages in my logs, and the GROUP/MODE setting stuff does still work fine, so as far as I can tell this should still be valid, but nothing happens. My keyboard is now assigned js1, and my gamepad js2. I did verify that the device names haven't changed, and they have not.
Anyone know how I can make this work again? Is there some special new magic I need for udev-197?
Alternatively, is there any way to accomplish the same thing without relying to udev? That'd be fine as well, but I spent quite a while looking into this a couple years ago and udev was the only real option I could find.
Would greatly appreciate any pointers. Thanks. _________________ https://www.legroom.net/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PaulBredbury Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/15669254994381f44a81f83.jpg)
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Tue Mar 12, 2013 12:22 pm Post subject: |
|
|
Don't redefine js[0-9]*. It's the same with eth0 and eth1 that the Internet is filled with moans about
Use meaningful names, via SYMLINK+= or NAME:=
E.g. in /etc/udev/rules.d/10-local.rules
Code: | KERNEL=="js[0-9]*", SUBSYSTEM=="input", ATTRS{name}=="Logitech Logitech Extreme 3D", NAME:="input/js-extreme" |
That "10" in the filename is important, so that the NAME gets assigned here first, and is tagged as unchangeable using ":". |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nitro322 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Final Fantasy/Final_Fantasy_6_-_Sabin.jpg)
Joined: 24 Jul 2002 Posts: 596 Location: USA
|
Posted: Tue Apr 02, 2013 2:02 am Post subject: |
|
|
Hi, Paul. Thanks for the reply. Sorry this is coming back so late, but I somehow managed to miss your reply (which is a shame, because this has become even more of a nuisance in the past month).
I tried your suggestion (even copy/pasting your example below to ensure I wasn't mistyping), but unfortunately I'm still not able to rename any of the devices. I get the same behavior - udev just complete ignores my settings now. I also did moved the joystick stuff to 10-local.rules as you suggested.
I did some more searching a few weeks ago and stumbled across an alternate way of identifying devices. Instead of:
KERNEL=="js[0-9]*", SUBSYSTEM=="input", ATTRS{name}=="Logitech Logitech Extreme 3D", NAME:="input/js-extreme"
I can supposedly use:
KERNEL=="js[p-9]*", ENV{ID_VENDOR}=="Logitech", ENV{ID_MODEL}=="Logitech_Extreme_3D", NAME:="input/js-joystick"
Again, though, I get no luck with that.
Do you have any other ideas? or am I (hopefully) just doing something obviously wrong?
Also, related, do you have any suggestions on how to usefully debug udev? I did some searching on this, but all I could find here was:
1. Setting udev_log="debug" in /etc/udev/udev.conf, but that seems to have no effect at all.
2. Setting udev_monitor="yes" in /etc/conf.d/udev, but that doesn't seem to provide any useful info. It has a couple things about input, but nothing at all related to my joystick devices that I can find.
3. Setting udev_debug="yes" in the same file, but that's entirely useless. only showing this:
Code: | $ cat /run/udevdebug.log
error: /dev/sde: No medium found
error: /dev/sdf: No medium found
error: /dev/sdg: No medium found
<SNIP> |
and repeating a few times.
Is there some way to tell why udev is rejecting or ignoring or just simply not seeing my joystick rules? Would greatly appreciate any further guidance you can provide.
Thanks. _________________ https://www.legroom.net/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PaulBredbury Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/15669254994381f44a81f83.jpg)
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Tue Apr 02, 2013 3:37 am Post subject: |
|
|
Should be 0-9, without a p
Get some info to create a udev matching rule with:
Code: | udevadm info -a --name /dev/js0 |
For udev debugging - to turn on and back off (although I doubt you'll want/need it):
Code: | udevadm control --log-priority=debug
udevadm control --log-priority=err |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|