Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Updated Linux joystick code to support hotplug, GUIDs, etc.

This uses libudev for hotplug, but it's optional, so we'll just try to find
 some reasonable defaults without it (maybe an older Linux box or under
 FreeBSD's Linux emulation?).
  • Loading branch information
icculus committed Dec 11, 2012
1 parent 0a130b7 commit 9df023d803966f60d7dbe6ef1ccf1356edf99c30
Showing with 534 additions and 149 deletions.
  1. +3 −1 CMakeLists.txt
  2. +17 −0 configure.in
  3. +1 −0 include/SDL_config.h.cmake
  4. +1 −0 include/SDL_config.h.in
  5. +508 −143 src/joystick/linux/SDL_sysjoystick.c
  6. +4 −5 src/joystick/linux/SDL_sysjoystick_c.h
@@ -648,7 +648,9 @@ if(UNIX AND NOT APPLE)
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
set(HAVE_SDL_HAPTIC TRUE)
endif(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
endif(LINUX

check_include_file("libudev.h" HAVE_LIBUDEV_H)
endif(LINUX)

if(INPUT_TSLIB)
check_c_source_compiles("
@@ -1667,6 +1667,22 @@ CheckInputEvents()
fi
}

dnl See if the platform offers libudev for device enumeration and hotplugging.
CheckLibUDev()
{
AC_ARG_ENABLE(libudev,
AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
, enable_libudev=yes)
if test x$enable_libudev = xyes; then
AC_CHECK_HEADER(libudev.h,
have_libudev_h_hdr=yes,
have_libudev_h_hdr=no)
if test x$have_libudev_h_hdr = xyes; then
AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
fi
fi
}

dnl See if we can use the Touchscreen input library
CheckTslib()
{
@@ -2191,6 +2207,7 @@ case "$host" in
CheckFusionSound
CheckOpenGLX11
CheckOpenGLESX11
CheckLibUDev
CheckInputEvents
CheckTslib
CheckUSBHID
@@ -65,6 +65,7 @@
#cmakedefine HAVE_SIGNAL_H 1
#cmakedefine HAVE_ALTIVEC_H 1
#cmakedefine HAVE_PTHREAD_NP_H 1
#cmakedefine HAVE_LIBUDEV_H 1

/* C library functions */
#cmakedefine HAVE_MALLOC 1
@@ -70,6 +70,7 @@
#undef HAVE_SIGNAL_H
#undef HAVE_ALTIVEC_H
#undef HAVE_PTHREAD_NP_H
#undef HAVE_LIBUDEV_H

/* C library functions */
#undef HAVE_MALLOC

0 comments on commit 9df023d

Please sign in to comment.