|
From: <mla...@us...> - 2006-11-05 13:48:15
|
Revision: 99
http://svn.sourceforge.net/g15daemon/?rev=99&view=rev
Author: mlampard
Date: 2006-11-05 05:48:04 -0800 (Sun, 05 Nov 2006)
Log Message:
-----------
add compiletime checks for uinput version
Modified Paths:
--------------
trunk/g15daemon/config.h.in
trunk/g15daemon/configure
trunk/g15daemon/configure.in
trunk/g15daemon/g15daemon/g15_uinput.c
Modified: trunk/g15daemon/config.h.in
===================================================================
--- trunk/g15daemon/config.h.in 2006-11-04 17:55:32 UTC (rev 98)
+++ trunk/g15daemon/config.h.in 2006-11-05 13:48:04 UTC (rev 99)
@@ -78,6 +78,9 @@
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
+/* Define if struct uinput_user_dev has id member. */
+#undef HAVE_UINPUT_USER_DEV_ID
+
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
Modified: trunk/g15daemon/configure
===================================================================
--- trunk/g15daemon/configure 2006-11-04 17:55:32 UTC (rev 98)
+++ trunk/g15daemon/configure 2006-11-05 13:48:04 UTC (rev 99)
@@ -21866,7 +21866,154 @@
done
+#if HAVE_LINUX_UINPUT_H
+ { echo "$as_me:$LINENO: checking for struct uinput_user_dev.id" >&5
+echo $ECHO_N "checking for struct uinput_user_dev.id... $ECHO_C" >&6; }
+if test "${ac_cv_member_struct_uinput_user_dev_id+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+ #include <linux/input.h>
+ #include <linux/uinput.h>
+
+
+
+int
+main ()
+{
+static struct uinput_user_dev ac_aggr;
+if (ac_aggr.id)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_uinput_user_dev_id=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <linux/input.h>
+ #include <linux/uinput.h>
+
+
+
+int
+main ()
+{
+static struct uinput_user_dev ac_aggr;
+if (sizeof ac_aggr.id)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_uinput_user_dev_id=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_uinput_user_dev_id=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_uinput_user_dev_id" >&5
+echo "${ECHO_T}$ac_cv_member_struct_uinput_user_dev_id" >&6; }
+if test $ac_cv_member_struct_uinput_user_dev_id = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINPUT_USER_DEV_ID 1
+_ACEOF
+
+fi
+
+ #endif
+
# Checks for typedefs, structures, and compiler characteristics.
{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
Modified: trunk/g15daemon/configure.in
===================================================================
--- trunk/g15daemon/configure.in 2006-11-04 17:55:32 UTC (rev 98)
+++ trunk/g15daemon/configure.in 2006-11-05 13:48:04 UTC (rev 99)
@@ -30,6 +30,18 @@
#include <linux/input.h>
#endif
])
+#if HAVE_LINUX_UINPUT_H
+ dnl check for uinput.h version 2.4 or 2.6 ?
+ AC_CHECK_MEMBER([struct uinput_user_dev.id],
+ [AC_DEFINE(HAVE_UINPUT_USER_DEV_ID, 1,
+ [Define if struct uinput_user_dev has id member.])],,
+ [
+ #include <linux/input.h>
+ #include <linux/uinput.h>
+ ]
+ )
+ dnl end of uinput version checks
+#endif
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
Modified: trunk/g15daemon/g15daemon/g15_uinput.c
===================================================================
--- trunk/g15daemon/g15daemon/g15_uinput.c 2006-11-04 17:55:32 UTC (rev 98)
+++ trunk/g15daemon/g15daemon/g15_uinput.c 2006-11-05 13:48:04 UTC (rev 99)
@@ -66,8 +66,14 @@
memset(&uinp,0,sizeof(uinp));
strncpy(uinp.name, "G15 Extra Keys", UINPUT_MAX_NAME_SIZE);
+
+#ifdef HAVE_UINPUT_USER_DEV_ID
uinp.id.version = 4;
uinp.id.bustype = BUS_USB;
+#else
+ uinp.idversion = 4;
+ uinp.idbus = BUS_USB;
+#endif
ioctl(uinp_fd, UI_SET_EVBIT, EV_KEY);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|