[dahdi-commits] dahdi/tools.git branch "master" updated.
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Mar 25 08:06:00 CDT 2014
branch "master" has been updated
via 1292ea90789aa20bff5a533141086f6ecf4f82df (commit)
via cfee27106b6594a03153dcbf805433eb9e7bb630 (commit)
from 066fa2aff33ba32208e6f3341ba76676a0419da2 (commit)
Summary of changes:
Makefile | 1 +
dahdi.init | 8 +++-----
hotplug/dahdi_auto_assign_compat | 25 +++++++++++++++++++++++++
hotplug/dahdi_handle_device | 3 ++-
hotplug/handle_device.d/10-span-types | 7 +++++++
hotplug/handle_device.d/20-span-assignments | 13 ++++++++++---
6 files changed, 48 insertions(+), 9 deletions(-)
create mode 100755 hotplug/dahdi_auto_assign_compat
- Log -----------------------------------------------------------------
commit 1292ea90789aa20bff5a533141086f6ecf4f82df
Author: Oron Peled <oron.peled at xorcom.com>
Date: Sun Mar 9 14:20:17 2014 +0200
registration-order: Added dahdi_auto_assign_compat
Maintains the original registration order as was before span
assignments. Should allow seemless trannsition to
dahdi.auto_assign_spans=0
* The idea:
- We stop handling in udev the case of missing
/etc/dahdi/assigned-spans.conf
- Instead we rely on "registration_time" dahdi_device attribute from
DAHDI-linux
- Then, we can sort the devices and assign their spans in
/etc/init.d/dahdi
* Mechanics:
- From /etc/init.d/dahdi, we run a new 'dahdi_auto_assign_compat'
script (after "waitfor_xpds" etc.)
- In this script we "auto" assign spans of non-Astribank devices
- In the end of the script we run "dahdi_registration" which
does the same for Astribank devices.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/Makefile b/Makefile
index 5566cbc..e3aa4b6 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,7 @@ endif
ASSIGNED_DATA_SCRIPTS:=\
dahdi_handle_device \
dahdi_span_config \
+ dahdi_auto_assign_compat \
span_config.d/10-dahdi-cfg \
span_config.d/20-fxotune \
span_config.d/50-asterisk \
diff --git a/dahdi.init b/dahdi.init
index 064fa4f..2b77fd3 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -148,11 +148,6 @@ xpp_startup() {
if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi
hotplug_exit_after_load
-
- # overriding locales for the above two, as perl can be noisy
- # when locales are missing.
- # No register all the devices if they didn't auto-register:
- LC_ALL=C dahdi_registration on
}
@@ -263,6 +258,9 @@ case "$1" in
xpp_startup
+ # Assign all spans that weren't handled via udev + /etc/dahdi/assigned-spans.conf
+ /usr/share/dahdi/dahdi_auto_assign_compat
+
if [ $system = debian ]; then
echo -n "Running dahdi_cfg: "
$DAHDI_CFG_CMD 2> /dev/null && echo -n "done"
diff --git a/hotplug/dahdi_auto_assign_compat b/hotplug/dahdi_auto_assign_compat
new file mode 100755
index 0000000..96f90dd
--- /dev/null
+++ b/hotplug/dahdi_auto_assign_compat
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+devdir='/sys/bus/dahdi_devices/devices'
+
+# DAHDI is loaded?
+if [ ! -d "$devdir" ]; then
+ exit 0
+fi
+
+devices_by_registration_time() {
+ grep -H '' $devdir/*/registration_time 2>/dev/null | \
+ sed 's,/registration_time:,\t,' | \
+ sort -k 2,2
+}
+
+# First assign non-Astribank devices
+devices_by_registration_time | \
+ grep -v '/astribanks:' | \
+ while read devpath time; do
+ echo >&2 "D: auto '$devpath'"
+ dahdi_span_assignments auto "$devpath"
+ done
+
+# Now handle Astribanks
+LC_ALL=C dahdi_registration -Rv on
diff --git a/hotplug/handle_device.d/20-span-assignments b/hotplug/handle_device.d/20-span-assignments
index bfb724b..5493232 100755
--- a/hotplug/handle_device.d/20-span-assignments
+++ b/hotplug/handle_device.d/20-span-assignments
@@ -7,9 +7,9 @@ add)
exit 0
esac
+# For now, handle only spans in assigned-spans.conf
+# We leave other cases to /etc/init.d/dahdi, so
+# legacy ordering can be preserved.
if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then
dahdi_span_assignments add "/sys$DEVPATH"
-else
- # No configuration. No order guaranteed
- dahdi_span_assignments auto "/sys$DEVPATH"
fi
commit cfee27106b6594a03153dcbf805433eb9e7bb630
Author: Oron Peled <oron.peled at xorcom.com>
Date: Sun Mar 9 14:03:00 2014 +0200
hotplug: call handle_device.d/ actions for remove
* Original actions didn't care about remove (10-span-types, 20-span-assignments)
* But others need to know about removals too.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/hotplug/dahdi_handle_device b/hotplug/dahdi_handle_device
index 52ce9c2..30329bd 100755
--- a/hotplug/dahdi_handle_device
+++ b/hotplug/dahdi_handle_device
@@ -77,8 +77,9 @@ add)
run_parts 2>&1 < /dev/null | $LOGGER &
;;
remove)
- # Nothing to do yet...
echo "$ACTION: $DEVPATH" | $LOGGER
+ # Background run -- don't block udev
+ run_parts 2>&1 < /dev/null | $LOGGER &
;;
*)
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
diff --git a/hotplug/handle_device.d/10-span-types b/hotplug/handle_device.d/10-span-types
index d840c3d..6b78021 100755
--- a/hotplug/handle_device.d/10-span-types
+++ b/hotplug/handle_device.d/10-span-types
@@ -1,5 +1,12 @@
#! /bin/sh
+case "$ACTION" in
+add)
+ ;;
+*)
+ exit 0
+esac
+
if [ -r "$DAHDICONFDIR/span-types.conf" ]; then
dahdi_span_types set "/sys$DEVPATH"
fi
diff --git a/hotplug/handle_device.d/20-span-assignments b/hotplug/handle_device.d/20-span-assignments
index f078aca..bfb724b 100755
--- a/hotplug/handle_device.d/20-span-assignments
+++ b/hotplug/handle_device.d/20-span-assignments
@@ -1,5 +1,12 @@
#! /bin/sh
+case "$ACTION" in
+add)
+ ;;
+*)
+ exit 0
+esac
+
if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then
dahdi_span_assignments add "/sys$DEVPATH"
else
-----------------------------------------------------------------------
--
dahdi/tools.git
More information about the dahdi-commits
mailing list