summaryrefslogtreecommitdiff
path: root/zaptel.init
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-07-11 11:51:29 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-07-11 11:51:29 +0000
commit7b4628ba4ab129f7cc3a39d6f175d0847f362f2d (patch)
treee1c997b4e4a152c9095bbb2073a102fb3faefd51 /zaptel.init
parent7d8d2672e3486396a88c59f70532a27173c80a07 (diff)
* Enable zaptel-perl and use perl utilities for Astribank init (from 1.2 r2710)
* Update README accordingly. * Continue documenting Zaptel, while we're updating the README. * Ignore the generated README.html. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@2711 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.init')
-rw-r--r--zaptel.init70
1 files changed, 1 insertions, 69 deletions
diff --git a/zaptel.init b/zaptel.init
index 0ffdf5c..3bdb2ca 100644
--- a/zaptel.init
+++ b/zaptel.init
@@ -84,71 +84,6 @@ xpp_startup() {
}
-# Wait for Astribank to initialize registers:
-wait_for_xpp() {
- if [ ! -d /proc/xpp ]; then return; fi
-
- # reading from waitfor_xpds only returns when the device
- # has finished initilizing its regiters and is available.
- cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
-}
-
-# Register to zaptel Astribank spans that were not autoomatically registered
-# (useful when you have more than one Astribank)
-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 2>/dev/null` || true
- for file in $xpds_to_register; do
- echo 1 >$file
- done
-}
-
-# If the system has an Astribank, select the right one as the sync source.
-# TODO: replace the sryptic awk code with 'xpp_sync auto' once it is in.
-fix_asterisbank_sync() {
- # do nothing if module not present
- if [ ! -d /proc/xpp ]; then return; fi
-
- #if ! grep -q '^HOST' /proc/xpp/sync 2>/dev/null; then return; fi
-
- case "$XPP_SYNC" in
- n*|N*) return;;
- host|HOST) sync_value="HOST";;
- [0-9]*)sync_value="$XPP_SYNC";;
- *)
- # find the number of the first bus, and sync from it:
- fxo_pat=`awk -F: '/STATUS=connected/{print $1}' /proc/xpp/xbuses | sed -e 's|.*|/proc/xpp/&/*/fxo_info|'`
- # find the first FXO unit, and set it as the sync master
- bus=`ls -1 $fxo_pat 2> /dev/null | head -n1 | cut -d- -f2 | cut -d/ -f1`
-
- if [ "$bus" = '' ]; then
- # no device with FXO found. Just get the first one
- bus=`awk -F: '/STATUS=connected/{print $1}' /proc/xpp/xbuses | head -n 1 | cut -d- -f2`
- fi
-
- # do nothing if there is no bus:
- case "$bus" in [0-9]*):;; *) return;; esac
- sync_value="SYNC=$bus"
- ;;
- esac
- # the built-in echo of bash fails to print a proper error on failure
- if ! /bin/echo "$sync_value" >/proc/xpp/sync
- then
- echo >&2 "Updating XPP sync source failed (tried \"$sync_value\", XPP_SYNC='$XPP_SYNC')"
- fi
-}
-
hpec_start() {
# check for HPEC licenses
for f in /var/lib/digium/licenses/HPEC*.lic; do
@@ -249,10 +184,7 @@ case "$1" in
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
+ xpp_startup
if [ ! -e /proc/zaptel/1 ]; then
echo "No functioning zap hardware found in /proc/zaptel, loading ztdummy"