From 55e77f964dc30b49c4dede0dd98ddd0761702d43 Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Tue, 7 Nov 2023 11:44:24 +0100 Subject: [PATCH] Add a nice error message to ethercatctl in case of missing config. --- script/ethercatctl.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/ethercatctl.in b/script/ethercatctl.in index 2da6e95b..ab3f45a8 100755 --- a/script/ethercatctl.in +++ b/script/ethercatctl.in @@ -102,6 +102,14 @@ start) MASTER_INDEX=$((${MASTER_INDEX} + 1)) done + if [ -z "${DEVICES}" ]; then + echo "ERROR: No network cards for EtherCAT specified." + echo -n "Please edit ${ETHERCAT_CONFIG} with root permissions" + echo -n " and set MASTER0_DEVICE variable to either a " + echo "network interface name (like eth0) or to a MAC address." + exit 1 + fi + # load master module if ! ${MODPROBE} ${MODPROBE_FLAGS} ec_master \ main_devices="${DEVICES}" backup_devices="${BACKUPS}"; then