summaryrefslogtreecommitdiff
path: root/xpp
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-10 21:40:01 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-10 21:40:01 +0000
commit4325de0504e811ca0a64ceb834ccc16b5ca92615 (patch)
treef949ea51f8b13afe8ba59774f8ae2d2c561928b1 /xpp
parente2bbbc6f8ffa6bf7b960dde029f7ae88d7c163d6 (diff)
0.5.1:
* Wait for the xpp module to register if just loaded * Initial support for ztgsm (Junghanns's PCI GSM card) git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1050 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp')
-rwxr-xr-xxpp/genzaptelconf39
1 files changed, 34 insertions, 5 deletions
diff --git a/xpp/genzaptelconf b/xpp/genzaptelconf
index 19715c0..7bcc20e 100755
--- a/xpp/genzaptelconf
+++ b/xpp/genzaptelconf
@@ -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 @@ tmp_dir=
# 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 @@ unload_module() {
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
@@ -461,6 +464,24 @@ unload_modules() {
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() {
unload_modules
load_modules
@@ -477,6 +498,7 @@ detect() {
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 @@ check_tdm_sigtype() {
# 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 @@ EOF
*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
@@ -658,6 +682,11 @@ EOF
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
echo 'b8zs' >$tmp_dir/span_coding
@@ -703,7 +732,7 @@ EOF
# 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))"
;;