Ok, I did some investigation... It seems the point of being able to configure joysitck devices at all boils down to an SDL compile configuration problem...
My joystick devices (limited to the said analog stick for simplicity):
| |
| lrwxrwxrwx 1 root root 9 Jan 1 1980 /dev/input/by-id/usb-Padix_Co._Ltd._2-axis_4button_joystick_w_view_finder_rudder-event-joystick -> ../event1 |
| lrwxrwxrwx 1 root root 6 Jan 1 1980 /dev/input/by-id/usb-Padix_Co._Ltd._2-axis_4button_joystick_w_view_finder_rudder-joystick -> ../js0 |
I.e. /dev/input/js0
and /dev/input/event1
repectively.
Lets see which devices SDL programs use by default with sdl-jstest
and sdl2-jstest
:
| |
| total 0 |
| lrwx------ 1 root root 64 Oct 31 16:16 0 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:16 1 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:16 2 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:16 3 -> /dev/fb0 |
| lrwx------ 1 root root 64 Oct 31 16:16 4 -> /dev/tty4 |
| lrwx------ 1 root root 64 Oct 31 16:16 5 -> /dev/input/mice |
| lr-x------ 1 root root 64 Oct 31 16:16 6 -> /dev/input/event1 |
| |
| |
| |
| |
| total 0 |
| lrwx------ 1 root root 64 Oct 31 16:19 0 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 1 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 2 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 3 -> /dev/vchiq |
| lrwx------ 1 root root 64 Oct 31 16:19 4 -> socket:[9440] |
| lr-x------ 1 root root 64 Oct 31 16:19 5 -> /dev/input/event2 |
| lr-x------ 1 root root 64 Oct 31 16:19 6 -> /dev/input/event0 |
| lr-x------ 1 root root 64 Oct 31 16:19 7 -> /dev/input/mouse0 |
| lrwx------ 1 root root 64 Oct 31 16:19 8 -> /dev/tty1 |
| lr-x------ 1 root root 64 Oct 31 16:19 9 -> /dev/input/event1 |
Both use the raw event device /dev/input/event1
as joystick device. Now you can override this by setting the environment variable export SDL_JOYSTICK_DEVICE=/dev/input/js0
:
| |
| |
| total 0 |
| lrwx------ 1 root root 64 Oct 31 16:21 0 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:21 1 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:21 2 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:21 3 -> /dev/fb0 |
| lrwx------ 1 root root 64 Oct 31 16:21 4 -> /dev/tty4 |
| lrwx------ 1 root root 64 Oct 31 16:21 5 -> /dev/input/mice |
| lr-x------ 1 root root 64 Oct 31 16:21 6 -> /dev/input/js0 |
It uses the configured device, great, so for SDL1 this works.
| |
| |
| total 0 |
| lrwx------ 1 root root 64 Oct 31 16:19 0 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 1 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 2 -> /dev/pts/0 |
| lrwx------ 1 root root 64 Oct 31 16:19 3 -> /dev/vchiq |
| lrwx------ 1 root root 64 Oct 31 16:19 4 -> socket:[9440] |
| lr-x------ 1 root root 64 Oct 31 16:19 5 -> /dev/input/event2 |
| lr-x------ 1 root root 64 Oct 31 16:19 6 -> /dev/input/event0 |
| lr-x------ 1 root root 64 Oct 31 16:19 7 -> /dev/input/mouse0 |
| lrwx------ 1 root root 64 Oct 31 16:19 8 -> /dev/tty1 |
| lr-x------ 1 root root 64 Oct 31 16:19 9 -> /dev/input/event1 |
However, unfortunately it doesn't work for SDL2, it keeps using /dev/input/event1
.
The problem: Dosbox as compiled for Recalbox uses SDL2, and thus ignores the env variable and keeps opening the first raw event devices 
(Retropie for instance uses SDL1, that's why it works there).
| |
| 1163 root /usr/bin/dosbox -userconf -exit /recalbox/share/roms/dos/wing2.pc/dosbox.bat -c set ROOT=/recalbox/share/roms/dos/wing2.pc -conf /recalbox/share/system/configs/dosbox/dosbox.conf |
| |
| |
| ... SDL_JOYSTICK_DEVICE=/dev/input/js0... |
| |
| |
| lr-x------ 1 root root 64 Oct 31 16:27 11 -> /dev/input/event1 |
| |
| |
| 76be4000-76cc5000 r-xp 00000000 b3:0b 39837 /usr/lib/libSDL2-2.0.so.0.4.0 |
I didn't find any other possibility to convince SDL2 programs to use a different device. The only thing I found is that there seems to be a compile time option to use the real joystick devices by default instead of raw event devices. Even if, not sure if that would enable the env variable to actually allow selecting them. Or maybe there is another compile option for this?
(Btw: this is most likely also the reason why your configured deadzones are not picked up by dosbox: you configure the joystick driver devices js* with jscal, but dosbox/SDL uses the raw event devices.)