Hi, I didn’t understand how assign the connected joypad to port when start retroarch. I would like to fix specific USB or bluetooth joypad to retroarch port when start. Is it possibile? I tried to verify the /dev/input/jsX to retroarch port but every time to disconnect and connect a bluetooth/USB the port order change even if the js number it’s the same. i.e. the device /dev/input/js0 is not always port #0 and so on. how reotroarch assign port number to joypad? Please, some one can I help me?
You might check out this: https://ubuntuforums.org/showthread.php?t=1595666
I’m not sure if it’ll solve your problem, but it’s worth checking out.
I watched but the post regard the jsX device on OS system only. I don’t understanding how retroarch assign own port number. Seems to be a match between OS jsX name device and retroarch port number.
RetroArch just assigns them to a port in the order the OS hands them to it. That is, the first pad it presents is port 1, second is port 2, etc.
Are you sure?...these are my logs:
TEST1:
/dev/input/js0 --> ATTRS{name}=="8Bitdo SNES30 GamePad"
/dev/input/js1 --> ATTRS{name}=="8Bitdo NES30 Arcade"
/dev/input/js2 --> ATTRS{name}=="Qanba Arcade Joystick D-2.4G"
[INFO] [udev]: Plugged pad: Qanba Arcade Joystick D-2.4G (3888:4406) on port #0.
[INFO] [udev]: Pad #0 (/dev/input/event15) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/Qanba Arcade Joystick D-2.4G.cfg
[INFO] [udev]: Plugged pad: 8Bitdo NES30 Arcade (11720:4225) on port #1.
[INFO] [udev]: Pad #1 (/dev/input/event7) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/8Bitdo NES30 Arcade.cfg
[INFO] [udev]: Plugged pad: 8Bitdo SNES30 GamePad (11720:10304) on port #2.
[INFO] [udev]: Pad #2 (/dev/input/event6) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/8Bitdo SNES30 GamePad.cfg
TEST2:
/dev/input/js0 --> ATTRS{name}=="Qanba Arcade Joystick D-2.4G"
/dev/input/js1 --> ATTRS{name}=="8Bitdo NES30 Arcade"
/dev/input/js2 --> ATTRS{name}=="8Bitdo SNES30 GamePad"
[INFO] [udev]: Plugged pad: Qanba Arcade Joystick D-2.4G (3888:4406) on port #0.
[INFO] [udev]: Pad #0 (/dev/input/event6) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/Qanba Arcade Joystick D-2.4G.cfg
[INFO] [udev]: Plugged pad: 8Bitdo SNES30 GamePad (11720:10304) on port #1.
[INFO] [udev]: Pad #1 (/dev/input/event15) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/8Bitdo SNES30 GamePad.cfg
[INFO] [udev]: Plugged pad: 8Bitdo NES30 Arcade (11720:4225) on port #2.
[INFO] [udev]: Pad #2 (/dev/input/event7) supports 0 force feedback effects.
[INFO] [Autoconf]: 5 profiles found.
[INFO] [Autoconf]: selected configuration: /home/mce/.config/retroarch/autoconfig/8Bitdo NES30 Arcade.cfg
[INFO] RetroArch 1.8.4 (Git d4a1f2ef85)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX
[INFO] Built: Jan 21 2020
[INFO] Version: 1.8.4
[INFO] Git: d4a1f2ef85
Yeah, it seems that despite having them as js0, js1, etc., it hands them to RetroArch in essentially random order.
I think I found a solution. The user @meleu made a little c code, I added a new line option inside the code and compiled.
Below the edited code:
/* jslist.c
* This little program just list the joysticks connected to the system.
* The ouput format is "index:JoystickName".
*
* Compile it with:
* [prompt]$ gcc jslist.c -o jslist $(sdl2-config --cflags --libs)
*/
#include <stdio.h>
#include "SDL.h"
int main(void) {
int num_joy, i;
SDL_Init(SDL_INIT_JOYSTICK);
num_joy = SDL_NumJoysticks();
for(i = 0; i < num_joy; i++)
printf("%d:%s\n", i, SDL_JoystickNameForIndex(i));
SDL_Quit();
return 0;
}
The output of the compilated code show me a same port number when retroarch start:
$ /usr/local/bin/jslist
0:Qanba Arcade Joystick D-2.4G
1:8Bitdo NES30 Arcade
2:8Bitdo SNES30 GamePad
I integrated the output code in a selection script and seems to work.
Next days I'll others tests because I want to test very well this job.
EXAMPLE
~$ /usr/local/bin/jslist
0:Qanba Arcade Joystick D-2.4G
1:8Bitdo SNES30 GamePad
2:8Bitdo NES30 Arcade
~$ for i in $(ls /dev/input/js*);do A=$(udevadm info -a --name $i|grep name);echo "$i --> $A"; done
/dev/input/js0 --> ATTRS{name}=="8Bitdo NES30 Arcade"
/dev/input/js1 --> ATTRS{name}=="8Bitdo SNES30 GamePad"
/dev/input/js2 --> ATTRS{name}=="Qanba Arcade Joystick D-2.4G"