aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorendolf <[email protected]>2005-05-08 09:58:31 +0000
committerendolf <[email protected]>2005-05-08 09:58:31 +0000
commit093c179997b7ab42667c9d050d86e83ccad758fe (patch)
tree7851594c35b4ae0a200a4997da70c4ea9397379b
parent8329b4675a3018682d0c6416e7845fc034bb9dd3 (diff)
Will try to open the device for read/write first, if that fails, trys
read only and displays a message about not being enabled for force feedback git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@92 e343933a-64c8-49c5-92b1-88f2ce3e89e8
-rw-r--r--plugins/linux/src/native/EventDevice.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/linux/src/native/EventDevice.cpp b/plugins/linux/src/native/EventDevice.cpp
index 64ac8cb..10428b1 100644
--- a/plugins/linux/src/native/EventDevice.cpp
+++ b/plugins/linux/src/native/EventDevice.cpp
@@ -40,13 +40,21 @@ EventDevice::EventDevice(char *deviceFileName) {
char tempName[Device::MAX_NAME_LENGTH-1] = "Unknown";
int i;
- fd = open(deviceFileName, O_RDONLY | O_NONBLOCK);
+ fd = open(deviceFileName, O_RDWR | O_NONBLOCK);
if(fd<0) {
- /*char errorMessage[512];
- sprintf(errorMessage, "Error opening device %s\n", deviceFileName);
- perror(errorMessage);*/
- inited = 0;
- return;
+
+ char errorMessage[512];
+ sprintf(errorMessage, "Error opening device %s read/write, Force Feedback disabled for this device\n", deviceFileName);
+ perror(errorMessage);
+
+ fd = open(deviceFileName, O_RDONLY | O_NONBLOCK);
+ if(fd<0) {
+ /*char errorMessage[512];
+ sprintf(errorMessage, "Error opening device %s\n", deviceFileName);
+ perror(errorMessage);*/
+ inited = 0;
+ return;
+ }
}
if(ioctl(fd, EVIOCGNAME(sizeof(tempName)), tempName) < 0) {