How to make RetroArch listening to multiple udev devices

Hi to everyone, I’m new here and it has been almost 2 weeks since I had the problem I’m going to describe. Questo testo verrà nascosto I’ve a Raspberry Pi zero W and as keyboard and mouse, a composite device (a mini wireless combo keyboard+mouse).

As raspi image, I’ve loaded a pre-made image with the latest version of RetroPie : v4.5.1.

I was happy at the beginning of my installation since Emulation Station recognized my composite device and I was able to map my keys. The real problem appeared when I tried a SNES game and then all emulators. Retroarch seemed not able to recognize some of the keys previously mapped in Emulation Station.

After a bit of debugging I’m now able to tell the problem here. I ran an evtest to check what was happening and the composite device is recognized as a keyboard “/dev/input/event0” and as a mouse “/dev/input/event1”. Nothing bad you may think but taking a look at the button mapping this is the result:

In the picture, keys inside the green curve are from /dev/input/event0 (keyboard) and the keys inside the red one are from /dev/input/event1 (mouse).

At first I tried to remap successfully the keys from mouse to letters using udev and keycodes:

key_volumedown -> b

key_volumeup -> x

key_home -> y

Restarting the system, Emulation Station recognize the keys as I remapped them but retroarch seems listening to one device at time. This means that all keyboard keys can be mapped but it’s not the same for mouse buttons.

I know that the fastest solution is to buy a decent controller but now it’s a matter of principle.

Is there a way to make mouse and keyboard act as one device in order to make Retroarch able to map keys from keyboard and mouse at the same time?

May a possible solution be to use VJoy or XBOXDRV?

Best Regards.