equal
deleted
inserted
replaced
66 |
66 |
67 . ${ETHERCAT_CONFIG} |
67 . ${ETHERCAT_CONFIG} |
68 |
68 |
69 #------------------------------------------------------------------------------ |
69 #------------------------------------------------------------------------------ |
70 |
70 |
71 function make_device_id() |
71 function parse_mac_address() |
72 { |
72 { |
73 if [ -z "${1}" ]; then |
73 if [ -z "${1}" ]; then |
74 DEVICE_ID=";" |
74 MAC="" |
75 elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then |
75 elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then |
76 DEVICE_ID="M${1};" |
76 MAC=${1} |
77 elif echo ${1} | grep -qE '^[^:]+:[0-9]+$'; then |
|
78 DEVICE_ID="D${1};" |
|
79 else |
77 else |
80 echo Invalid device ID syntax in ${ETHERCAT_CONFIG} |
78 echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG} |
81 /bin/false |
79 /bin/false |
82 rc_status -v |
80 rc_status -v |
83 rc_exit |
81 rc_exit |
84 fi |
82 fi |
85 } |
83 } |
101 while true; do |
99 while true; do |
102 DEVICE=$(eval echo "\${MASTER${MASTER_INDEX}_DEVICE}") |
100 DEVICE=$(eval echo "\${MASTER${MASTER_INDEX}_DEVICE}") |
103 BACKUP=$(eval echo "\${MASTER${MASTER_INDEX}_BACKUP}") |
101 BACKUP=$(eval echo "\${MASTER${MASTER_INDEX}_BACKUP}") |
104 if [ -z "${DEVICE}" ]; then break; fi |
102 if [ -z "${DEVICE}" ]; then break; fi |
105 |
103 |
106 make_device_id ${DEVICE} |
104 if [ ${MASTER_INDEX} -gt 0 ]; then |
107 DEVICES=${DEVICES}${DEVICE_ID} |
105 DEVICES=${DEVICES}, |
108 make_device_id ${BACKUP} |
106 BACKUPS=${BACKUPS}, |
109 BACKUPS=${BACKUPS}${DEVICE_ID} |
107 fi |
|
108 |
|
109 parse_mac_address ${DEVICE} |
|
110 DEVICES=${DEVICES}${MAC} |
|
111 |
|
112 parse_mac_address ${BACKUP} |
|
113 BACKUPS=${BACKUPS}${MAC} |
110 |
114 |
111 MASTER_INDEX=$(expr ${MASTER_INDEX} + 1) |
115 MASTER_INDEX=$(expr ${MASTER_INDEX} + 1) |
112 done |
116 done |
113 |
117 |
114 # load master module |
118 # load master module |