The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
custom uinput device : events are not received by SDL ?!
jit


Joined: 31 Jan 2017
Posts: 3
Hello,

I'm facing a problem since a few days and I can't manage to correct it... I hope that this forum is the good one.
I'm using an odroid C1 (http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143703355573) for a portable gaming system. I created a small program that simulates a gamepad using GPIO and uinput.

My program creates standard linux input devices (/dev/input/event3 and /dev/input/js0) and works correctly with non SDL softwares (eg: hurrican, astromenace, etc.).
Another proof that it works correctly is that I had to add the following lines in my Xorg.conf to avoid my "virtual" gamepad's analog stick to move the mouse cursor:

Code:

Section "InputClass"
        Identifier "joystick catchall"
        MatchIsJoystick "on"
        MatchDevicePath "/dev/input/event*"
        Driver "joystick"
        Option "StartKeysEnabled" "False"       #Disable mouse
        Option "StartMouseEnabled" "False"      #support
EndSection



But for all SDL based applications (eg: rvgl, testing tools like controllerpad), the gamepad is well seen by applications, but when I select it, it does nothing (eg: no event received).
Something more strange is that with the official SDL testing tools (tests/controllerpad.c), when I launch it, I can select my gamepad (eg: "controllerpad 0"), the program give all gamepad infos (2 axis, 11 buttons), but the program react on keyboard and mouse event and not on my gamepad events !

I'm a debian jessie, SDL2 under Xorg, and I also have a touchscreen and wireless keyboard + mouse plugged througt usb ports.

My first impression is that there could be something with Xorg that do some routing with events... or some udev rules...or somehting even simpler to activate with SDL... ?

Here is what udevadm give with my "virtual" gamepad activated :
Code:

udevadm info --path=/sys/class/input/event3
P: /devices/virtual/input/input5/event3
N: input/event3
E: DEVNAME=/dev/input/event3
E: DEVPATH=/devices/virtual/input/input5/event3
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_SERIAL=noserial
E: MAJOR=13
E: MINOR=67
E: SUBSYSTEM=input
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=875998655


Any suggestion and help would be greatly appreciated ! Wink[/url][/code]
jit


Joined: 31 Jan 2017
Posts: 3
I just tried another SDL joystick test tool :sdl2-jstest from https://github.com/Grumbel/sdl-jstest

the output of sdl2-jstest -l is :

Code:
Found 1 joystick(s)

Joystick Name:     'retrogear-joypad'
Joystick GUID:     03000000010000000100000001000000
Joystick Number:    0
Number of Axes:     2
Number of Buttons: 11
Number of Hats:     0
Number of Balls:    0
GameController:
  not a gamepad


when I use the display event mode (sdl2-jstest -e 0), I can see every axis and buttons responding correctly...

I still not understand why games are not receiving events from my controller Sad
jit


Joined: 31 Jan 2017
Posts: 3
Problem resolved ! I had to run a windows manager (eg: blackbox) (I only had a xterm to launch commands)