aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux/src/native/joystickInterface.cpp
diff options
context:
space:
mode:
authorendolf <[email protected]>2003-10-29 22:36:31 +0000
committerendolf <[email protected]>2003-10-29 22:36:31 +0000
commitc76a9122c20dd155b45d5d9b3dd2c25991afa134 (patch)
treec33b3547fca2d5f6ab4c959f97333b65d810071b /plugins/linux/src/native/joystickInterface.cpp
parenta5bbe6f39d743c92527925019748585527e204d1 (diff)
Added the logger macros so I don't have to keep manually adding the
statements back in every time something breaks Fixed a crash under linux if when it was thinking there was at least one more joystick that it really had, funnily enough when it tried to get data from this joystick, it all went bang. git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@56 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/linux/src/native/joystickInterface.cpp')
-rw-r--r--plugins/linux/src/native/joystickInterface.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/linux/src/native/joystickInterface.cpp b/plugins/linux/src/native/joystickInterface.cpp
index bfa4231..dc4f274 100644
--- a/plugins/linux/src/native/joystickInterface.cpp
+++ b/plugins/linux/src/native/joystickInterface.cpp
@@ -81,15 +81,19 @@ int jsInit() {
}
if ((fd = open(deviceFileNames[0], O_RDONLY)) <0) {
- return -1;
+ jsNumDevices = 0;
+ jsInited=1;
+ return 0;
}
if (ioctl(fd, JSIOCGVERSION, &joystickInterfaceVersion)) {
close(fd);
- return -1;
+ jsNumDevices = 0;
+ jsInited=1;
+ return 0;
}
- close(fd);
+ if(fd>=0) {close(fd);}
Device *tempDeviceList[numDeviceFiles];
@@ -109,9 +113,9 @@ int jsInit() {
for(i=0;i<jsNumDevices;i++) {
while(tempDeviceList[jsTempDeviceCount] == NULL) {
jsTempDeviceCount++;
- }
+ }
jsDeviceList[i] = tempDeviceList[jsTempDeviceCount];
- //printf("Copied joystick %d to %d\n", jsTempDeviceCount, i);
+ //printf("Copied joystick %d to %d\n", jsTempDeviceCount, i);
jsTempDeviceCount++;
}