libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.28k stars 1.83k forks source link

linuxraw: The linuxraw controller driver connects the mouse instead of the joypad in GNU/Linux virtual machines #16898

Open davidhedlund opened 2 months ago

davidhedlund commented 2 months ago

Description

The linuxraw controller driver connects the mouse instead of the joypad in GNU/Linux virtual machines. The mouse device is known as "spice vdagent tablet" in QEMU.

This issue affects all joypads, not just the Nintendo Switch Pro Controller as described below. Also, note that Ubuntu MATE 24.04 does not support the Nintendo Switch Pro Controller with jstest, only the Sony DualSense is supported. Consequently, I am using Ubuntu 23.04 to avoid potential bottleneck issues. Both controllers can be configured using either sdl2 or udev in both Ubuntu MATE 23.03, and 24.04.

Expected behavior

linuxraw/Nintendo Switch Pro Controller.cfg

input_driver = "linuxraw"
input_device = "Nintendo Switch Pro Controller"
...

Actual behavior

Issue 2: "spice vdagent tablet" is still used despite that I previously selected "Nintendo Switch Pro Controller".

linuxraw/Nintendo Switch Pro Controller.cfg

input_driver = "linuxraw"
input_device = "spice vdagent tablet"
input_up_axis = "-5"

Steps to reproduce the bug

In GNU/Linux:

In the Ubuntu MATE 23.04 virtual machine

In RetroArch:

  1. Open RetroArch.
  2. Change the Controller Directory (standard procedure).
  3. Navigate to Settings -> Drivers -> Controller.
  4. Select "linuxraw", and restart RetroArch

image

Version/Commit

Additional details

zoltanvb commented 1 month ago

The "spice" device is provided by the virtualization environment. There seems to be no suitable class for controllers: https://www.spice-space.org/vd-interfaces.html It is still a bit weird why controller is not found as a second device. I assume USB connections are forwarded to the virtual machine, since SDL and udev works.

davidhedlund commented 1 month ago

Rebooting into different distributions just to assess Linuxraw autoconfigs is quite time-consuming. When this issue is solved it will be possible to evaluate them using virtual machines is significantly faster which enhance the likelihood of having Linuxraw autoconfigs uploaded to GitHub.

The "spice" device is provided by the virtualization environment. There seems to be no suitable class for controllers: https://www.spice-space.org/vd-interfaces.html It is still a bit weird why controller is not found as a second device. I assume USB connections are forwarded to the virtual machine, since SDL and udev works.

Thank you for bringing this to my attention. Could you please submit a feature request and share the link here?

davidhedlund commented 1 month ago

The "spice" device is provided by the virtualization environment. There seems to be no suitable class for controllers: https://www.spice-space.org/vd-interfaces.html It is still a bit weird why controller is not found as a second device. I assume USB connections are forwarded to the virtual machine, since SDL and udev works.

The SPICE device produced an output, but it shouldn't have since I selected the controller in the Device Index. Additionally, I discovered that in virtual machines, you need to run jstest /dev/input/js1 instead of js0, which is used in standard GNU/Linux installations. I revised my entire initial post after discovering that Ubuntu MATE 24.04 didn't recognize the controller with jstest, aiming to prevent bottleneck issues.

Please review the updated top post. I'm pleased to report that half of the issue has been resolved!