Update of /cvsroot/plib/plib/src/js
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3131
Modified Files:
Makefile.am jsBSD.cxx
Log Message:
Adding Jean-Yves Lefort's patches (e-mail from Jean-Yves Lefort, 12/7/05, 4:36 AM). Note the "FIXME" line in the "Makefile.am" file.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/plib/plib/src/js/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 4 Jan 2003 02:55:53 -0000 1.10
+++ Makefile.am 5 Jan 2006 21:21:54 -0000 1.11
@@ -1,5 +1,10 @@
if BUILD_JS
+# FIXME set the UL_BSD conditional using AM_CONDITIONAL in configure.ac
+if UL_BSD
+bin_PROGRAMS = plib-jscal
+plib_jscal_SOURCES = jsBSDCal.c
+endif
lib_LIBRARIES = libplibjs.a
include_HEADERS = js.h
Index: jsBSD.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/js/jsBSD.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- jsBSD.cxx 12 Jan 2005 01:22:26 -0000 1.6
+++ jsBSD.cxx 5 Jan 2006 21:21:55 -0000 1.7
@@ -44,6 +44,8 @@
#define HAVE_USB_JS 1
#endif
+#include <string.h>
+#include <errno.h>
#include <sys/ioctl.h>
#if defined(__FreeBSD__)
# include <sys/joystick.h>
@@ -312,7 +314,7 @@
int buttons [ _JS_MAX_AXES ] ;
rawRead ( buttons, axes ) ;
- error = axes[0] < -1000000000.0f ;
+ error = axes[0] < -1000000000.0f && axes[1] < -1000000000.0f ;
if ( error )
return ;
@@ -321,7 +323,11 @@
joyfile = fopen ( joyfname, "r" ) ;
error = ( joyfile == NULL ) ;
if ( error )
+ {
+ ulSetError ( UL_WARNING, "unable to open calibration file %s (%s), joystick %i disabled (you can generate the calibration file with the plib-jscal utility)",
+ joyfname, strerror ( errno ), id + 1 );
return ;
+ }
noargs = fscanf ( joyfile, "%d%f%f%f%f%f%f", &in_no_axes,
&min [ 0 ], ¢er [ 0 ], &max [ 0 ],
@@ -445,8 +451,13 @@
if ( axes != NULL )
{
- axes[0] = (float) os->ajs.x ;
- axes[1] = (float) os->ajs.y ;
+ if ( os->ajs.x >= -1000000000 )
+ os->cache_axes[0] = os->ajs.x;
+ if ( os->ajs.y >= -1000000000 )
+ os->cache_axes[1] = os->ajs.y;
+
+ axes[0] = os->cache_axes[0];
+ axes[1] = os->cache_axes[1];
}
return;
|