[zaptel-commits] tzafrir: branch 1.4 r2674 - /branches/1.4/zaptel.init

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Mon Jul 2 10:07:26 CDT 2007


Author: tzafrir
Date: Mon Jul  2 10:07:26 2007
New Revision: 2674

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2674
Log:
* Fix unloading of xpp modules.
* Add optional support for using the zaptel perl functions.
(From branches/1.2 changesset:2670 and changeset:2673)

Modified:
    branches/1.4/zaptel.init

Modified: branches/1.4/zaptel.init
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.init?view=diff&rev=2674&r1=2673&r2=2674
==============================================================================
--- branches/1.4/zaptel.init (original)
+++ branches/1.4/zaptel.init Mon Jul  2 10:07:26 2007
@@ -51,6 +51,9 @@
 	set -- $line
 	# $1: the original module, $2: size, $3: refcount, $4: deps list
 	mods=`echo $4 | tr , ' '`
+	# xpp_usb keeps the xpds below busy if an xpp hardware is
+	# connected. Hence must be removed before them:
+	case "$module" in xpd_*) mods="xpp_usb $mods";; esac
 	for mod in $mods; do
 		# run in a subshell, so it won't step over our vars:
 		(unload_module $mod) 
@@ -59,6 +62,26 @@
 	done
 	rmmod $module
 }
+
+# Initialize the Xorcom Astribank (xpp/) using perl utiliites:
+# intended to replace all the the three functions below if user has 
+# installed the zaptel-perl utilities.
+xpp_startup() {
+	# do nothing if there are no astribank devices:
+	if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi
+
+	echo "Waiting for Astribank devices to initialize:"
+	cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true
+	
+	# 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 zt_registration on
+
+	# this one could actually be run after ztcfg:
+	LC_ALL=C xpp_sync "$XPP_SYNC"
+}
+
 
 # Wait for Astribank to initialize registers:
 wait_for_xpp() {
@@ -224,6 +247,8 @@
 	done
 	sleep 3 # TODO: remove it
 	
+	# If you have zaptel-perl, the three below can be replaced with:
+	#xpp_startup
 	wait_for_xpp
 	zap_reg_xpp
 	fix_asterisbank_sync # can actually be run after ztcfg




More information about the zaptel-commits mailing list