FS#67174 - [sdl2] enable HIDAPI joystick drivers

Attached to Project: Arch Linux
Opened by Alexandre Bouvier (doskoi) - Thursday, 02 July 2020, 06:23 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 04 November 2020, 00:32 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

* SDL include HIDAPI support for low level joystick drivers
* For example the Official GameCube Controller Adapter for Wii U is supported in every app using SDL>=2.0.12 without needing an external driver like https://github.com/ToadKing/wii-u-gc-adapter (thanks to https://www.indiegogo.com/projects/wii-u-switch-gamecube-adapter-support-for-sdl2)
* Adding -DHIDAPI=ON to the cmake command doesn't seems to enable anything sadly
* It's working by reverting to configure: ../configure --prefix=/usr --disable-static --enable-sdl-dlopen --disable-arts --disable-esd --disable-nas --enable-alsa --enable-pulseaudio-shared --enable-video-wayland --disable-rpath --enable-clock_gettime --enable-jack-shared --enable-hidapi

For information the SDL wiki (https://wiki.libsdl.org/Installation) says: "An (experimental!) alternative to the configure script is the CMake project file. [...] Driving that is left as an exercise for the reader."
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Wednesday, 04 November 2020, 00:32 GMT
Reason for closing:  Implemented
Comment by Alexandre Bouvier (doskoi) - Thursday, 02 July 2020, 06:41 GMT
This needs adding libusb in makedepends too.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 02 July 2020, 23:16 GMT
Check sdl2-2.0.12-2, it should have support for hidapi.
Comment by Alexandre Bouvier (doskoi) - Friday, 03 July 2020, 08:55 GMT
It's working with RetroArch, but now many sdl2 apps are just crashing:

mame[454932]: segfault at 0 ip 0000000000000000 sp 00007ffe6f04c2d8 error 14 in mame[55b423826000+2a8e000]
Code: Bad RIP value.

blobby[455085]: segfault at 0 ip 0000000000000000 sp 00007ffc7ad88c08 error 14 in blobby[55dbe9bd8000+1e4000]
Code: Bad RIP value.

I recompiled sdl2-jstest against the new sdl2 build but it still crash the same way:

sdl2-jstest[458856]: segfault at 0 ip 0000000000000000 sp 00007ffdcce7cf88 error 14 in sdl2-jstest[5582acd1c000+2000]
Code: Bad RIP value.

There was no crash when I compiled sdl2 with the configure command.
Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 03 July 2020, 10:09 GMT
Can reproduce. Posted upstream bug: https://bugzilla.libsdl.org/show_bug.cgi?id=5222
Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 03 July 2020, 10:10 GMT
Is there any chance you can try to find out why it crashes when built with CMake but not when built with autotools?
Comment by Alexandre Bouvier (doskoi) - Friday, 03 July 2020, 14:27 GMT
I have no idea how to investigate that :$

namcap output for the cmake package:

sdl2 W: Dependency glibc included but already satisfied
sdl2 W: Dependency included and not needed ('libxext')
sdl2 W: Dependency included and not needed ('libxrender')
sdl2 W: Dependency included and not needed ('libx11')
sdl2 W: Dependency included and not needed ('libxcursor')
sdl2 W: Dependency included and not needed ('libibus')
sdl2 W: Dependency included and not needed ('hidapi')

namcap output for the configure package:

sdl2 W: Unused shared library '/usr/lib/librt.so.1' by file ('usr/lib/libSDL2-2.0.so.0.12.0')
sdl2 W: Dependency glibc included but already satisfied
sdl2 W: Dependency included and not needed ('libxext')
sdl2 W: Dependency included and not needed ('libxrender')
sdl2 W: Dependency included and not needed ('libx11')
sdl2 W: Dependency included and not needed ('libxcursor')
sdl2 W: Dependency included and not needed ('libibus')
sdl2 W: Dependency included and not needed ('hidapi')
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 04 July 2020, 03:30 GMT
Since apparently it's somthing abouve how this is built, I'd start with simply looking at the exact compile output differences. With autotools, you can do make VERBOSE=1 and with ninja you can do VERBOSE=1 ninja and just compare the files compiled and see whether there are obvious differences.
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 06 July 2020, 10:38 GMT
Somebody posted a patch and so I built and tested it and it seems fine. Pushed to testing. Give me some feedback after testing and I'll move it to extra.
Comment by Alexandre Bouvier (doskoi) - Monday, 06 July 2020, 14:06 GMT
Well, applications don't crash anymore, but the joystick is not detected either. It still works fine in RetroArch however (never crashed in the first place and joystick detected).
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 06 July 2020, 15:09 GMT
Can you become active in the SDL2 bug report since you can replicate the joystick detection problem? Maybe you can help figure it out with upstream.
Comment by Alexandre Bouvier (doskoi) - Wednesday, 08 July 2020, 01:19 GMT
I can try, but they will tell me to use configure I guess :p
Why you don't use it by the way? It seems to be the "official" way.
Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 10 July 2020, 22:59 GMT
Well, they do officially offer cmake support so I suppose they shouldn't be opposed to providing support for it. I don't use it because I find that while cmake isn't great, autotools is way worse from a user perspective. This is also the first time I encountered such a problem and I might change if they recommend I do so but I'd prefer if we could get this fixed upstream in SDL2 instead of ignoring the difference.
Comment by Beau Brueggemann (robot-beethoven) - Monday, 24 August 2020, 05:56 GMT
This most recent package update has broken my PS4 controller (and maybe other controllers, haven't tried them yet). The symptoms are bizarre: the controller mostly works, but moving either analog stick in a diagonal direction causes a spurious disconnect event to fire for that controller.
Comment by Sven-Hendrik Haase (Svenstaro) - Wednesday, 04 November 2020, 00:32 GMT
I'll close this now as we now do have HIDAPI support. Please take implementation problems up to upstream.

Loading...