Browse Source

device: Support evdev gamepads on FreeBSD

rdb 4 years ago
parent
commit
7be4b7c3bb

+ 2 - 2
makepanda/makepanda.py

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

+ 2 - 0
panda/src/device/evdevInputDevice.cxx

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

+ 3 - 0
panda/src/device/linuxInputDeviceManager.cxx

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