I’m using USB controller adapters for SNES and PSX controllers. Each one has a single USB connection and two controller input ports.
The good thing about these is that both ports on each device are recognized whether there is a controller plugged into it or not. So, upon startup, js0, js1, js2, and js3 are assigned to them automatically.
The bad thing is that the jsx name assignments are not always consistent. Sometimes the SNES adapter gets js0 and js1, and other times it gets assigned js2 and js3. This obviously makes it difficult when specifying controllers with input_player1_joypad_index in the emulator-specific retroarch.cfg file.
To solve the problem, I created UDEV rules that assign consistent jsx names. Inspiration was taken from this thread: http://ubuntuforums.org/showthread.php?t=1595666&p=9974813#post9974813
And I refined it to assign unique numbers to devices with identical ID_VENDOR and ID_MODEL values (as is the case with the two ports on each adapter) with a related solution on StackExchange here: http://unix.stackexchange.com/a/105218/125793
My udev rules are as follows…
KERNEL=="js?", ENV{ID_VENDOR}=="HuiJia", ENV{ID_MODEL}=="USB_GamePad", IMPORT{program}="/usr/local/bin/unique-num /run/miner-counter 6 SNES_NUM", NAME+="input/js$env{SNES_NUM}"
KERNEL=="js?", ENV{ID_VENDOR}=="WiseGroup._Ltd", ENV{ID_MODEL}=="MP-8866_Dual_USB_Joypad", IMPORT{program}="/usr/local/bin/unique-num /run/miner-counter2 8 PSX_NUM", NAME+="input/js$env{PSX_NUM}"
My SNES controller adapter ports (ID_VENDOR=”HuiJia”) are successfully named js6 and js7. They are listed in /dev/input, and I am able to test them with jstest.
I have specified these joypads in /opt/retropie/configs/snes/retroarch.cfg…
input_player1_joypad_index = "6"
input_player2_joypad_index = "7"
All that said, they do not work. I can only assume that it is because the joypad index that retroarch uses looks at something different, perhaps the true path, maybe? …
(this is from udevadm info -q all -n /dev/input/js7)
/devices/platform/bcm2708_usb/ … /input/input/input4/js4
I really don’t know. I’m pretty much at a stopping point here, after putting a lot of hours into figuring out how to get the udev name assignments working, which i assumed would do the trick based off of the example i saw (first link). But perhaps, that author had not tested to see if it actually did work.
Also, I’m not sure if this is related, but I do get an IOError upon exiting the emulator. It reads “IOError: [Errno 13] Permission denied: ‘/dev/input/js0′. Could this be related?
Thanks for any guidance you can provide. I’ve spent a lot of time researching and learning–and don’t mind doing even more to solve the problem–but I am way beyond my pay grade at this point, LOL. Ay help is greatly appreciated!