mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-09-21 09:33:47 +08:00
Allow only MAC addresses as device identifiers; replaced master list by
master array; hand ober MAC addresses with array module parameters.
This commit is contained in:
+14
-10
@@ -68,16 +68,14 @@ fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
function make_device_id()
|
||||
function parse_mac_address()
|
||||
{
|
||||
if [ -z "${1}" ]; then
|
||||
DEVICE_ID=";"
|
||||
MAC=""
|
||||
elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then
|
||||
DEVICE_ID="M${1};"
|
||||
elif echo ${1} | grep -qE '^[^:]+:[0-9]+$'; then
|
||||
DEVICE_ID="D${1};"
|
||||
MAC=${1}
|
||||
else
|
||||
echo Invalid device ID syntax in ${ETHERCAT_CONFIG}
|
||||
echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG}
|
||||
/bin/false
|
||||
rc_status -v
|
||||
rc_exit
|
||||
@@ -103,10 +101,16 @@ start)
|
||||
BACKUP=$(eval echo "\${MASTER${MASTER_INDEX}_BACKUP}")
|
||||
if [ -z "${DEVICE}" ]; then break; fi
|
||||
|
||||
make_device_id ${DEVICE}
|
||||
DEVICES=${DEVICES}${DEVICE_ID}
|
||||
make_device_id ${BACKUP}
|
||||
BACKUPS=${BACKUPS}${DEVICE_ID}
|
||||
if [ ${MASTER_INDEX} -gt 0 ]; then
|
||||
DEVICES=${DEVICES},
|
||||
BACKUPS=${BACKUPS},
|
||||
fi
|
||||
|
||||
parse_mac_address ${DEVICE}
|
||||
DEVICES=${DEVICES}${MAC}
|
||||
|
||||
parse_mac_address ${BACKUP}
|
||||
BACKUPS=${BACKUPS}${MAC}
|
||||
|
||||
MASTER_INDEX=$(expr ${MASTER_INDEX} + 1)
|
||||
done
|
||||
|
||||
@@ -9,20 +9,14 @@
|
||||
#
|
||||
# Master device and backup-device settings.
|
||||
#
|
||||
# The MASTERX_DEVICE variable specifies the ethernet device for master 'X',
|
||||
# while the MASTERX_BACKUP variable specifies the backup ethernet device for
|
||||
# The MASTER<X>_DEVICE variable specifies the ethernet device for master 'X',
|
||||
# while the MASTER<X>_BACKUP variable specifies the backup ethernet device for
|
||||
# redundancy purposes.
|
||||
#
|
||||
# There are three formats for specifying ethernet devices:
|
||||
# 1) MAC address (example: "00:00:08:44:ab:66"). Specify the MAC address of
|
||||
# the ethernet card to use.
|
||||
# 2) PCI bus address (example: "01:1c.0"). Specify the PCU bis address of the
|
||||
# ethernet card to use.
|
||||
# 3) Driver and device index (example: "8139too:0"). Currently there are two
|
||||
# drivers available: "8139too" and "e100". The device index is the index
|
||||
# into driver-supported PCI cards.
|
||||
# Specify the MAC address (hexadecimal with colons) of the Ethernet device to
|
||||
# use. Example: 00:00:08:44:ab:66
|
||||
#
|
||||
# The MASTERX_DEVICE variables also determine, how many masters will be
|
||||
# The MASTER<X>_DEVICE variables also determine, how many masters will be
|
||||
# created: A non-empty variable MASTER0_DEVICE will create one master, adding
|
||||
# a non-empty variable MASTER1_DEVICE will create a second master, and so on.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user