device: Support evdev gamepads on FreeBSD

This commit is contained in:
rdb 2021-04-05 17:14:30 +02:00
parent 73a2d29c39
commit 7be4b7c3bb
3 changed files with 7 additions and 2 deletions

View File

@ -960,6 +960,7 @@ if (COMPILER=="GCC"):
if (os.path.isdir("/usr/PCBSD")):
IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
SmartPkgEnable("INOTIFY", "libinotify", ("inotify"), "sys/inotify.h")
if GetTarget() != "windows":
PkgDisable("DIRECTCAM")
@ -2707,7 +2708,6 @@ def WriteConfigSettings():
dtool_config["IS_FREEBSD"] = '1'
dtool_config["PHAVE_ALLOCA_H"] = 'UNDEF'
dtool_config["PHAVE_MALLOC_H"] = 'UNDEF'
dtool_config["PHAVE_LINUX_INPUT_H"] = 'UNDEF'
dtool_config["HAVE_PROC_CURPROC_FILE"] = '1'
dtool_config["HAVE_PROC_CURPROC_MAP"] = '1'
dtool_config["HAVE_PROC_CURPROC_CMDLINE"] = '1'
@ -4478,7 +4478,7 @@ if (not RUNTIME):
OPTS=['DIR:panda/metalibs/panda', 'BUILDING:PANDA', 'JPEG', 'PNG', 'HARFBUZZ',
'TIFF', 'OPENEXR', 'ZLIB', 'OPENSSL', 'FREETYPE', 'FFTW', 'ADVAPI', 'WINSOCK2',
'SQUISH', 'NVIDIACG', 'VORBIS', 'OPUS', 'WINUSER', 'WINMM', 'WINGDI', 'IPHLPAPI',
'SETUPAPI']
'SETUPAPI', 'INOTIFY']
TargetAdd('panda_panda.obj', opts=OPTS, input='panda.cxx')

View File

@ -691,6 +691,7 @@ init_device() {
_rtrigger_code = -1;
}
#ifndef __FreeBSD__
char path[64];
char buffer[256];
const char *parent = "";
@ -728,6 +729,7 @@ init_device() {
}
fclose(f);
}
#endif
// Special-case fix for Xbox 360 Wireless Receiver: the Linux kernel
// driver always reports 4 connected gamepads, regardless of the number

View File

@ -134,6 +134,7 @@ consider_add_evdev_device(size_t ev_index) {
// having read permissions set, but doesn't export all of the features
// (notably, force feedback).
#ifndef __FreeBSD__
// We do this by checking for a js# directory inside the sysfs directory.
sprintf(path, "/sys/class/input/event%zd/device", ev_index);
@ -168,6 +169,8 @@ consider_add_evdev_device(size_t ev_index) {
}
closedir(dir);
#endif
return nullptr;
}