[zaptel-commits] tzafrir: trunk r1384 - /trunk/xpp/utils/genzaptelconf

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Sep 4 15:25:56 MST 2006


Author: tzafrir
Date: Mon Sep  4 17:25:56 2006
New Revision: 1384

URL: http://svn.digium.com/view/zaptel?rev=1384&view=rev
Log:
genzaptelconf: handle the case of zap_autoreg=0 
(FIXME: code copied from zaptel.init)

Modified:
    trunk/xpp/utils/genzaptelconf

Modified: trunk/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/trunk/xpp/utils/genzaptelconf?rev=1384&r1=1383&r2=1384&view=diff
==============================================================================
--- trunk/xpp/utils/genzaptelconf (original)
+++ trunk/xpp/utils/genzaptelconf Mon Sep  4 17:25:56 2006
@@ -278,6 +278,28 @@
 	fi
 	if [ -d "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi
 }
+
+
+
+zap_reg_xpp() {
+	if [ ! -d /proc/xpp ]; then return; fi
+
+	# Get a list of connected Astribank devices, sorted by the name of
+	# the USB connector. That order is rather arbitrary, but will not
+	# change without changes to the cabling.
+	xbusses=`sort -k 2 /proc/xpp/xbuses | awk -F: '/STATUS=connected/ {print $1}'`
+
+	# get a list of XPDs that were not yet registered as zaptel spans.
+	# this will be the case if you set the parameter zap_autoreg=0 to
+	# the module xpp
+	# Append /dev/null to provide a valid file name in case of an empty pattern.
+	xbusses_pattern=`echo $xbusses| sed -e 's|XBUS-[0-9]*|/proc/xpp/&/XPD-*/zt_registration|g'`' /dev/null'
+	xpds_to_register=`grep -l 0 $xbusses_pattern`
+	for file in $xpds_to_register; do
+		echo 1 >$file
+	done
+}
+
 
 check_for_astribank(){
 	if ! grep -q XPP_IN/ /proc/zaptel/* 2>/dev/null
@@ -986,6 +1008,7 @@
 if [ "$mode" = list ]; then
 	genconf list
 else
+	zap_reg_xpp
 	check_for_astribank
 	get_rapid_extens
 	say "Generating '${ZAPCONF_FILE}'"



More information about the zaptel-commits mailing list