script/init.d/ethercat.in
branchstable-1.5
changeset 2421 bc2d4bf9cbe5
parent 1804 742607c464c4
child 2543 0d978e56a635
equal deleted inserted replaced
2420:69056c46aa4d 2421:bc2d4bf9cbe5
    22 #  You should have received a copy of the GNU General Public License along
    22 #  You should have received a copy of the GNU General Public License along
    23 #  with the IgH EtherCAT Master; if not, write to the Free Software
    23 #  with the IgH EtherCAT Master; if not, write to the Free Software
    24 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    24 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    25 #
    25 #
    26 #  ---
    26 #  ---
    27 #  
    27 #
    28 #  The license mentioned above concerns the source code only. Using the EtherCAT
    28 #  The license mentioned above concerns the source code only. Using the EtherCAT
    29 #  technology and brand is only permitted in compliance with the industrial
    29 #  technology and brand is only permitted in compliance with the industrial
    30 #  property and similar rights of Beckhoff Automation GmbH.
    30 #  property and similar rights of Beckhoff Automation GmbH.
    31 #
    31 #
    32 #  vim: expandtab
    32 #  vim: expandtab
   124     elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then
   124     elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then
   125         MAC=${1}
   125         MAC=${1}
   126     else
   126     else
   127         echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG}
   127         echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG}
   128         exit_fail
   128         exit_fail
   129     fi 
   129     fi
   130 }
   130 }
   131 
   131 
   132 #------------------------------------------------------------------------------
   132 #------------------------------------------------------------------------------
   133 
   133 
   134 if [ -r /etc/rc.status ]; then
   134 if [ -r /etc/rc.status ]; then
   155             BACKUPS=${BACKUPS},
   155             BACKUPS=${BACKUPS},
   156         fi
   156         fi
   157 
   157 
   158         parse_mac_address ${DEVICE}
   158         parse_mac_address ${DEVICE}
   159         DEVICES=${DEVICES}${MAC}
   159         DEVICES=${DEVICES}${MAC}
   160         
   160 
   161         parse_mac_address ${BACKUP}
   161         parse_mac_address ${BACKUP}
   162         BACKUPS=${BACKUPS}${MAC}
   162         BACKUPS=${BACKUPS}${MAC}
   163 
   163 
   164         MASTER_INDEX=$(expr ${MASTER_INDEX} + 1)
   164         MASTER_INDEX=$(expr ${MASTER_INDEX} + 1)
   165     done
   165     done
   241 
   241 
   242     RESULT=0
   242     RESULT=0
   243 
   243 
   244     for i in `seq 0 $(expr ${MASTER_COUNT} - 1)`; do
   244     for i in `seq 0 $(expr ${MASTER_COUNT} - 1)`; do
   245         echo -n "Master${i} "
   245         echo -n "Master${i} "
   246         
   246 
   247         # Check if the master is in idle or operation phase
   247         # Check if the master is in idle or operation phase
   248         ${ETHERCAT} master --master ${i} 2>/dev/null | \
   248         ${ETHERCAT} master --master ${i} 2>/dev/null | \
   249             grep -qE 'Phase:[[:space:]]*Idle|Phase:[[:space:]]*Operation'
   249             grep -qE 'Phase:[[:space:]]*Idle|Phase:[[:space:]]*Operation'
   250         EXITCODE=$?
   250         EXITCODE=$?
   251 
   251