[zaptel-commits] trunk r1050 - /trunk/xpp/genzaptelconf

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed May 10 14:40:02 MST 2006


Author: tzafrir
Date: Wed May 10 16:40:01 2006
New Revision: 1050

URL: http://svn.digium.com/view/zaptel?rev=1050&view=rev
Log:
0.5.1:
* Wait for the xpp module to register if just loaded
* Initial support for ztgsm (Junghanns's PCI GSM card)

Modified:
    trunk/xpp/genzaptelconf

Modified: trunk/xpp/genzaptelconf
URL: http://svn.digium.com/view/zaptel/trunk/xpp/genzaptelconf?rev=1050&r1=1049&r2=1050&view=diff
==============================================================================
--- trunk/xpp/genzaptelconf (original)
+++ trunk/xpp/genzaptelconf Wed May 10 16:40:01 2006
@@ -31,6 +31,9 @@
 # TODO: either ditch them or convert to perl
 # Don't override variables here. Override them in /etc/default/zaptel
 #
+# 0.5.1:
+# * Initial support for ztgsm (Junghanns's PCI GSM card)
+# * Wait for the xpp module to register if just loaded
 # 0.5.0:
 # * Not trying to read from zaptel channels: we can run genzaptelconf even 
 #   with asterisk up.
@@ -48,7 +51,7 @@
 # * hence we can reduce the list of modules
 
 # /etc/default/zaptel may override the following variables
-VERSION=0.5.0
+VERSION=0.5.1
 VERSION_FULL="$VERSION $Id$"
 lc_country=us
 base_exten=6000
@@ -84,7 +87,7 @@
 # A list of all modules:
 # - the list of modules which will be probed (in this order) if -d is used
 # - The module that will be deleted from /etc/modules , if -d -M is used
-ALL_MODULES="zaphfc qozap wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wcusb ztd_eth xpp_usb"
+ALL_MODULES="zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wcusb xpp_usb"
 
 # read default configuration from /etc/default/zaptel
 if [ -r $ZAPTEL_BOOT ]; then . $ZAPTEL_BOOT; fi
@@ -436,7 +439,7 @@
 	set -- $line
 	# $1: the original module, $2: size, $3: refcount, $4: deps list
 	mods=`echo $4 | tr , ' '`
-	# xpd_fxs actually sort of depends on xpp, but forgets to tell it.
+	# old versions of xpd_fxs actually depend on xpp, but forget to tell it.
 	# bug has already been fixed but the code will remain here for a while
 	# just in case
 	case "$module" in xpd_*) mods="xpp_usb $mods";; esac
@@ -459,6 +462,24 @@
 	say "Unloading zaptel modules:"
 	unload_module zaptel
 	say ''
+}
+
+# sleep a while until the xpp modules fully register
+wait_for_xpp() {
+	if [ -d /proc/xpp ] && \
+	   [ "`cat /sys/module/xpp/parameters/zap_autoreg`" = 'Y' ]
+	then
+		# wait for the XPDs to register:
+		for i in `seq 10`; do
+			sleep 1
+			if ! grep -q 0 /proc/xpp/*/*/zt_registration 2>/dev/null
+			then
+				# There are either no XPDs or all of them are 
+				# registered. Nothing to do
+				break
+			fi
+		done
+	fi
 }
 
 detect() {
@@ -477,6 +498,7 @@
 		say "Updating '${MODLIST_FILE}'"
 		update_module_list "$modlist"
 	fi
+	if echo $modlist | grep -q xpp_usb; then wait_for_xpp; fi
 }
 
 # TODO: kill this function. It is now unreferenced from anywhere.
@@ -492,6 +514,8 @@
 
 #	print_pattern $chan_num $chan_sig_type $mode
 	
+  # if you get syntax error from this line, make sure you use 'bash' 
+  # rather than 'sh'
 	$ztcfg_cmd -c <(print_pattern $chan_num $chan_sig_type zaptel) 2>/dev/null  \
 		|| return 1
 	if head -c1 /dev/zap/$chan_num >/dev/null 2>/dev/null
@@ -642,7 +666,7 @@
 			*XPP_IN/*)
 				print_pattern -a input $chan_num fxo $mode
 				;;
-			*ZTHFC*/*|*ztqoz*/*|*WCT1/*) # should also be used for other PRI channels
+			*ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*WCT1/*) # should also be used for other PRI channels
 				if [ "`cat $tmp_dir/span_begin`" = "-1" ]
 				then
 					echo $chan_num      >$tmp_dir/span_begin
@@ -657,6 +681,11 @@
 						else
 							echo 'bri_cpe' >$tmp_dir/span_signalling
 						fi
+						;;
+					*ztgsm*/*)
+						echo 'ccs'          >$tmp_dir/span_framing
+            # what switch type? Any meaning to it?
+						echo 'gsm'          >$tmp_dir/span_signalling
 						;;
 					*WCT1/*)
 						echo 'esf'       >$tmp_dir/span_framing
@@ -703,7 +732,7 @@
 			# exactly the same logic is used in asterisk's chan_zap.c.
 			# also not that $(( )) is bash-specific
 			case "$((1+ $span_end - $span_begin))" in
-			3|24) #BRI or T1
+			2|3|24) #ztgsm, BRI or T1
 			  dchan=$span_end
 				bchans="$span_begin-$(($span_end-1))"
 				;;



More information about the zaptel-commits mailing list