Open device with correct permissions immediately.
authorFlorian Pose <fp@igh-essen.com>
Tue, 10 Jun 2008 09:05:54 +0000
changeset 982 861eb2810f56
parent 981 5a2bd04c555c
child 983 efb947bd96f3
Open device with correct permissions immediately.
tools/Master.cpp
tools/Master.h
--- a/tools/Master.cpp	Tue Jun 10 08:54:54 2008 +0000
+++ b/tools/Master.cpp	Tue Jun 10 09:05:54 2008 +0000
@@ -100,7 +100,6 @@
 {
     index = 0;
     fd = -1;
-    currentPermissions = Read;
 }
 
 /****************************************************************************/
@@ -416,7 +415,7 @@
         ec_ioctl_sdo_entry_t entry;
         unsigned int entryByteSize;
 
-        open(Read);
+        open(ReadWrite);
 
         try {
             getSdoEntry(&entry, slavePosition,
@@ -869,11 +868,7 @@
     stringstream deviceName;
 
     if (fd != -1) { // already open
-        if (currentPermissions < perm) { // more permissions required
-            close();
-        } else {
-            return;
-        }
+        return;
     }
     
     deviceName << "/dev/EtherCAT" << index;
@@ -885,8 +880,6 @@
             << strerror(errno);
         throw MasterException(err.str());
     }
-
-    currentPermissions = perm;
 }
 
 /****************************************************************************/
@@ -897,6 +890,7 @@
         return;
 
     ::close(fd);
+    fd = -1;
 }
 
 /*****************************************************************************/
--- a/tools/Master.h	Tue Jun 10 08:54:54 2008 +0000
+++ b/tools/Master.h	Tue Jun 10 09:05:54 2008 +0000
@@ -93,7 +93,6 @@
 
         unsigned int index;
         int fd;
-        Permissions currentPermissions;
 };
 
 /****************************************************************************/