libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.71k stars 1.64k forks source link

SDL_INPUT consumes controller DEV || MANJARO #8279

Open LeannAlexandra opened 9 months ago

LeannAlexandra commented 9 months ago

issue: SDL grabs input and removes it from being findable in manjaro kde (running kernel 6.1.53-1 for reference) An app I am using uses SDL to grab/hook input from gamepads and controllers - it is mGBA-qt 0.10.2-2 ( installed from pamac (the add remove software gui package manager with kde). to be clear: the level of joypad grabbing is great - however my issue is niche. It hides my device from my other programs (one that monitors the device) and it does not return my device back to me - which is necessary for my function. to be clear this does not happen will all apps, - something like RetroArch allows all my devices to coexist harmoniously.

[edit] I have raised the issue with mGBA, and they directed me here as they say the input is grabbed from SDL

steps to reproduce

desired outcome:

extra information:

What will I do with it: currently i am working of a program to simulate multiple virtual devices github and with this I wish to create an XOR and a NAND filter for controllers for people who want to play together in a different way without mutilating any other code or breaking any other function.

To Contact me, reply here.

slouken commented 8 months ago

It sounds like your SDL is built with libusb enabled. Can you build it yourself from source and see if you still get the same problem?

slouken commented 6 months ago

We're releasing SDL 2.30 soon and haven't heard back, so I'm going ahead and closing this for now. Feel free to add more information and reopen it if you're still having this issue.

PhenaOfMari commented 1 month ago

Hi there, I came across this issue when looking into a related issue on my own system. From what I've found the source of my issue is that Arch packages SDL2 with the SDL_HIDAPI_LIBUSB flag on primarily due to gamecube controllers. In the course of my research, I also found that some work was done for SDL3 to use a libusb whitelist when a platform backend exists.

Is it possible for these changes, or something along similar lines, to be ported down to SDL2? I've confirmed this to be causing issues for me both while using an input overlay plugin for obs via AUR packages, as well as even just launching any program with Wine. I don't currently have a frame of reference for how soon SDL3 with have a release, but even if it is as soon as tomorrow, there is no telling how long it will take these things that use it to update.

slouken commented 1 month ago

We have our hands full with SDL 3.0, but feel free to create a tested PR for this.

PhenaOfMari commented 1 month ago

In attempting to port the merge back onto SDL2 (which looks pretty straightforward imo), I seem to have run into an oddity in my build process I'm having trouble identifying. I appear to not have HAVE_PLATFORM_BACKEND defined..

On inspection in the initial cmake setup I'm finding this: -- SDL_LIBUDEV (Wanted: ON): OFF

If I'm reading the code correctly, that would be ON if i have libudev and linux/input.h, and looking further above in the setup I see these:

-- Performing Test HAVE_LINUX_INPUT_H
-- Performing Test HAVE_LINUX_INPUT_H - Success
-- Looking for libudev.h
-- Looking for libudev.h - found
-- dynamic libudev -> libudev.so.1

Is there another condition I havent found? I'm still pretty new to doing this sort of thing so I'm half assuming I've overlooked something unintentionally.

madebr commented 1 month ago

The code is missing a set(HAVE_UDEV TRUE). This variable is only used for reporting.

PhenaOfMari commented 1 month ago

I realized the silly thing I had done that caused my confusion today. Pull request now available! https://github.com/libsdl-org/SDL/pull/9821