diff -up ./.gitignore.fedora ./.gitignore --- ./.gitignore.fedora 2013-11-12 11:30:03.000000000 -0500 +++ ./.gitignore 2014-06-01 18:21:35.911632579 -0400 @@ -1,3 +1,11 @@ +*~ +Release/ +/Source/DoxyGen/html +/Platform/Linux/Bin +/Platform/Linux/CreateRedist/Final +/Platform/Linux/CreateRedist/Output +/Platform/Linux/Redist +/Platform/Linux/Build x64-Release Manifest.txt Platform/Linux/CreateRedist/Final diff -up ./Platform/Linux/Build/Modules/nimCodecs/Makefile.fedora ./Platform/Linux/Build/Modules/nimCodecs/Makefile --- ./Platform/Linux/Build/Modules/nimCodecs/Makefile.fedora 2014-06-01 18:21:35.912632616 -0400 +++ ./Platform/Linux/Build/Modules/nimCodecs/Makefile 2014-06-01 18:23:56.634016624 -0400 @@ -2,16 +2,22 @@ BIN_DIR = ../../../Bin INC_DIRS = \ ../../../../../Include \ - ../../../../../Source \ - ../../../../../Externals/LibJPEG + ../../../../../Source SRC_FILES = \ - ../../../../../Source/Modules/nimCodecs/*.cpp \ - ../../../../../Externals/LibJPEG/*.c + ../../../../../Source/Modules/nimCodecs/*.cpp LIB_NAME = nimCodecs USED_LIBS = OpenNI +ifneq ($(wildcard /usr/lib/libjpeg.so /usr/lib32/libjpeg.so /usr/lib64/libjpeg.so /usr/local/lib/libjpeg.so /usr/local/lib32/libjpeg.so /usr/local/lib64/libjpeg.so),) + USED_LIBS += jpeg +else + INC_DIRS += ../../../../../Source/External/LibJPEG + SRC_FILES += ../../../../../Source/External/LibJPEG/*.c +endif + + include ../../Common/CommonCppMakefile diff -up ./Platform/Linux/Build/OpenNI/Makefile.fedora ./Platform/Linux/Build/OpenNI/Makefile --- ./Platform/Linux/Build/OpenNI/Makefile.fedora 2013-11-12 11:30:03.000000000 -0500 +++ ./Platform/Linux/Build/OpenNI/Makefile 2014-06-01 18:24:57.078466204 -0400 @@ -4,13 +4,11 @@ BIN_DIR = ../../Bin INC_DIRS = \ ../../../../Include \ - ../../../../Source \ - ../../../../Externals/TinyXml + ../../../../Source SRC_FILES = \ ../../../../Source/OpenNI/*.cpp \ - ../../../../Source/OpenNI/Linux/*.cpp \ - ../../../../Externals/TinyXml/*.cpp + ../../../../Source/OpenNI/Linux/*.cpp ifeq ("$(OSTYPE)","Darwin") INC_DIRS += /opt/local/include @@ -25,6 +23,14 @@ ifneq ("$(OSTYPE)","Darwin") endif DEFINES = XN_EXPORTS +ifneq ($(wildcard /usr/include/tinyxml.h /usr/local/include/tinyxml.h),) + USED_LIBS += tinyxml +else + INC_DIRS += ../../../../Source/External/TinyXml + SRC_FILES += ../../../../Source/External/TinyXml/*.cpp +endif + + include ../Common/CommonCppMakefile diff -up ./Platform/Linux/CreateRedist/install.sh.fedora ./Platform/Linux/CreateRedist/install.sh --- ./Platform/Linux/CreateRedist/install.sh.fedora 2013-11-12 11:30:03.000000000 -0500 +++ ./Platform/Linux/CreateRedist/install.sh 2014-06-01 18:21:51.388203971 -0400 @@ -8,6 +8,8 @@ Installs OpenNI to current machine. Installs OpenNI (default mode) -u,--uninstall Uninstalls OpenNI. +-n,--noregister + Do not (un)register the modules -c,--cross-compile-rootfs Used for cross-compiling. Installs OpenNI to instead of '/'. -h,--help @@ -45,6 +47,9 @@ while [ "$1" ]; do -u|--uninstall) uninstall=yes ;; + -n|--noregister) + register=no + ;; -c|--cross-staging-dir) shift rootfs=$1 @@ -71,11 +76,22 @@ if [ "$install" = yes ] && [ "$uninstall exit 1 fi -INSTALL_LIB=$rootfs/usr/lib -INSTALL_BIN=$rootfs/usr/bin -INSTALL_INC=$rootfs/usr/include/ni -INSTALL_VAR=$rootfs/var/lib/ni -INSTALL_JAR=$rootfs/usr/share/java + +if [ -z "$INSTALL_LIB" ]; then + INSTALL_LIB=$rootfs/usr/lib +fi +if [ -z "$INSTALL_BIN" ]; then + INSTALL_BIN=$rootfs/usr/bin +fi +if [ -z "$INSTALL_INC" ]; then + INSTALL_INC=$rootfs/usr/include/ni +fi +if [ -z "$INSTALL_VAR" ]; then + INSTALL_VAR=$rootfs/usr/etc/ni +fi +if [ -z "$INSTALL_JAR" ]; then + INSTALL_JAR=$rootfs/usr/share/java +fi # make all calls into OpenNI run in this filesystem export OPEN_NI_INSTALL_PATH=$rootfs @@ -86,6 +102,12 @@ if [ "$install" = yes ]; then printf "Installing OpenNI\n" printf "****************************\n\n" + mkdir -p $INSTALL_LIB + mkdir -p $INSTALL_BIN + mkdir -p $INSTALL_INC + mkdir -p $INSTALL_VAR + mkdir -p $INSTALL_JAR + # copy libraries printf "copying shared libraries..." cp $LIB_FILES $INSTALL_LIB @@ -107,17 +129,21 @@ if [ "$install" = yes ]; then mkdir -p $INSTALL_VAR printf "OK\n" - # register modules - for module in $MODULES; do - printf "registering module '$module'..." - $INSTALL_BIN/niReg -r $INSTALL_LIB/$module - printf "OK\n" - done + if [ "$register" = yes ]; then + # register modules + for module in $MODULES; do + printf "registering module '$module'..." + $INSTALL_BIN/niReg -r $INSTALL_LIB/$module + printf "OK\n" + done + fi - # mono - if [ -f $rootfs/usr/bin/gmcs -a -f Bin/OpenNI.net.dll ]; then - printf "Installing .Net wrappers...\n" - gacutil -i Bin/OpenNI.net.dll -package 2.0 $GACDIR + if [ "$register" = yes ]; then + # mono + if [ -f $rootfs/usr/bin/gmcs -a -f Bin/OpenNI.net.dll ]; then + printf "Installing .Net wrappers...\n" + gacutil -i Bin/OpenNI.net.dll -package 2.0 $GACDIR + fi fi # java wrappers @@ -135,13 +161,15 @@ elif [ "$uninstall" = yes ]; then printf "Uninstalling OpenNI\n" printf "****************************\n\n" - # unregister modules - for module in $MODULES; do - printf "unregistering module '$module'..." - if $INSTALL_BIN/niReg -u $INSTALL_LIB/$module; then - printf "OK\n" - fi - done + if [ "$register" = yes ]; then + # unregister modules + for module in $MODULES; do + printf "unregistering module '$module'..." + if $INSTALL_BIN/niReg -u $INSTALL_LIB/$module; then + printf "OK\n" + fi + done + fi # include files printf "removing include files..." @@ -162,12 +190,13 @@ elif [ "$uninstall" = yes ]; then done printf "OK\n" - # mono - if [ -f $rootfs/usr/bin/gmcs -a -f Bin/OpenNI.net.dll ]; then - printf "Removing .Net wrappers...\n" - gacutil -u OpenNI.net $GACDIR + if [ "$register" = yes ]; then + # mono + if [ -f $rootfs/usr/bin/gmcs -a -f Bin/OpenNI.net.dll ]; then + printf "Removing .Net wrappers...\n" + gacutil -u OpenNI.net $GACDIR + fi fi - # java printf "removing java bindings..." for filename in $JAR_FILES; do diff -up ./Source/OpenNI/Linux/XnUSBLinux.cpp.fedora ./Source/OpenNI/Linux/XnUSBLinux.cpp --- ./Source/OpenNI/Linux/XnUSBLinux.cpp.fedora 2013-11-12 11:30:03.000000000 -0500 +++ ./Source/OpenNI/Linux/XnUSBLinux.cpp 2014-06-01 18:21:51.389204009 -0400 @@ -398,6 +398,16 @@ XN_C_API XnStatus xnUSBOpenDeviceImpl(li return (XN_STATUS_USB_SET_CONFIG_FAILED); } */ + // detach any active kernel driver, code extracted from libfreenect + rc = libusb_kernel_driver_active(handle, 0); + if (rc == 1) { + rc = libusb_detach_kernel_driver(handle, 0); + if (rc != 0) + { + libusb_close(handle); + return (XN_STATUS_USB_SET_INTERFACE_FAILED); + } + } // claim the interface (you cannot open any end point before claiming the interface) rc = libusb_claim_interface(handle, 0); if (rc != 0) @@ -518,7 +528,7 @@ XN_C_API XnStatus xnUSBCloseDevice(XN_US { return (XN_STATUS_USB_DEVICE_CLOSE_FAILED); } - + rc = libusb_attach_kernel_driver(pDevHandle->hDevice, 0); libusb_close(pDevHandle->hDevice); XN_FREE_AND_NULL(pDevHandle); diff -up ./Wrappers/OpenNI.jni/jni.h.fedora ./Wrappers/OpenNI.jni/jni.h --- ./Wrappers/OpenNI.jni/jni.h.fedora 2013-11-12 11:30:03.000000000 -0500 +++ ./Wrappers/OpenNI.jni/jni.h 2014-06-01 18:21:51.390204045 -0400 @@ -182,7 +182,7 @@ typedef enum _jobjectType { typedef struct { const char *name; const char *signature; - void *fnPtr; + const void *fnPtr; } JNINativeMethod; /*