diff --git a/hotplug/dahdi_handle_device b/hotplug/dahdi_handle_device index c67fce9..89e2934 100755 --- a/hotplug/dahdi_handle_device +++ b/hotplug/dahdi_handle_device @@ -36,16 +36,6 @@ if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then exit 0 fi -# Check if we can safely do our job -if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then - echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER - exit 0 -fi -if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -eq 1 ]; then - echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER - exit 0 -fi - # Can we pass a different value so we can use # alternate (testing) configuration? # Meanwhile, make it hard-coded. @@ -72,6 +62,17 @@ run_parts() { case "$ACTION" in add) echo "$ACTION: $DEVPATH" | $LOGGER + + # Check if we can safely do our job + if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then + echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER + exit 0 + fi + if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -eq 1 ]; then + echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER + exit 0 + fi + # Background run -- don't block udev run_parts 2>&1 < /dev/null | $LOGGER & ;; diff --git a/hotplug/dahdi_span_config b/hotplug/dahdi_span_config index 6ee3cb3..5fce21e 100755 --- a/hotplug/dahdi_span_config +++ b/hotplug/dahdi_span_config @@ -26,17 +26,6 @@ set -e #echo >&2 "$0($ACTION): DEBUG($# args): '$*'" -# Old driver. These scripts probably won't work anyway. -if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then - $LOGGER "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" - exit 0 -fi - -if [ $(cat /sys/module/dahdi/parameters/auto_assign_spans) -eq 1 ]; then - $LOGGER "auto_assign_spans=1. Skip $DEVPATH" - exit 0 -fi - # Do we have a configuration? if [ -f /etc/dahdi/init.conf ]; then . /etc/dahdi/init.conf @@ -73,6 +62,20 @@ run_parts() { case "$ACTION" in add) echo "$ACTION: $DEVPATH" | $LOGGER + + # Old driver. These scripts probably won't work anyway. + if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then + if [ -f /sys/module/dahdi ]; then + $LOGGER "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" + exit 0 + fi + fi + + if [ $(cat /sys/module/dahdi/parameters/auto_assign_spans) -eq 1 ]; then + $LOGGER "auto_assign_spans=1. Skip $DEVPATH" + exit 0 + fi + # Set variables span_devpath="/sys$DEVPATH" SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'`