Lines 1-48
Link Here
|
1 |
--- src/js/jsBSD.cxx.orig Wed Jan 12 02:22:26 2005 |
|
|
2 |
+++ src/js/jsBSD.cxx Wed Dec 7 10:35:27 2005 |
3 |
@@ -44,6 +44,8 @@ |
4 |
#define HAVE_USB_JS 1 |
5 |
#endif |
6 |
|
7 |
+#include <string.h> |
8 |
+#include <errno.h> |
9 |
#include <sys/ioctl.h> |
10 |
#if defined(__FreeBSD__) |
11 |
# include <sys/joystick.h> |
12 |
@@ -312,7 +314,7 @@ |
13 |
int buttons [ _JS_MAX_AXES ] ; |
14 |
|
15 |
rawRead ( buttons, axes ) ; |
16 |
- error = axes[0] < -1000000000.0f ; |
17 |
+ error = axes[0] < -1000000000.0f && axes[1] < -1000000000.0f ; |
18 |
if ( error ) |
19 |
return ; |
20 |
|
21 |
@@ -321,7 +323,11 @@ |
22 |
joyfile = fopen ( joyfname, "r" ) ; |
23 |
error = ( joyfile == NULL ) ; |
24 |
if ( error ) |
25 |
+ { |
26 |
+ ulSetError ( UL_WARNING, "unable to open calibration file %s (%s), joystick %i disabled (you can generate the calibration file with the plib-jscal utility)", |
27 |
+ joyfname, strerror ( errno ), id + 1 ); |
28 |
return ; |
29 |
+ } |
30 |
|
31 |
noargs = fscanf ( joyfile, "%d%f%f%f%f%f%f", &in_no_axes, |
32 |
&min [ 0 ], ¢er [ 0 ], &max [ 0 ], |
33 |
@@ -445,8 +451,13 @@ |
34 |
|
35 |
if ( axes != NULL ) |
36 |
{ |
37 |
- axes[0] = (float) os->ajs.x ; |
38 |
- axes[1] = (float) os->ajs.y ; |
39 |
+ if ( os->ajs.x >= -1000000000 ) |
40 |
+ os->cache_axes[0] = os->ajs.x; |
41 |
+ if ( os->ajs.y >= -1000000000 ) |
42 |
+ os->cache_axes[1] = os->ajs.y; |
43 |
+ |
44 |
+ axes[0] = os->cache_axes[0]; |
45 |
+ axes[1] = os->cache_axes[1]; |
46 |
} |
47 |
|
48 |
return; |