MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two). stable-1.2
authorFlorian Pose <fp@igh-essen.com>
Tue, 13 Feb 2007 13:45:36 +0000
branchstable-1.2
changeset 1740 fa0af75bfbe9
parent 1739 5fcbd29151d2
child 1741 5eb7bed96194
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Doxyfile
NEWS
TODO
configure.ac
script/Makefile.am
script/ethercat.sh
script/init.d/Makefile.am
script/init.d/ethercat
script/install.sh
script/lsec
script/lsec.pl
script/sysconfig-file
script/sysconfig/Makefile.am
script/sysconfig/ethercat
--- a/Doxyfile	Tue Feb 13 13:42:37 2007 +0000
+++ b/Doxyfile	Tue Feb 13 13:45:36 2007 +0000
@@ -23,7 +23,7 @@
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.1.1
+PROJECT_NUMBER         = 1.2
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
--- a/NEWS	Tue Feb 13 13:42:37 2007 +0000
+++ b/NEWS	Tue Feb 13 13:45:36 2007 +0000
@@ -6,6 +6,8 @@
 
 Changes in version 1.2.0:
 
+* Serveral fixes of bugs and stability issues. Master should now run fine
+  with kernels 2.6.17 to 2.6.19.
 * Realtime interface changes:
   - Re-introduced ecrt_domain_queue() to allow datagram queuing apart
     from datagram processing. The queuing of a domain's datagrams is not
--- a/TODO	Tue Feb 13 13:42:37 2007 +0000
+++ b/TODO	Tue Feb 13 13:45:36 2007 +0000
@@ -28,7 +28,6 @@
 
 * Smaller changes:
   - Simplify FSMs with <state>_enter() functions.
-  - Rename "sysconfig" file to "sysconfig/ethercat".
   - Dynamic creation of EoE handlers.
   - Output intermediate results during lsec.
   - State change FSM: Follow spontaneous state changes.
--- a/configure.ac	Tue Feb 13 13:42:37 2007 +0000
+++ b/configure.ac	Tue Feb 13 13:45:36 2007 +0000
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 
 AC_PREREQ(2.59)
-AC_INIT([ethercat],[1.2.0-rc2],[fp@igh-essen.com])
+AC_INIT([ethercat],[1.2.0],[fp@igh-essen.com])
 AC_CONFIG_AUX_DIR([autoconf])
 AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2])
 AC_PREFIX_DEFAULT([/opt/etherlab])
@@ -211,6 +211,8 @@
         master/Makefile
         devices/Makefile
         script/Makefile
+        script/init.d/Makefile
+        script/sysconfig/Makefile
         include/Makefile
         examples/Makefile
         examples/mini/Makefile
--- a/script/Makefile.am	Tue Feb 13 13:42:37 2007 +0000
+++ b/script/Makefile.am	Tue Feb 13 13:45:36 2007 +0000
@@ -35,19 +35,10 @@
 #
 #------------------------------------------------------------------------------
 
-initdir = $(sysconfdir)/init.d
-sysdir = $(sysconfdir)/sysconfig
+SUBDIRS = init.d sysconfig
 
 bin_SCRIPTS = lsec
-init_SCRIPTS = ethercat
-sys_DATA = sysconfig
 
-EXTRA_DIST = lsec.pl ethercat.sh sysconfig
-
-lsec: lsec.pl
-	cp $(srcdir)/lsec.pl lsec
-
-ethercat: ethercat.sh
-	cp $(srcdir)/ethercat.sh ethercat
+EXTRA_DIST = lsec
 
 #------------------------------------------------------------------------------
