diff --git a/ChangeLog b/ChangeLog index 70021ed..aeec7af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,3 +37,8 @@ 1.2.4 * Turns out that the newer G15's have a different (5 byte) keyboard protocol. * Optimise dumpPixmapIntoLCDFormat routine - Thanks to Adam Nielsen +1.2.5 +* Remove 5BYTE_RETURN flag and process key packets based on length. Please + report any regressions. +* Add Solaris detection and remove locks if detected. Solaris' libUSB + blocks on read, forcing mutexes causes writes to block too. diff --git a/Makefile.in b/Makefile.in index 4faaa9a..efbfc3b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -33,6 +33,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -196,7 +197,11 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ +target = @target@ target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LLIBDIR = @LIBDIR@ diff --git a/config.h.in b/config.h.in index 5b58bd1..a5f3b1c 100644 --- a/config.h.in +++ b/config.h.in @@ -39,6 +39,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_USB_H +/* Define if libusb implementation blocks on read or write */ +#undef LIBUSB_BLOCKS + +/* Target OS is Darwin */ +#undef OSTYPE_DARWIN + +/* Target OS is Linux */ +#undef OSTYPE_LINUX + +/* Target OS is Solaris */ +#undef OSTYPE_SOLARIS + /* Name of package */ #undef PACKAGE @@ -60,6 +72,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 for Sun version of libusb. */ +#undef SUN_LIBUSB + /* Version number of package */ #undef VERSION diff --git a/configure b/configure index 402fec9..b1d1147 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for libg15 1.2.4. +# Generated by GNU Autoconf 2.61 for libg15 1.2.5. # # Report bugs to . # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libg15' PACKAGE_TARNAME='libg15' -PACKAGE_VERSION='1.2.4' -PACKAGE_STRING='libg15 1.2.4' +PACKAGE_VERSION='1.2.5' +PACKAGE_STRING='libg15 1.2.5' PACKAGE_BUGREPORT='mlampard@users.sourceforge.net' ac_default_prefix=/usr @@ -807,6 +807,18 @@ LIBS build_alias host_alias target_alias +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA @@ -845,14 +857,6 @@ AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os SED GREP EGREP @@ -1392,7 +1396,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libg15 1.2.4 to adapt to many kinds of systems. +\`configure' configures libg15 1.2.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,12 +1461,13 @@ Program names: System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libg15 1.2.4:";; + short | recursive ) echo "Configuration of libg15 1.2.5:";; esac cat <<\_ACEOF @@ -1564,7 +1569,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libg15 configure 1.2.4 +libg15 configure 1.2.5 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1578,7 +1583,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libg15 $as_me 1.2.4, which was +It was created by libg15 $as_me 1.2.5, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1963,6 +1968,133 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + am__api_version='1.10' # Find a good install program. We prefer a C program (faster), @@ -2269,7 +2401,7 @@ fi # Define the identity of the package. PACKAGE='libg15' - VERSION='1.2.4' + VERSION='1.2.5' cat >>confdefs.h <<_ACEOF @@ -3581,89 +3713,6 @@ else fi -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - { echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } if test "${lt_cv_path_SED+set}" = set; then @@ -4317,7 +4366,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4320 "configure"' > conftest.$ac_ext + echo '#line 4369 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7059,11 +7108,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7062: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7111: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7066: \$? = $ac_status" >&5 + echo "$as_me:7115: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7349,11 +7398,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7352: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7401: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7356: \$? = $ac_status" >&5 + echo "$as_me:7405: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7453,11 +7502,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7456: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7505: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7460: \$? = $ac_status" >&5 + echo "$as_me:7509: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8966,7 +9015,7 @@ linux* | k*bsd*-gnu) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8969 "configure"' > conftest.$ac_ext + echo '#line 9018 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9823,7 +9872,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12398: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12353: \$? = $ac_status" >&5 + echo "$as_me:12402: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12450,11 +12499,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12453: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12502: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12457: \$? = $ac_status" >&5 + echo "$as_me:12506: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12956,7 +13005,7 @@ linux* | k*bsd*-gnu) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12959 "configure"' > conftest.$ac_ext + echo '#line 13008 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14036,11 +14085,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14039: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14088: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14043: \$? = $ac_status" >&5 + echo "$as_me:14092: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14140,11 +14189,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14143: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14192: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14147: \$? = $ac_status" >&5 + echo "$as_me:14196: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15581,7 +15630,7 @@ linux* | k*bsd*-gnu) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15584 "configure"' > conftest.$ac_ext + echo '#line 15633 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16352,11 +16401,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16355: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16404: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16359: \$? = $ac_status" >&5 + echo "$as_me:16408: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16642,11 +16691,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16645: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16694: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16649: \$? = $ac_status" >&5 + echo "$as_me:16698: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16746,11 +16795,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16749: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16798: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16753: \$? = $ac_status" >&5 + echo "$as_me:16802: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18207,7 +18256,7 @@ linux* | k*bsd*-gnu) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 18210 "configure"' > conftest.$ac_ext + echo '#line 18259 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -19425,6 +19474,119 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +case $host_os in + *linux*) + +cat >>confdefs.h <<\_ACEOF +#define OSTYPE_LINUX 1 +_ACEOF + + ;; + *darwin*) + +cat >>confdefs.h <<\_ACEOF +#define OSTYPE_DARWIN 1 +_ACEOF + + ;; + *solaris*) + +cat >>confdefs.h <<\_ACEOF +#define OSTYPE_SOLARIS 1 +_ACEOF + + { echo "$as_me:$LINENO: checking for library containing nanosleep" >&5 +echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6; } +if test "${ac_cv_search_nanosleep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char nanosleep (); +int +main () +{ +return nanosleep (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +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_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_nanosleep=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_nanosleep+set}" = set; then + break +fi +done +if test "${ac_cv_search_nanosleep+set}" = set; then + : +else + ac_cv_search_nanosleep=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5 +echo "${ECHO_T}$ac_cv_search_nanosleep" >&6; } +ac_res=$ac_cv_search_nanosleep +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +cat >>confdefs.h <<\_ACEOF +#define SUN_LIBUSB 1 +_ACEOF + + libusb_blocks=true + ;; +esac # Checks for libraries. @@ -19497,6 +19659,14 @@ echo "$as_me: error: \"libusb not found. please install it\"" >&2;} fi +if test "x$libusb_blocks" == "xtrue"; then + +cat >>confdefs.h <<\_ACEOF +#define LIBUSB_BLOCKS 1 +_ACEOF + +fi + # Checks for header files. { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } @@ -20586,7 +20756,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libg15 $as_me 1.2.4, which was +This file was extended by libg15 $as_me 1.2.5, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20639,7 +20809,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libg15 config.status 1.2.4 +libg15 config.status 1.2.5 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -20855,6 +21025,18 @@ LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim @@ -20893,14 +21075,6 @@ AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim SED!$SED$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim @@ -20911,10 +21085,6 @@ RANLIB!$RANLIB$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim -CXXDEPMODE!$CXXDEPMODE$ac_delim -am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim -am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -20956,6 +21126,10 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +ac_ct_CXX!$ac_ct_CXX$ac_delim +CXXDEPMODE!$CXXDEPMODE$ac_delim +am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim +am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim @@ -20965,7 +21139,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 11; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index 9363d7b..ae06382 100644 --- a/configure.in +++ b/configure.in @@ -2,9 +2,11 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(libg15, 1.2.4, mlampard@users.sourceforge.net) +AC_INIT(libg15, 1.2.5, mlampard@users.sourceforge.net) AC_PREFIX_DEFAULT(/usr) AC_CONFIG_AUX_DIR(config) +AC_CANONICAL_TARGET() + AM_INIT_AUTOMAKE() AC_CONFIG_SRCDIR([libg15.c]) AC_CONFIG_HEADER([config.h]) @@ -13,9 +15,29 @@ AC_CONFIG_HEADER([config.h]) AC_PROG_CC AC_PROG_LIBTOOL +case $host_os in + *linux*) + AC_DEFINE([OSTYPE_LINUX], [1],[Target OS is Linux]) + ;; + *darwin*) + AC_DEFINE([OSTYPE_DARWIN], [1],[Target OS is Darwin]) + ;; + *solaris*) + AC_DEFINE([OSTYPE_SOLARIS], [1],[Target OS is Solaris]) + AC_SEARCH_LIBS([nanosleep],rt,[],[],[]) + AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of libusb.]) + libusb_blocks=true + ;; +esac + # Checks for libraries. AC_CHECK_LIB([usb], [main], ,AC_MSG_ERROR(["libusb not found. please install it"])) +dnl Some versions of libusb do not honour timeout and block. Suns' version is one of them. +if test "x$libusb_blocks" == "xtrue"; then + AC_DEFINE([LIBUSB_BLOCKS], [1],[Define if libusb implementation blocks on read or write]) +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([string.h]) diff --git a/debian/changelog b/debian/changelog index 1b6214b..17ebc8e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libg15 (1.2.5-1) unstable; urgency=low + + * New upstream release + + -- Giacomo Catenazzi Wed, 09 Jan 2008 08:06:33 +0100 + libg15 (1.2.4-1) unstable; urgency=low * New upstream release diff --git a/debian/control b/debian/control index 08159af..0fa7b27 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.3 Package: libg15-1 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends} Description: Library for interfacing with the Logitech G15 keyboards libg15 provides an API for low level control of the LCD display and the extra keys on some Logitech keyboards (G11, G15) diff --git a/debian/rules b/debian/rules index 820a87d..dbc36fa 100755 --- a/debian/rules +++ b/debian/rules @@ -5,4 +5,4 @@ DEB_DH_MAKESHLIBS_ARGS_libg15 := --version-info include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk - +DEB_CONFIGURE_EXTRA_FLAGS = --quiet diff --git a/libg15.c b/libg15.c index d127b44..fddfe59 100644 --- a/libg15.c +++ b/libg15.c @@ -12,12 +12,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with g15lcd; if not, write to the Free Software + along with libg15; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - (c) 2006 - 2007 The G15tools Project - g15tools.sf.net + (c) 2006-2007 The G15tools Project - g15tools.sf.net - $Revision: 270 $ - $Date: 2007-11-25 15:32:03 +1030 (Sun, 25 Nov 2007) $ $Author: mlampard $ + $Revision: 278 $ - $Date: 2008-01-02 14:26:25 +1030 (Wed, 02 Jan 2008) $ $Author: mlampard $ */ #include @@ -27,6 +27,7 @@ #include #include #include +#include "config.h" static usb_dev_handle *keyboard_device = 0; static int libg15_debugging_enabled = 0; @@ -38,14 +39,13 @@ static int g15_keys_endpoint = 0; static int g15_lcd_endpoint = 0; static pthread_mutex_t libusb_mutex; - /* to add a new device, simply create a new DEVICE() in this list */ /* Fields are: "Name",VendorID,ProductID,Capabilities */ const libg15_devices_t g15_devices[] = { DEVICE("Logitech G15",0x46d,0xc222,G15_LCD|G15_KEYS), DEVICE("Logitech G11",0x46d,0xc225,G15_KEYS), DEVICE("Logitech Z-10",0x46d,0x0a07,G15_LCD|G15_KEYS|G15_DEVICE_IS_SHARED), - DEVICE("Logitech G15 v2",0x46d,0xc227,G15_LCD|G15_KEYS|G15_DEVICE_5BYTE_RETURN), + DEVICE("Logitech G15 v2",0x46d,0xc227,G15_LCD|G15_KEYS), DEVICE(NULL,0,0,0) }; @@ -301,7 +301,13 @@ int initLibG15() retval = initLibUsb(); if (retval) return retval; - + + g15_log(stderr,G15_LOG_INFO,"%s\n",PACKAGE_STRING); + +#ifdef SUN_LIBUSB + g15_log(stderr,G15_LOG_INFO,"Using Sun libusb.\n"); +#endif + g15NumberOfConnectedDevices(); keyboard_device = findAndOpenG15(); @@ -317,8 +323,10 @@ int exitLibG15() { int retval = G15_NO_ERROR; if (keyboard_device){ +#ifndef SUN_LIBUSB retval = usb_release_interface (keyboard_device, 0); usleep(50*1000); +#endif #if 0 retval = usb_reset(keyboard_device); usleep(50*1000); @@ -411,6 +419,7 @@ static void dumpPixmapIntoLCDFormat(unsigned char *lcd_buffer, unsigned char con } int handle_usb_errors(const char *prefix, int ret) { + switch (ret){ case -ETIMEDOUT: return G15_ERROR_READING_USB_DEVICE; /* backward-compatibility */ @@ -425,7 +434,7 @@ int handle_usb_errors(const char *prefix, int ret) { case -EAGAIN: /* try again */ case -EFBIG: /* too many frames to handle */ case -EMSGSIZE: /* msgsize is invalid */ - g15_log(stderr,G15_LOG_INFO,"usb error: %s (%i)\n",prefix,ret); + g15_log(stderr,G15_LOG_INFO,"usb error: %s %s (%i)\n",prefix,usb_strerror(),ret); break; case -EPIPE: /* endpoint is stalled */ g15_log(stderr,G15_LOG_INFO,"usb error: %s EPIPE! clearing...\n",prefix); @@ -434,7 +443,7 @@ int handle_usb_errors(const char *prefix, int ret) { pthread_mutex_unlock(&libusb_mutex); break; default: /* timed out */ - g15_log(stderr,G15_LOG_INFO,"Unknown usb error: %s !! (err is %i)\n",prefix,ret); + g15_log(stderr,G15_LOG_INFO,"Unknown usb error: %s !! (err is %i (%s))\n",prefix,ret,usb_strerror()); } return ret; } @@ -461,7 +470,9 @@ int writePixmapToLCD(unsigned char const *data) I'm not sure how successful this will be in combatting ENOSPC, but we'll give it try in the real-world. */ if(enospc_slowdown != 0){ +#ifndef LIBUSB_BLOCKS pthread_mutex_lock(&libusb_mutex); +#endif for(transfercount = 0;transfercount<=31;transfercount++){ ret = usb_interrupt_write(keyboard_device, g15_lcd_endpoint, (char*)lcd_buffer+(32*transfercount), 32, 1000); if (ret != 32) @@ -471,12 +482,18 @@ int writePixmapToLCD(unsigned char const *data) } usleep(100); } +#ifndef LIBUSB_BLOCKS pthread_mutex_unlock(&libusb_mutex); +#endif }else{ /* transfer entire buffer in one hit */ +#ifdef LIBUSB_BLOCKS + ret = usb_interrupt_write(keyboard_device, g15_lcd_endpoint, (char*)lcd_buffer, G15_BUFFER_LEN, 1000); +#else pthread_mutex_lock(&libusb_mutex); ret = usb_interrupt_write(keyboard_device, g15_lcd_endpoint, (char*)lcd_buffer, G15_BUFFER_LEN, 1000); pthread_mutex_unlock(&libusb_mutex); +#endif if (ret != G15_BUFFER_LEN) { handle_usb_errors ("LCDPixmap Write",ret); @@ -593,7 +610,7 @@ static unsigned char g15KeyToLogitechKeyCode(int key) } } -static void processKeyEvent8Byte(unsigned int *pressed_keys, unsigned char *buffer) +static void processKeyEvent9Byte(unsigned int *pressed_keys, unsigned char *buffer) { int i; @@ -749,31 +766,26 @@ int getPressedKeys(unsigned int *pressed_keys, unsigned int timeout) { unsigned char buffer[9]; int ret = 0; +#ifdef LIBUSB_BLOCKS + ret = usb_interrupt_read(keyboard_device, g15_keys_endpoint, (char*)buffer, 9, timeout); +#else pthread_mutex_lock(&libusb_mutex); ret = usb_interrupt_read(keyboard_device, g15_keys_endpoint, (char*)buffer, 9, timeout); pthread_mutex_unlock(&libusb_mutex); - - if(g15DeviceCapabilities() & G15_DEVICE_5BYTE_RETURN) { /* new 5byte protocol */ - if (buffer[0] == 1) - return G15_ERROR_TRY_AGAIN; - if (ret == 5) { - - processKeyEvent5Byte(pressed_keys, buffer); - - return G15_NO_ERROR; - } - } - else - { - if (ret == 9) - { - if (buffer[0] == 1) - return G15_ERROR_TRY_AGAIN; +#endif + if(ret>0) { + if(buffer[0] == 1) + return G15_ERROR_TRY_AGAIN; + } - processKeyEvent8Byte(pressed_keys, buffer); - + switch(ret) { + case 5: + processKeyEvent5Byte(pressed_keys, buffer); + return G15_NO_ERROR; + case 9: + processKeyEvent9Byte(pressed_keys, buffer); return G15_NO_ERROR; - } + default: + return handle_usb_errors("Keyboard Read", ret); /* allow the app to deal with errors */ } - return handle_usb_errors("Keyboard Read", ret); /* allow the app to deal with errors */ } diff --git a/libg15.h b/libg15.h index 99a9f5f..63f46f0 100644 --- a/libg15.h +++ b/libg15.h @@ -17,7 +17,7 @@ (c) 2006 - 2007 The G15tools Project - g15tools.sf.net - $Revision: 266 $ - $Date: 2007-11-25 13:32:23 +1030 (Sun, 25 Nov 2007) $ $Author: mlampard $ + $Revision: 273 $ - $Date: 2007-11-25 17:14:21 +1030 (Sun, 25 Nov 2007) $ $Author: mlampard $ */ #ifndef _LIBG15_H_ @@ -31,7 +31,6 @@ extern "C" #define G15_LCD 1 #define G15_KEYS 2 #define G15_DEVICE_IS_SHARED 4 -#define G15_DEVICE_5BYTE_RETURN 8 typedef struct libg15_devices_t libg15_devices_t; diff --git a/rpm/libg15.spec b/rpm/libg15.spec index ecd36cd..e389292 100644 --- a/rpm/libg15.spec +++ b/rpm/libg15.spec @@ -3,11 +3,11 @@ %define prefix /usr Summary: library to control logitech G15 keyboards Name: libg15 -Version: 1.2.4 +Version: 1.2.5 Release: 1 Copyright: GPL Group: Applications/System -Source: http://prdownloads.sourceforge.net/g15tools/libg15-1.2.4.tar.bz2 +Source: http://prdownloads.sourceforge.net/g15tools/libg15-1.2.5.tar.bz2 URL: http://sourceforge.net/projects/g15tools Distribution: Linux Vendor: NONE