diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-08-02 12:21:11 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-08-02 12:21:11 +0000 |
commit | c88eaa22e13bd4c092b367a28e57064659660466 (patch) | |
tree | 2978dd7342b09b60bf9dbe5e333d043fb43d9114 /xpp/utils/genzaptelconf | |
parent | 183cf9c2af77e6444450cf5d2b5c62ca6b875fbe (diff) |
Merge xpp r4372:
* Update to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward)
* Fix a critical race with zaptel synchronization (r4362)
* Added a /proc/xpp/cmds for statistics about command timing (r4360)
* Fix a digit mapping bug with hardware dtmf detection (r4357)
* In xpp/utils/Makefile add perl syntax checks to our scripts (r4337)
* Better USB data error checking (r4336)
* udev rules (xpp.rules) avoid false calls from wrong nodes (r4331)
* Improve hardware detection and reporting in lszaptel,
zaptel_hardware. zapconf is basically functional.
* Leds are blinked synchronously on all Astribanks now (r4262)
* Fix a BRI bug if OPTIMIZE_CHANMUTE was compiled into zaptel (r4258)
(This feature was not yet accepted into official zaptel)
* Removed compile warning about HZ != 1000 (r4218)
* Firmware updates.
* fpga_load now supports USB pathes without zeros (r4211)
* XPD numbers have changed to '<Unit><Subunit>' (r4196)
* Proper support for ZT_VMWI ioctl, if used in zaptel (r4092)
* Fix FXO power denial detection (r4054)
* FXO could accidentally go off-hook with some compilers (r4048)
(From branches/1.2 r2732, r2735 - branches/1.4 2736)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2813 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/genzaptelconf')
-rwxr-xr-x | xpp/utils/genzaptelconf | 152 |
1 files changed, 81 insertions, 71 deletions
diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf index daccee8..cf32fcd 100755 --- a/xpp/utils/genzaptelconf +++ b/xpp/utils/genzaptelconf @@ -516,9 +516,8 @@ unload_module() { set -- $line # $1: the original module, $2: size, $3: refcount, $4: deps list mods=`echo $4 | tr , ' '` - # 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 + # xpp_usb keeps the xpds below busy, and 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: @@ -583,7 +582,9 @@ temporary_zapconf() { save) say "Temporarily moving zaptel.conf aside to work around broken modprobe.conf" ZAPCONF_FILE_TMP=`mktemp /tmp/genzaptelconf-zaptel.conf-XXXXXX` || die "Error creating temporary zaptel.conf" - cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP + if [ -f $ZAPCONF_FILE_SYSTEM ]; then + cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP + fi echo -n >$ZAPCONF_FILE_SYSTEM ;; restore) @@ -643,6 +644,8 @@ gen_tmp_conf() { # Extract information from one digital channel (one line in a /proc/zaptel # file). Information is saved to $tmp_dir/span_foo variables. +# FIXME: detection should move to when we know the number of channels +# and hence can tell between an E1 and a T1. detect_digital_channel() { line="$1" chan_num="$2" @@ -653,70 +656,78 @@ detect_digital_channel() { # them by the channel names. This is shorter. # This also allows us to count the channel numbers and check if # we have a E1 span, a T1 span or a BRI span. - if [ "`cat $tmp_dir/span_begin`" = "-1" ] + + # span_lastd is always the one before last + # channel. span_bchan is the last: + echo $chan_num >$tmp_dir/span_end + + if [ "`cat $tmp_dir/span_begin`" != "-1" ] then - echo $chan_num >$tmp_dir/span_begin - echo $span_num >$tmp_dir/span_num - # The Astribank channels provide the information of TE/NT in the channel name. So - # why not use it? - case "$line" in - *XPP_BRI_TE/*) echo 'te' >$tmp_dir/span_termtype;; - *XPP_BRI_NT/*) echo 'nt' >$tmp_dir/span_termtype;; - esac - case "$line" in - *ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*) - # BRI channel - echo 'ccs' >$tmp_dir/span_framing - echo 'euroisdn' >$tmp_dir/span_switchtype - if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ] - then - echo $ZAPBRI_NET >$tmp_dir/span_signalling - else - echo $ZAPBRI_CPE >$tmp_dir/span_signalling - fi + return #we already configured this span. + fi + + # Now we need to give initial configuration to the span + echo $chan_num >$tmp_dir/span_begin + echo $span_num >$tmp_dir/span_num + + case "$line" in + *ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*) + # BRI channel + echo 'ccs' >$tmp_dir/span_framing + echo 'euroisdn' >$tmp_dir/span_switchtype + if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ] + then + echo $ZAPBRI_NET >$tmp_dir/span_signalling + else + echo $ZAPBRI_CPE >$tmp_dir/span_signalling + fi + ;; + *ztgsm*/*) + # Junghanns's GSM cards. + echo 'ccs' >$tmp_dir/span_framing + #Does this mean anything? + echo 'gsm' >$tmp_dir/span_signalling + ;; + *TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*) + # FIXME: handle cwain around here. + # name: *cwain[12]/* . Always E1. + + # PRI span (E1/T1) + echo 'esf' >$tmp_dir/span_framing + echo 'b8zs' >$tmp_dir/span_coding + echo 'national' >$tmp_dir/span_switchtype + if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ] + then + echo pri_net >$tmp_dir/span_signalling + else + echo pri_cpe >$tmp_dir/span_signalling + fi + # an example of country-specific setup. This is probably not accurate + # Contributions are welcome + case "$lc_country" in + nl) + # (Just an example for per-country info) + echo 'ccs' >$tmp_dir/span_framing + echo 'ami' >$tmp_dir/span_coding + #echo 'crc4' >$tmp_dir/span_yellow + #echo 'euroisdn' >$tmp_dir/span_switchtype + #echo 'pri_cpe' >$tmp_dir/span_signalling ;; - *ztgsm*/*) - # Junghanns's GSM cards. - echo 'ccs' >$tmp_dir/span_framing - #Does this mean anything? - echo 'gsm' >$tmp_dir/span_signalling + il|de|au) + echo 'ccs' >$tmp_dir/span_framing + echo 'hdb3' >$tmp_dir/span_coding + echo 'crc4' >$tmp_dir/span_yellow + echo 'euroisdn' >$tmp_dir/span_switchtype ;; - *TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*) - # PRI span (E1/T1) - echo 'esf' >$tmp_dir/span_framing - echo 'b8zs' >$tmp_dir/span_coding + cl) + echo 'ccs' >$tmp_dir/span_framing + echo 'hdb3' >$tmp_dir/span_coding + #echo 'crc4' >$tmp_dir/span_yellow echo 'national' >$tmp_dir/span_switchtype - echo 'pri_cpe' >$tmp_dir/span_signalling - # an example of country-specific setup. This is probably not accurate - # Contributions are welcome - case "$lc_country" in - nl) - # (Just an example for per-country info) - echo 'ccs' >$tmp_dir/span_framing - echo 'ami' >$tmp_dir/span_coding - #echo 'crc4' >$tmp_dir/span_yellow - #echo 'euroisdn' >$tmp_dir/span_switchtype - #echo 'pri_cpe' >$tmp_dir/span_signalling - ;; - il|de|au) - echo 'ccs' >$tmp_dir/span_framing - echo 'hdb3' >$tmp_dir/span_coding - echo 'crc4' >$tmp_dir/span_yellow - echo 'euroisdn' >$tmp_dir/span_switchtype - ;; - cl) - echo 'ccs' >$tmp_dir/span_framing - echo 'hdb3' >$tmp_dir/span_coding - #echo 'crc4' >$tmp_dir/span_yellow - echo 'national' >$tmp_dir/span_switchtype - ;; - esac - ;; + ;; esac - fi - # span_lastd is always the one before last - # channel. span_bchan is the last: - echo $chan_num >$tmp_dir/span_end + ;; + esac } # read information from the $tmp_dir/span_foo files and generate @@ -744,7 +755,7 @@ write_digital_config() { 31) #E1 dchan="$(($span_begin+15))" bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end" - if [ "$span_switchtype" = 'national' ]; then + if [ "$span_framing" = 'esf' ]; then # don't leave an E1 span with defective defaults: span_framing=ccs span_coding=hdb3 @@ -922,15 +933,14 @@ EOF fi # Check if ZapBRI cards are in TE or NT mode - if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] )' + if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] |Xorcom .* BRI_NT)' then echo 'nt' >$tmp_dir/span_termtype - else - if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] )' - then - echo 'te' >$tmp_dir/span_termtype - fi + elif echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] |Xorcom .* BRI_TE)' + then + echo 'te' >$tmp_dir/span_termtype fi + # The rest of the lines are per-channel lines sed -e 1,2d $procfile | \ while read line @@ -982,7 +992,7 @@ EOF # Astribank FXS span (input port) print_pattern -a input $chan_num fxo $mode ;; - *ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*) + *ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*|*XPP_BRI*) detect_digital_channel "$line" "$chan_num" "$span_num" ;; '') ;; # Empty line (after span header) |