We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5335

Summary: Patch: enable joystick/haptic/evdev support by default on FreeBSD
Product: SDL Reporter: doctorwhoguy
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: iwtcex
Version: don't know   
Hardware: All   
OS: FreeBSD   
Attachments: patch for configure
FreeBSD compilation fix
FreeBSD compilation fix
avoid private headers

Description doctorwhoguy 2020-11-01 00:29:03 UTC
Created attachment 4491 [details]
patch for configure

Basically I'm just doing the legwork to submit a FreeBSD patch someone else wrote: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249874
Comment 1 Sam Lantinga 2020-11-12 03:31:37 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/635b76aa9290
Comment 2 Sam Lantinga 2020-11-12 03:51:12 UTC
SDL's evdev joystick support doesn't work on FreeBSD:
/buildbot/worker/SDL/sdl-freebsd-amd64/src/src/joystick/linux/SDL_sysjoystick.c:26:2: error: SDL now requires a Linux 2.4+ kernel with /dev/input/event support.
#error SDL now requires a Linux 2.4+ kernel with /dev/input/event support.
 ^
/buildbot/worker/SDL/sdl-freebsd-amd64/src/src/joystick/linux/SDL_sysjoystick.c:35:10: fatal error: 'sys/inotify.h' file not found
#include <sys/inotify.h>
         ^~~~~~~~~~~~~~~
Comment 3 Sam Lantinga 2020-11-12 03:51:33 UTC
Can you provide a working patch for FreeBSD?
Comment 4 Alex S 2020-11-22 09:09:42 UTC
Created attachment 4531 [details]
FreeBSD compilation fix
Comment 5 Alex S 2020-11-22 09:10:54 UTC
(In reply to Alex S from comment #4)
> Created attachment 4531 [details]
> FreeBSD compilation fix

Evdev headers aren't actually included in the base system (well, it has a private copy), they are available through the devel/evdev-proto port instead. We also have devel/libinotify and devel/libudev-devd shims, I didn't verify whether they work with SDL.
Comment 6 Alex S 2020-11-22 09:12:38 UTC
Created attachment 4532 [details]
FreeBSD compilation fix

(Not sure what happened to the previous attachment.)
Comment 7 Sam Lantinga 2020-11-24 05:09:01 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/2929659b559b
Comment 8 Alex S 2020-11-24 06:39:42 UTC
(In reply to Sam Lantinga from comment #7)
> Patch added, thanks!
> https://hg.libsdl.org/SDL/rev/2929659b559b

Ah, that's not quite enough. You need to:
  1. rename src/joystick/bsd/SDL_sysjoystick.c to something;
  2. regenerate configure.
Comment 9 Sam Lantinga 2020-11-24 07:04:17 UTC
Done!
https://hg.libsdl.org/SDL/rev/aab8e1ec22e4
Comment 10 Alex S 2020-11-24 08:23:31 UTC
Looks like we have a collision with https://hg.libsdl.org/SDL/rev/2e58bfc28b4e. (Again, the headers in the base system are intended for drivers and should not be used for compiling non-base applications. At least that's the policy for now: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240964#c19.) Do you need a patch reverting the changes?
Comment 11 Alex S 2020-11-24 10:25:08 UTC
Created attachment 4537 [details]
avoid private headers

> patch reverting the changes
Comment 12 Sam Lantinga 2020-11-24 14:43:35 UTC
Patch applied:
https://hg.libsdl.org/SDL/rev/718090fd68db

Does this mean that FreeBSD can't use this by default?
Comment 13 Alex S 2020-11-24 15:22:19 UTC
(In reply to Sam Lantinga from comment #12)
> Patch applied:
> https://hg.libsdl.org/SDL/rev/718090fd68db
> 
> Does this mean that FreeBSD can't use this by default?

I don't quite understand the question.