[Plib-cvs] plib/src/js js.h,1.32,1.33 jsLinux.cxx,1.5,1.6 jsLinuxOld.cxx,1.3,1.4
Brought to you by:
sjbaker
From: Wolfram K. <wol...@us...> - 2004-10-20 23:49:42
|
Update of /cvsroot/plib/plib/src/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14981 Modified Files: js.h jsLinux.cxx jsLinuxOld.cxx Log Message: Changes by Mathias Froehlich, see his mail on plib-devel from Date: Mon, 18 Oct 2004 21:19:04 +0200 Index: js.h =================================================================== RCS file: /cvsroot/plib/plib/src/js/js.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- js.h 21 Sep 2004 11:45:55 -0000 1.32 +++ js.h 20 Oct 2004 23:49:33 -0000 1.33 @@ -23,6 +23,7 @@ #ifndef __INCLUDED_JS_H__ #define __INCLUDED_JS_H__ 1 +#define JS_NEW #include "ul.h" Index: jsLinux.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/js/jsLinux.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- jsLinux.cxx 21 Sep 2004 11:45:55 -0000 1.5 +++ jsLinux.cxx 20 Oct 2004 23:49:33 -0000 1.6 @@ -23,9 +23,12 @@ #include "js.h" -#if defined (UL_LINUX) && defined (JS_NEW) +#if defined (UL_LINUX) #include <linux/joystick.h> + +#if defined(JS_VERSION) && JS_VERSION >= 0x010000 + #include <sys/param.h> #include <fcntl.h> #include <sys/ioctl.h> @@ -75,6 +78,19 @@ if ( num_axes > _JS_MAX_AXES ) num_axes = _JS_MAX_AXES ; + // Remove any deadband value already done in the kernel. + // Since we have our own deadband management this is save to do so. + struct js_corr corr [ _JS_MAX_AXES ] ; + ioctl ( os->fd, JSIOCGCORR, corr ); + for ( int i = 0; i < num_axes ; ++i ) { + if ( corr[ i ] . type == JS_CORR_BROKEN ) { + int nodeadband = ( corr[ i ] . coef[ 0 ] + corr[ i ] . coef[ 1 ] ) / 2 ; + corr[ i ] . coef[ 0 ] = nodeadband ; + corr[ i ] . coef[ 1 ] = nodeadband ; + } + } + ioctl ( os->fd, JSIOCSCORR, corr ); + for ( int i = 0 ; i < _JS_MAX_AXES ; i++ ) { max [ i ] = 32767.0f ; @@ -180,3 +196,4 @@ } #endif +#endif Index: jsLinuxOld.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/js/jsLinuxOld.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- jsLinuxOld.cxx 21 Sep 2004 11:45:55 -0000 1.3 +++ jsLinuxOld.cxx 20 Oct 2004 23:49:33 -0000 1.4 @@ -23,11 +23,14 @@ #include "js.h" -#if defined (UL_LINUX) && !defined (JS_NEW) +#if defined (UL_LINUX) + +#include <linux/joystick.h> + +#if !defined(JS_VERSION) || JS_VERSION >= 0x010000 #include <fcntl.h> #include <sys/ioctl.h> -#include <linux/joystick.h> struct os_specific_s { JS_DATA_TYPE js ; @@ -140,3 +143,4 @@ void jsInit() {} #endif +#endif |