--- a/script/ethercat.sh	Tue Feb 13 13:42:37 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-#!/bin/sh
-
-#------------------------------------------------------------------------------
-#
-#  Init script for EtherCAT
-#
-#  $Id$
-#
-#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
-#
-#  This file is part of the IgH EtherCAT Master.
-#
-#  The IgH EtherCAT Master is free software; you can redistribute it
-#  and/or modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2 of the
-#  License, or (at your option) any later version.
-#
-#  The IgH EtherCAT Master is distributed in the hope that it will be
-#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with the IgH EtherCAT Master; if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#  The right to use EtherCAT Technology is granted and comes free of
-#  charge under condition of compatibility of product made by
-#  Licensee. People intending to distribute/sell products based on the
-#  code, have to sign an agreement to guarantee that products using
-#  software based on IgH EtherCAT master stay compatible with the actual
-#  EtherCAT specification (which are released themselves as an open
-#  standard) as the (only) precondition to have the right to use EtherCAT
-#  Technology, IP and trade marks.
-#
-#------------------------------------------------------------------------------
-
-### BEGIN INIT INFO
-# Provides:          ethercat
-# Required-Start:    $local_fs $syslog $network
-# Should-Start:      $time ntp
-# Required-Stop:     $local_fs $syslog $network
-# Should-Stop:       $time ntp
-# Default-Start:     3 5
-# Default-Stop:      0 1 2 6
-# Short-Description: IgH EtherCAT master modules
-# Description:
-### END INIT INFO
-
-#------------------------------------------------------------------------------
-
-IFCONFIG=ifconfig
-BRCTL=brctl
-ROUTE=route
-
-#------------------------------------------------------------------------------
-
-ETHERCAT_CONFIG=/etc/sysconfig/ethercat
-
-if [ ! -r $ETHERCAT_CONFIG ]; then
-    echo "$ETHERCAT_CONFIG not existing";
-    if [ "$1" = "stop" ]; then
-	exit 0
-    else
-	exit 6
-    fi
-fi
-
-. $ETHERCAT_CONFIG
-
-#------------------------------------------------------------------------------
-
-#
-#  Function for setting up the EoE bridge
-#
-build_eoe_bridge()
-{
-    if [ -z "$EOE_BRIDGE" ]; then return; fi
-
-    EOEIF=`$IFCONFIG -a | grep -o -E "^eoe[0-9]+ "`
-
-    # add bridge, if it does not already exist
-    if ! $BRCTL show | grep -E -q "^$EOE_BRIDGE"; then
-        if ! $BRCTL addbr $EOE_BRIDGE; then
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-    fi
-
-    # check if specified interfaces are bridged
-    for interf in $EOEIF $EOE_EXTRA_INTERFACES; do
-	# interface is already part of the bridge (FIXME->show $EOE_BRIDGE)
-	if $BRCTL show | grep -E -q $interf
-	    then continue
-	fi
-	# clear IP address and open interface
-	if ! $IFCONFIG $interf 0.0.0.0 up; then
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-	# add interface to the bridge
-	if ! $BRCTL addif $EOE_BRIDGE $interf; then
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-    done
-
-    # configure IP on bridge
-    if [ -n "$EOE_IP_ADDRESS" -a -n "$EOE_IP_NETMASK" ]; then
-	if ! $IFCONFIG $EOE_BRIDGE $EOE_IP_ADDRESS \
-	    netmask $EOE_IP_NETMASK; then
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-    fi
-
-    # open bridge
-    if ! $IFCONFIG $EOE_BRIDGE up; then
-	/bin/false
-	rc_status -v
-	rc_exit
-    fi
-
-    # install new default gateway
-    if [ -n "$EOE_GATEWAY" ]; then
-	while $ROUTE -n | grep -E -q "^0.0.0.0"; do
-	    if ! $ROUTE del default; then
-		echo "Failed to remove route!" 1>&2
-		/bin/false
-		rc_status -v
-		rc_exit
-	    fi
-	done
-	if ! $ROUTE add default gw $EOE_GATEWAY; then
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-    fi
-}
-
-#------------------------------------------------------------------------------
-
-. /etc/rc.status
-rc_reset
-
-case "$1" in
-
-    start)
-	echo -n "Starting EtherCAT master "
-
-	if [ -z "$DEVICE_INDEX" ]; then
-	    echo "ERROR: DEVICE_INDEX not set!"
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-
-	if [ -z "$EOE_INTERFACES" ]; then
-	    if [ -n "$EOE_DEVICES" ]; then # support legacy sysconfig files
-		EOE_INTERFACES=$EOE_DEVICES
-	    else
-		EOE_INTERFACES=0
-	    fi
-	fi
-
-        # unload conflicting modules at first
-	for mod in 8139too; do
-	    if lsmod | grep "^$mod " > /dev/null; then
-		if ! rmmod $mod; then
-		    /bin/false
-		    rc_status -v
-		    rc_exit
-		fi
-	    fi
-	done
-
-        # load master module
-	if ! modprobe ec_master ec_eoeif_count=$EOE_INTERFACES; then
-	    modprobe 8139too
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-
-        # load device module
-	if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then
-	    rmmod ec_master
-	    modprobe 8139too
-	    /bin/false
-	    rc_status -v
-	    rc_exit
-	fi
-
-        # build EoE bridge
-	build_eoe_bridge
-
-	rc_status -v
-	;;
-
-    stop)
-	echo -n "Shutting down EtherCAT master "
-
-        # unload modules
-	for mod in ec_8139too ec_master; do
-	    if lsmod | grep "^$mod " > /dev/null; then
-		if ! rmmod $mod; then
-		    /bin/false
-		    rc_status -v
-		    rc_exit
-		fi;
-	    fi;
-	done
-
-	sleep 1
-
-        # reload previous modules
-	if ! modprobe 8139too; then
-	    echo "Warning: Failed to restore 8139too module."
-	fi
-
-	rc_status -v
-	;;
-
-    restart)
-	$0 stop || exit 1
-	sleep 1
-	$0 start
-	rc_status
-	;;
-
-    status)
-	echo -n "Checking for EtherCAT "
-
-	lsmod | grep "^ec_master " > /dev/null
-	master_running=$?
-	lsmod | grep "^ec_8139too " > /dev/null
-	device_running=$?
-
-        # master module and device module loaded?
-	test $master_running -eq 0 -a $device_running -eq 0
-
-	rc_status -v
-	;;
-
-    bridge)
-	echo -n "Building EoE bridge "
-	build_eoe_bridge
-	rc_status -v
-	;;
-
-    *)
-	echo "USAGE: $0 {start|stop|restart|status|bridge}"
-	;;
-
-esac
-
-rc_exit
-
-#------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/init.d/Makefile.am	Tue Feb 13 13:45:36 2007 +0000
@@ -0,0 +1,40 @@
+#------------------------------------------------------------------------------
+#
+#  $Id$
+#
+#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
+#
+#  This file is part of the IgH EtherCAT Master.
+#
+#  The IgH EtherCAT Master is free software; you can redistribute it
+#  and/or modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  The IgH EtherCAT Master is distributed in the hope that it will be
+#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with the IgH EtherCAT Master; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#  The right to use EtherCAT Technology is granted and comes free of
+#  charge under condition of compatibility of product made by
+#  Licensee. People intending to distribute/sell products based on the
+#  code, have to sign an agreement to guarantee that products using
+#  software based on IgH EtherCAT master stay compatible with the actual
+#  EtherCAT specification (which are released themselves as an open
+#  standard) as the (only) precondition to have the right to use EtherCAT
+#  Technology, IP and trade marks.
+#
+#------------------------------------------------------------------------------
+
+initdir = $(sysconfdir)/init.d
+
+init_SCRIPTS = ethercat
+
+EXTRA_DIST = ethercat
+
+#------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/init.d/ethercat	Tue Feb 13 13:45:36 2007 +0000
@@ -0,0 +1,279 @@
+#!/bin/sh
+
+#------------------------------------------------------------------------------
+#
+#  Init script for EtherCAT
+#
+#  $Id$
+#
+#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
+#
+#  This file is part of the IgH EtherCAT Master.
+#
+#  The IgH EtherCAT Master is free software; you can redistribute it
+#  and/or modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  The IgH EtherCAT Master is distributed in the hope that it will be
+#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with the IgH EtherCAT Master; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#  The right to use EtherCAT Technology is granted and comes free of
+#  charge under condition of compatibility of product made by
+#  Licensee. People intending to distribute/sell products based on the
+#  code, have to sign an agreement to guarantee that products using
+#  software based on IgH EtherCAT master stay compatible with the actual
+#  EtherCAT specification (which are released themselves as an open
+#  standard) as the (only) precondition to have the right to use EtherCAT
+#  Technology, IP and trade marks.
+#
+#------------------------------------------------------------------------------
+
+### BEGIN INIT INFO
+# Provides:          ethercat
+# Required-Start:    $local_fs $syslog $network
+# Should-Start:      $time ntp
+# Required-Stop:     $local_fs $syslog $network
+# Should-Stop:       $time ntp
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 6
+# Short-Description: IgH EtherCAT master modules
+# Description:
+### END INIT INFO
+
+#------------------------------------------------------------------------------
+
+device="ecxml"
+
+IFCONFIG=ifconfig
+BRCTL=brctl
+ROUTE=route
+
+#------------------------------------------------------------------------------
+
+ETHERCAT_CONFIG=/etc/sysconfig/ethercat
+
+if [ ! -r $ETHERCAT_CONFIG ]; then
+    echo "$ETHERCAT_CONFIG not existing";
+    if [ "$1" = "stop" ]; then
+	exit 0
+    else
+	exit 6
+    fi
+fi
+
+. $ETHERCAT_CONFIG
+
+#------------------------------------------------------------------------------
+
+#
+#  Function for setting up the EoE bridge
+#
+build_eoe_bridge()
+{
+    if [ -z "$EOE_BRIDGE" ]; then return; fi
+
+    EOEIF=`$IFCONFIG -a | grep -o -E "^eoe[0-9]+ "`
+
+    # add bridge, if it does not already exist
+    if ! $BRCTL show | grep -E -q "^$EOE_BRIDGE"; then
+        if ! $BRCTL addbr $EOE_BRIDGE; then
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+    fi
+
+    # check if specified interfaces are bridged
+    for interf in $EOEIF $EOE_EXTRA_INTERFACES; do
+	# interface is already part of the bridge (FIXME->show $EOE_BRIDGE)
+	if $BRCTL show | grep -E -q $interf
+	    then continue
+	fi
+	# clear IP address and open interface
+	if ! $IFCONFIG $interf 0.0.0.0 up; then
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+	# add interface to the bridge
+	if ! $BRCTL addif $EOE_BRIDGE $interf; then
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+    done
+
+    # configure IP on bridge
+    if [ -n "$EOE_IP_ADDRESS" -a -n "$EOE_IP_NETMASK" ]; then
+	if ! $IFCONFIG $EOE_BRIDGE $EOE_IP_ADDRESS \
+	    netmask $EOE_IP_NETMASK; then
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+    fi
+
+    # open bridge
+    if ! $IFCONFIG $EOE_BRIDGE up; then
+	/bin/false
+	rc_status -v
+	rc_exit
+    fi
+
+    # install new default gateway
+    if [ -n "$EOE_GATEWAY" ]; then
+	while $ROUTE -n | grep -E -q "^0.0.0.0"; do
+	    if ! $ROUTE del default; then
+		echo "Failed to remove route!" 1>&2
+		/bin/false
+		rc_status -v
+		rc_exit
+	    fi
+	done
+	if ! $ROUTE add default gw $EOE_GATEWAY; then
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+    fi
+}
+
+#------------------------------------------------------------------------------
+
+. /etc/rc.status
+rc_reset
+
+case "$1" in
+
+    start)
+	echo -n "Starting EtherCAT master "
+
+	if [ -z "$DEVICE_INDEX" ]; then
+	    echo "ERROR: DEVICE_INDEX not set!"
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+
+	if [ -z "$EOE_INTERFACES" ]; then
+            # support legacy sysconfig files
+	    if [ -n "$EOE_DEVICES" ]; then
+		EOE_INTERFACES=$EOE_DEVICES
+	    else
+		EOE_INTERFACES=0
+	    fi
+	fi
+
+        # unload conflicting modules at first
+	for mod in 8139too; do
+	    if lsmod | grep "^$mod " > /dev/null; then
+		if ! rmmod $mod; then
+		    /bin/false
+		    rc_status -v
+		    rc_exit
+		fi
+	    fi
+	done
+
+        # load master module
+	if ! modprobe ec_master ec_eoeif_count=$EOE_INTERFACES; then
+	    modprobe 8139too
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+
+	# remove stale device node
+	rm -f /dev/${device}0
+
+	# get dynamic major number
+	major=$(awk "\$2==\"EtherCAT\" {print \$1}" /proc/devices)
+
+	# create character device
+	mknod /dev/${device}0 c $major 0
+
+	# load device module
+	if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then
+	    rmmod ec_master
+	    modprobe 8139too
+	    /bin/false
+	    rc_status -v
+	    rc_exit
+	fi
+
+	# build EoE bridge
+	build_eoe_bridge
+
+	rc_status -v
+	;;
+
+    stop)
+	echo -n "Shutting down EtherCAT master "
+
+	# unload modules
+	for mod in ec_8139too ec_master; do
+	    if lsmod | grep "^$mod " > /dev/null; then
+		if ! rmmod $mod; then
+		    /bin/false
+		    rc_status -v
+		    rc_exit
+		fi;
+	    fi;
+	done
+
+	# remove device node
+	rm -f /dev/${device}0
+
+	sleep 1
+
+	# reload previous modules
+	if ! modprobe 8139too; then
+	    echo "Warning: Failed to restore 8139too module."
+	fi
+
+	rc_status -v
+	;;
+
+    restart)
+	$0 stop || exit 1
+	sleep 1
+	$0 start
+	rc_status
+	;;
+
+    status)
+	echo -n "Checking for EtherCAT "
+
+	lsmod | grep "^ec_master " > /dev/null
+	master_running=$?
+	lsmod | grep "^ec_8139too " > /dev/null
+	device_running=$?
+
+	# master module and device module loaded?
+	test $master_running -eq 0 -a $device_running -eq 0
+
+	rc_status -v
+	;;
+
+    bridge)
+	echo -n "Building EoE bridge "
+	build_eoe_bridge
+	rc_status -v
+	;;
+
+    *)
+	echo "USAGE: $0 {start|stop|restart|status|bridge}"
+	;;
+
+esac
+
+rc_exit
+
+#------------------------------------------------------------------------------
--- a/script/install.sh	Tue Feb 13 13:42:37 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-#!/bin/sh
-
-#------------------------------------------------------------------------------
-#
-#  EtherCAT install script
-#
-#  $Id$
-#
-#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
-#
-#  This file is part of the IgH EtherCAT Master.
-#
-#  The IgH EtherCAT Master is free software; you can redistribute it
-#  and/or modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2 of the
-#  License, or (at your option) any later version.
-#
-#  The IgH EtherCAT Master is distributed in the hope that it will be
-#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with the IgH EtherCAT Master; if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#  The right to use EtherCAT Technology is granted and comes free of
-#  charge under condition of compatibility of product made by
-#  Licensee. People intending to distribute/sell products based on the
-#  code, have to sign an agreement to guarantee that products using
-#  software based on IgH EtherCAT master stay compatible with the actual
-#  EtherCAT specification (which are released themselves as an open
-#  standard) as the (only) precondition to have the right to use EtherCAT
-#  Technology, IP and trade marks.
-#
-#------------------------------------------------------------------------------
-
-# Fetch parameters
-
-if [ $# -ne 1 ]; then
-    echo "This script is called by \"make\". Run \"make install\" instead."
-    exit 1
-fi
-
-KERNEL=$1
-
-if [ ! -d /lib/modules/$KERNEL ]; then
-    echo "Kernel \"$KERNEL\" does not exist in /lib/modules!"
-    exit 1
-fi
-
-echo "EtherCAT installer - Kernel: $KERNEL"
-
-#------------------------------------------------------------------------------
-
-# Update module dependencies
-
-echo "  Building module dependencies"
-/sbin/depmod
-
-#------------------------------------------------------------------------------
-
-# Create configuration file
-
-CONFIGFILE=/etc/sysconfig/ethercat
-
-if [ -s $CONFIGFILE ]; then
-    echo "  Note: Using existing configuration file."
-else
-    echo "  Creating $CONFIGFILE"
-    cp script/sysconfig $CONFIGFILE || exit 1
-    echo "  Note: Please edit DEVICE_INDEX in $CONFIGFILE!"
-fi
-
-#------------------------------------------------------------------------------
-
-# Install rc script
-
-echo "  Installing startup script"
-cp script/ethercat.sh /etc/init.d/ethercat || exit 1
-chmod +x /etc/init.d/ethercat || exit 1
-if [ ! -L /usr/sbin/rcethercat ]; then
-    ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1
-fi
-
-#------------------------------------------------------------------------------
-
-# Install tools
-
-echo "  Installing tools"
-cp script/lsec.pl /usr/local/bin/lsec || exit 1
-chmod +x /usr/local/bin/lsec || exit 1
-
-#------------------------------------------------------------------------------
-
-# Finish
-
-echo "Done"
-exit 0
-
-#------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/lsec	Tue Feb 13 13:45:36 2007 +0000
@@ -0,0 +1,211 @@
+#!/usr/bin/perl
+
+#------------------------------------------------------------------------------
+#
+#  l s e c  -  List EtherCAT
+#
+#  Userspace tool for listing EtherCAT slaves.
+#
+#  $Id$
+#
+#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
+#
+#  This file is part of the IgH EtherCAT Master.
+#
+#  The IgH EtherCAT Master is free software; you can redistribute it
+#  and/or modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  The IgH EtherCAT Master is distributed in the hope that it will be
+#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with the IgH EtherCAT Master; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#  The right to use EtherCAT Technology is granted and comes free of
+#  charge under condition of compatibility of product made by
+#  Licensee. People intending to distribute/sell products based on the
+#  code, have to sign an agreement to guarantee that products using
+#  software based on IgH EtherCAT master stay compatible with the actual
+#  EtherCAT specification (which are released themselves as an open
+#  standard) as the (only) precondition to have the right to use EtherCAT
+#  Technology, IP and trade marks.
+#
+#------------------------------------------------------------------------------
+
+require 'sys/ioctl.ph';
+
+use strict;
+use Getopt::Std;
+
+my %opt;
+my $master_index;
+my $master_dir;
+my $term_width;
+
+#------------------------------------------------------------------------------
+
+$term_width = &get_terminal_width;
+&get_options;
+&query_master;
+exit 0;
+
+#------------------------------------------------------------------------------
+
+sub query_master
+{
+    $master_dir = "/sys/ethercat" . $master_index;
+    &query_slaves;
+}
+
+#------------------------------------------------------------------------------
+
+sub query_slaves
+{
+    my $dirhandle;
+    my $entry;
+    my @slaves;
+    my $slave;
+    my $abs;
+    my $line;
+    my $ring_cols;
+    my $adv_cols;
+    my $fmt;
+    my $cols;
+
+    unless (opendir $dirhandle, $master_dir) {
+		print "Failed to open directory \"$master_dir\".\n";
+		exit 1;
+    }
+
+    while ($entry = readdir $dirhandle) {
+        next unless $entry =~ /^slave(\d+)$/;
+
+		$slave = {};
+
+		open INFO, "$master_dir/$entry/info" or die
+			"ERROR: Failed to open $master_dir/$entry/info";
+
+		while ($line = <INFO>) {
+			if ($line =~ /^Name: (.*)$/) {
+				$slave->{'name'} = $1;
+			}
+			elsif ($line =~ /^Ring position: (\d+)$/) {
+				$slave->{'ring_position'} = $1;
+			}
+			elsif ($line =~ /^Advanced position: (\d+:\d+)$/) {
+				$slave->{'advanced_position'} = $1;
+			}
+			elsif ($line =~ /^State: (.+) /) {
+				$slave->{'state'} = $1;
+			}
+			elsif ($line =~ /^Coupler: ([a-z]+)$/) {
+				$slave->{'coupler'} = $1;
+			}
+			elsif ($line =~ /^Current consumption: (-?\d+) mA$/) {
+				$slave->{'current'} = $1;
+			}
+		}
+
+		close INFO;
+
+		push @slaves, $slave;
+    }
+    closedir $dirhandle;
+
+    @slaves = sort { $a->{'ring_position'} <=> $b->{'ring_position'} } @slaves;
+
+    $ring_cols = 0;
+    $adv_cols = 0;
+    for $slave (@slaves) {
+	$cols = length $slave->{'ring_position'};
+	$ring_cols = $cols if ($cols > $ring_cols);
+	$cols = length $slave->{'advanced_position'};
+	$adv_cols = $cols if ($cols > $adv_cols);
+    }
+
+    if (defined $opt{'c'}) { # display power consumtion
+	$fmt = sprintf " %%%is  %%-%is  %%6i  %%6i  %%s\n",
+	    $ring_cols, $adv_cols;
+
+	my $current_sum = 0;
+	for $slave (@slaves) {
+	    if ($slave->{'coupler'} eq "yes") {
+		&print_line if !defined $opt{n};
+		$current_sum = 0; # reset current sum
+	    }
+	    $current_sum -= $slave->{'current'};
+	    printf($fmt, $slave->{'ring_position'},
+		   $slave->{'advanced_position'}, $slave->{'current'},
+		   $current_sum, $slave->{'name'});
+	}
+    }
+    else {
+	$fmt = sprintf " %%%is  %%-%is  %%-6s  %%s\n", $ring_cols, $adv_cols;
+
+	for $slave (@slaves) {
+	    &print_line if $slave->{'coupler'} eq "yes" and !defined $opt{n};
+	    printf($fmt, $slave->{'ring_position'},
+		   $slave->{'advanced_position'}, $slave->{'state'},
+		   $slave->{'name'});
+	}
+    }
+}
+
+#------------------------------------------------------------------------------
+
+sub get_options
+{
+    my $optret = getopts "m:cnh", \%opt;
+
+    &print_usage if defined $opt{h} or $#ARGV > -1 or !$optret;
+
+    if (defined $opt{m}) {
+	$master_index = $opt{m};
+    }
+    else {
+	$master_index = 0;
+    }
+}
+
+#------------------------------------------------------------------------------
+
+sub print_usage
+{
+    my $cmd = `basename $0`;
+    chomp $cmd;
+    print "Usage: $cmd [OPTIONS]\n";
+    print "        -m <IDX>    Query master <IDX>.\n";
+    print "        -c          Display current [mA] ";
+    print "(3: consumption, 4: remaining).\n";
+    print "        -n          Display no coupler lines.\n";
+    print "        -h          Show this help.\n";
+    exit 0;
+}
+
+#------------------------------------------------------------------------------
+
+sub get_terminal_width
+{
+    my $winsize;
+    die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
+    open(TTY, "+</dev/tty") or die "No tty: $!";
+    unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
+	die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
+    }
+    (my $row, my $col, my $xpixel, my $ypixel) = unpack('S4', $winsize);
+    return $col;
+}
+#------------------------------------------------------------------------------
+
+sub print_line
+{
+    for (my $i = 0; $i < $term_width; $i++) {print "-";}
+    print "\n";
+}
+
+#------------------------------------------------------------------------------
--- a/script/lsec.pl	Tue Feb 13 13:42:37 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-#!/usr/bin/perl
-
-#------------------------------------------------------------------------------
-#
-#  l s e c  -  List EtherCAT
-#
-#  Userspace tool for listing EtherCAT slaves.
-#
-#  $Id$
-#
-#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
-#
-#  This file is part of the IgH EtherCAT Master.
-#
-#  The IgH EtherCAT Master is free software; you can redistribute it
-#  and/or modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2 of the
-#  License, or (at your option) any later version.
-#
-#  The IgH EtherCAT Master is distributed in the hope that it will be
-#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with the IgH EtherCAT Master; if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#  The right to use EtherCAT Technology is granted and comes free of
-#  charge under condition of compatibility of product made by
-#  Licensee. People intending to distribute/sell products based on the
-#  code, have to sign an agreement to guarantee that products using
-#  software based on IgH EtherCAT master stay compatible with the actual
-#  EtherCAT specification (which are released themselves as an open
-#  standard) as the (only) precondition to have the right to use EtherCAT
-#  Technology, IP and trade marks.
-#
-#------------------------------------------------------------------------------
-
-require 'sys/ioctl.ph';
-
-use strict;
-use Getopt::Std;
-
-my %opt;
-my $master_index;
-my $master_dir;
-my $term_width;
-
-#------------------------------------------------------------------------------
-
-$term_width = &get_terminal_width;
-&get_options;
-&query_master;
-exit 0;
-
-#------------------------------------------------------------------------------
-
-sub query_master
-{
-    $master_dir = "/sys/ethercat" . $master_index;
-    &query_slaves;
-}
-
-#------------------------------------------------------------------------------
-
-sub query_slaves
-{
-    my $dirhandle;
-    my $entry;
-    my @slaves;
-    my $slave;
-    my $abs;
-    my $line;
-    my $ring_cols;
-    my $adv_cols;
-    my $fmt;
-    my $cols;
-
-    unless (opendir $dirhandle, $master_dir) {
-		print "Failed to open directory \"$master_dir\".\n";
-		exit 1;
-    }
-
-    while ($entry = readdir $dirhandle) {
-        next unless $entry =~ /^slave(\d+)$/;
-
-		$slave = {};
-
-		open INFO, "$master_dir/$entry/info" or die
-			"ERROR: Failed to open $master_dir/$entry/info";
-
-		while ($line = <INFO>) {
-			if ($line =~ /^Name: (.*)$/) {
-				$slave->{'name'} = $1;
-			}
-			elsif ($line =~ /^Ring position: (\d+)$/) {
-				$slave->{'ring_position'} = $1;
-			}
-			elsif ($line =~ /^Advanced position: (\d+:\d+)$/) {
-				$slave->{'advanced_position'} = $1;
-			}
-			elsif ($line =~ /^State: (.+) /) {
-				$slave->{'state'} = $1;
-			}
-			elsif ($line =~ /^Coupler: ([a-z]+)$/) {
-				$slave->{'coupler'} = $1;
-			}
-			elsif ($line =~ /^Current consumption: (-?\d+) mA$/) {
-				$slave->{'current'} = $1;
-			}
-		}
-
-		close INFO;
-
-		push @slaves, $slave;
-    }
-    closedir $dirhandle;
-
-    @slaves = sort { $a->{'ring_position'} <=> $b->{'ring_position'} } @slaves;
-
-    $ring_cols = 0;
-    $adv_cols = 0;
-    for $slave (@slaves) {
-	$cols = length $slave->{'ring_position'};
-	$ring_cols = $cols if ($cols > $ring_cols);
-	$cols = length $slave->{'advanced_position'};
-	$adv_cols = $cols if ($cols > $adv_cols);
-    }
-
-    if (defined $opt{'c'}) { # display power consumtion
-	$fmt = sprintf " %%%is  %%-%is  %%6i  %%6i  %%s\n",
-	    $ring_cols, $adv_cols;
-
-	my $current_sum = 0;
-	for $slave (@slaves) {
-	    if ($slave->{'coupler'} eq "yes") {
-		&print_line if !defined $opt{n};
-		$current_sum = 0; # reset current sum
-	    }
-	    $current_sum -= $slave->{'current'};
-	    printf($fmt, $slave->{'ring_position'},
-		   $slave->{'advanced_position'}, $slave->{'current'},
-		   $current_sum, $slave->{'name'});
-	}
-    }
-    else {
-	$fmt = sprintf " %%%is  %%-%is  %%-6s  %%s\n", $ring_cols, $adv_cols;
-
-	for $slave (@slaves) {
-	    &print_line if $slave->{'coupler'} eq "yes" and !defined $opt{n};
-	    printf($fmt, $slave->{'ring_position'},
-		   $slave->{'advanced_position'}, $slave->{'state'},
-		   $slave->{'name'});
-	}
-    }
-}
-
-#------------------------------------------------------------------------------
-
-sub get_options
-{
-    my $optret = getopts "m:cnh", \%opt;
-
-    &print_usage if defined $opt{h} or $#ARGV > -1 or !$optret;
-
-    if (defined $opt{m}) {
-	$master_index = $opt{m};
-    }
-    else {
-	$master_index = 0;
-    }
-}
-
-#------------------------------------------------------------------------------
-
-sub print_usage
-{
-    my $cmd = `basename $0`;
-    chomp $cmd;
-    print "Usage: $cmd [OPTIONS]\n";
-    print "        -m <IDX>    Query master <IDX>.\n";
-    print "        -c          Display current [mA] ";
-    print "(3: consumption, 4: remaining).\n";
-    print "        -n          Display no coupler lines.\n";
-    print "        -h          Show this help.\n";
-    exit 0;
-}
-
-#------------------------------------------------------------------------------
-
-sub get_terminal_width
-{
-    my $winsize;
-    die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
-    open(TTY, "+</dev/tty") or die "No tty: $!";
-    unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
-	die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
-    }
-    (my $row, my $col, my $xpixel, my $ypixel) = unpack('S4', $winsize);
-    return $col;
-}
-#------------------------------------------------------------------------------
-
-sub print_line
-{
-    for (my $i = 0; $i < $term_width; $i++) {print "-";}
-    print "\n";
-}
-
-#------------------------------------------------------------------------------
--- a/script/sysconfig-file	Tue Feb 13 13:42:37 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#------------------------------------------------------------------------------
-#
-#  EtherCAT sysconfig file
-#
-#  $Id$
-#
-#------------------------------------------------------------------------------
-
-#
-#  PCI index of the (RTL8139-)EtherCAT device
-#  Setting this is mandatory for the EtherCAT init script!
-#
-#DEVICE_INDEX=99
-
-#
-#  Number of Ethernet-over-EtherCAT interfaces every master shall create
-#  on startup. Default is 0.
-#
-#EOE_INTERFACES=0
-
-#
-#  Bridge all EoE interfaces after master startup
-#  This variable shall contain the name of the EoE bridge to set up.
-#  If the variable is empty or undefined, no EoE bridge will be built.
-#
-#EOE_BRIDGE=eoebr0
-
-#
-#  IP address of the EoE bridge
-#  Set both EOE_IP_ADDRESS and EOE_IP_NETMASK to let the local host communicate
-#  with devices on the EoE bridge.
-#
-#EOE_IP_ADDRESS=192.168.X.X
-
-#
-#  IP netmask of the EoE bridge
-#  See EOE_IP_ADDRESS.
-#
-#EOE_IP_NETMASK=255.255.255.0
-
-#
-#  Renew default gateway after bridge installation.
-#  Set this to the new default gateway, if the default route shall
-#  be renewed after the bridge has been installed.
-#
-#EOE_GATEWAY=192.168.X.X
-
-#
-#  List of extra interfaces to include in the EoE bridge.
-#  Set this to interconnect the EoE bridge with other local interfaces.
-#  If EOE_BRIDGE is empty or undefined, setting this variable has no effect.
-#  Important: The IP address of these interfaces will be cleared. Set
-#  EOE_IP_ADDRESS and EOE_IP_NETMASK accordingly to enable IP traffic to
-#  extra interfaces.
-#
-#EOE_EXTRA_INTERFACES=eth0
-
-#------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/sysconfig/Makefile.am	Tue Feb 13 13:45:36 2007 +0000
@@ -0,0 +1,40 @@
+#------------------------------------------------------------------------------
+#
+#  $Id$
+#
+#  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
+#
+#  This file is part of the IgH EtherCAT Master.
+#
+#  The IgH EtherCAT Master is free software; you can redistribute it
+#  and/or modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  The IgH EtherCAT Master is distributed in the hope that it will be
+#  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with the IgH EtherCAT Master; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#  The right to use EtherCAT Technology is granted and comes free of
+#  charge under condition of compatibility of product made by
+#  Licensee. People intending to distribute/sell products based on the
+#  code, have to sign an agreement to guarantee that products using
+#  software based on IgH EtherCAT master stay compatible with the actual
+#  EtherCAT specification (which are released themselves as an open
+#  standard) as the (only) precondition to have the right to use EtherCAT
+#  Technology, IP and trade marks.
+#
+#------------------------------------------------------------------------------
+
+sysdir = $(sysconfdir)/sysconfig
+
+sys_DATA = ethercat
+
+EXTRA_DIST = ethercat
+
+#------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/sysconfig/ethercat	Tue Feb 13 13:45:36 2007 +0000
@@ -0,0 +1,58 @@
+#------------------------------------------------------------------------------
+#
+#  EtherCAT sysconfig file
+#
+#  $Id$
+#
+#------------------------------------------------------------------------------
+
+#
+#  PCI index of the (RTL8139-)EtherCAT device
+#  Setting this is mandatory for the EtherCAT init script!
+#
+#DEVICE_INDEX=99
+
+#
+#  Number of Ethernet-over-EtherCAT interfaces every master shall create
+#  on startup. Default is 0.
+#
+#EOE_INTERFACES=0
+
+#
+#  Bridge all EoE interfaces after master startup
+#  This variable shall contain the name of the EoE bridge to set up.
+#  If the variable is empty or undefined, no EoE bridge will be built.
+#
+#EOE_BRIDGE=eoebr0
+
+#
+#  IP address of the EoE bridge
+#  Set both EOE_IP_ADDRESS and EOE_IP_NETMASK to let the local host communicate
+#  with devices on the EoE bridge.
+#
+#EOE_IP_ADDRESS=192.168.X.X
+
+#
+#  IP netmask of the EoE bridge
+#  See EOE_IP_ADDRESS.
+#
+#EOE_IP_NETMASK=255.255.255.0
+
+#
+#  Renew default gateway after bridge installation.
+#  Set this to the new default gateway, if the default route shall
+#  be renewed after the bridge has been installed.
+#
+#EOE_GATEWAY=192.168.X.X
+
+#
+#  List of extra interfaces to include in the EoE bridge.
+#  Set this to interconnect the EoE bridge with other local interfaces.
+#  If EOE_BRIDGE is empty or undefined, setting this variable has no effect.
+#  Important: The IP address of these interfaces will be cleared. Set
+#  EOE_IP_ADDRESS and EOE_IP_NETMASK accordingly to enable IP traffic to
+#  extra interfaces.
+#
+#EOE_EXTRA_INTERFACES=eth0
+
+#------------------------------------------------------------------------------