[Pkg-voip-commits] [dahdi-tools] 102/285: Make udev run dahdi_cfg on each device:

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit ba3289ac9af880aa3a7ff5010433bb3d0d3badff
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Oct 6 21:03:03 2011 +0200

    Make udev run dahdi_cfg on each device:
    
     * New script: dahdi_cfg_device_args:
       - Just like span_assignments, span_types: may be given
         one or more sysfs devpath's
       - Output the required options for dahdi_cfg. E.g:
           "-S 8 -C 15-28"
       - This may be passed (with any other wanted options)
         to the new dahdi_cfg (which supports '-S' and '-C')
    
     * Use dahdi_cfg_device_args in handle_device so we configure
       each span from udev.
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>
---
 dahdi_cfg_device_args | 32 ++++++++++++++++++++++++++++++++
 handle_device         |  9 +++++++++
 2 files changed, 41 insertions(+)

diff --git a/dahdi_cfg_device_args b/dahdi_cfg_device_args
new file mode 100755
index 0000000..de5d557
--- /dev/null
+++ b/dahdi_cfg_device_args
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+devbase='/sys/bus/dahdi_devices/devices'
+
+# Use given devices or otherwise, all existing devices
+if [ "$#" -gt 0 ]; then
+	DEVICES="$@"
+else
+	DEVICES=`echo $devbase/*`
+fi
+
+run_action_spans() {
+	device="$1"
+	for span in $device/span-*
+	do
+		spanno=`echo "$span" | sed 's,.*/span-,,'`
+		spantype=`cat "$span/spantype"`
+		basechan=`cat "$span/basechan"`
+		channels=`cat "$span/channels"`
+		endchan=`expr "$basechan" + "$channels" - 1`
+		echo "-S $spanno -C $basechan-$endchan"
+	done
+}
+
+run_action() {
+	for device in $DEVICES
+	do
+		run_action_spans "$device"
+	done
+}
+
+run_action
diff --git a/handle_device b/handle_device
index 180a163..59d0f62 100755
--- a/handle_device
+++ b/handle_device
@@ -22,6 +22,12 @@ PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
 
 set -e
 
+run_dahdi_cfg() {
+	args="-c $DAHDICONFDIR/system.conf $@"
+	echo "Running dahdi_cfg $args"
+	dahdi_cfg $args
+}
+
 echo >&2 "$0($ACTION): DEBUG($# args): '$*'"
 
 case "$ACTION" in
@@ -31,6 +37,9 @@ add)
 	#export DAHDICONFDIR="/tmp/xortel/dahdi"
 	span_types set "/sys/$DEVPATH" 2>&1 | $LOGGER
 	span_assignments add "/sys/$DEVPATH" 2>&1 | $LOGGER
+	dahdi_cfg_device_args | while read args; do
+			run_dahdi_cfg $args 2>&1 | $LOGGER
+		done
 	;;
 remove)
 	echo "$ACTION: $DEVPATH" | $LOGGER

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list