hotplug: Check for auto_assign_spans only when ACTION is add.
Removes a potentially confusing error message. This is a reapplication of
(4f259cd569
"dahdi_handle_device, dahdi_span_config: Check for
auto_assign_spans only when ACTION is add.") which appears to have been
accidentally removed when moving the hotplug scripts into a subdirectory.
From the original commit:
When dahdi.ko is unloaded, it may be possible for the driver to be removed from
the kernel before the udev scripts are run. When this happens, you'll see
messages like the following which are not accurate:
'dahdi_handle_device'[24567]: Old driver (no auto_assign_spans parameter). Skip /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0
Now instead you will see:
'dahdi_handle_device'[28008]: remove: /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0
Also, all the udev events will be logged in the system log even when they are
ignored because of legacy auto span assignment. This will help show what is
going on during the transition period to full udev configuration of spans.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
This commit is contained in:
parent
8e2a5def27
commit
27d07446ef
@ -36,16 +36,6 @@ if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
# Can we pass a different value so we can use
|
||||||
# alternate (testing) configuration?
|
# alternate (testing) configuration?
|
||||||
# Meanwhile, make it hard-coded.
|
# Meanwhile, make it hard-coded.
|
||||||
@ -72,6 +62,17 @@ run_parts() {
|
|||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
add)
|
add)
|
||||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
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
|
# Background run -- don't block udev
|
||||||
run_parts 2>&1 < /dev/null | $LOGGER &
|
run_parts 2>&1 < /dev/null | $LOGGER &
|
||||||
;;
|
;;
|
||||||
|
@ -26,17 +26,6 @@ set -e
|
|||||||
|
|
||||||
#echo >&2 "$0($ACTION): DEBUG($# args): '$*'"
|
#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?
|
# Do we have a configuration?
|
||||||
if [ -f /etc/dahdi/init.conf ]; then
|
if [ -f /etc/dahdi/init.conf ]; then
|
||||||
. /etc/dahdi/init.conf
|
. /etc/dahdi/init.conf
|
||||||
@ -73,6 +62,20 @@ run_parts() {
|
|||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
add)
|
add)
|
||||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
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
|
# Set variables
|
||||||
span_devpath="/sys$DEVPATH"
|
span_devpath="/sys$DEVPATH"
|
||||||
SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'`
|
SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'`
|
||||||
|
Loading…
Reference in New Issue
Block a user