[Pkg-voip-commits] r2705 - zaptel/trunk/debian
Tzafrir Cohen
tzafrir-guest at alioth.debian.org
Wed Nov 15 16:06:31 CET 2006
Author: tzafrir-guest
Date: 2006-11-15 16:06:31 +0100 (Wed, 15 Nov 2006)
New Revision: 2705
Modified:
zaptel/trunk/debian/zaptel.init
Log:
* zaptel.init: Further improvements for the xpp (Astribank).
* zaptel.init: Allow overriding the path of fxotune.
Modified: zaptel/trunk/debian/zaptel.init
===================================================================
--- zaptel/trunk/debian/zaptel.init 2006-11-15 15:03:47 UTC (rev 2704)
+++ zaptel/trunk/debian/zaptel.init 2006-11-15 15:06:31 UTC (rev 2705)
@@ -15,6 +15,7 @@
ZAPCONF_FILE=/etc/zaptel.conf
NAME=zaptel
DESC="Zaptel telephony kernel driver"
+FXOTUNE=/usr/sbin/fxotune
# Include am defaults if available
if [ -f /etc/default/zaptel ] ; then
@@ -36,6 +37,25 @@
set -e
+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
+}
+
fix_asterisbank_sync() {
# do nothing if module not present
if [ ! -d /proc/xpp ]; then return; fi
@@ -48,7 +68,12 @@
[0-9]*)sync_value="$XPP_SYNC";;
*)
# find the number of the first bus, and sync from it:
- bus=`awk -F: '/STATUS=connected/{print $1}' /proc/xpp/xbuses | head -n 1 | cut -d- -f2`
+ 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`
+
+ # do nothing if there is no bus:
+ case "$bus" in [0-9]*):;; *) return;; esac
sync_value="$bus 0"
;;
esac
@@ -87,15 +112,8 @@
[ "`cat /sys/module/xpp/parameters/zap_autoreg`" = 'Y' ]
then
# wait for the XPDs to register:
- for i in `seq 30`; 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
+ # TODO: improve error reporting and produce a messagee here
+ cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
fi
}
@@ -107,6 +125,7 @@
# modprobe $module
#done
wait_for_xpp
+ zap_reg_xpp
fix_asterisbank_sync
# If there is no zaptel timing source, load
@@ -115,8 +134,8 @@
if ! head -c 0 /dev/zap/pseudo 2>/dev/null
then modprobe ztdummy || true # will fail if there is no module package
fi
- if [ -r /etc/fxotune.conf ] && [ -x fxotune ]; then
- fxotune -s
+ if [ -r /etc/fxotune.conf ] && [ -x $FXOTUNE ]; then
+ $FXOTUNE -s
fi
# configure existing modules:
More information about the Pkg-voip-commits
mailing list