[Pkg-voip-commits] r3325 - in zaptel/trunk/debian: . patches
Tzafrir Cohen
tzafrir-guest at alioth.debian.org
Sat Mar 24 19:18:32 CET 2007
Author: tzafrir-guest
Date: 2007-03-24 18:18:32 +0000 (Sat, 24 Mar 2007)
New Revision: 3325
Added:
zaptel/trunk/debian/patches/ztdiag.dpatch
Modified:
zaptel/trunk/debian/changelog
zaptel/trunk/debian/docs
zaptel/trunk/debian/patches/00list
zaptel/trunk/debian/patches/zaptel_perl.dpatch
zaptel/trunk/debian/rules
zaptel/trunk/debian/zaptel.init
Log:
* Update standards version to 3.7.2 .
* ztdiag.dpatch: fix the ioctl ZT_CHANDIAG and enable it.
* Use the zaptel perl utilities to simplify zaptel init.
* zaptel_perl.dpatch: use vedorlib rather than an explicit path.
* Fix /etc/init.d/zaptel status .
* Support loading modules from /etc/init.d/zaptel start .
Modified: zaptel/trunk/debian/changelog
===================================================================
--- zaptel/trunk/debian/changelog 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/changelog 2007-03-24 18:18:32 UTC (rev 3325)
@@ -1,8 +1,15 @@
zaptel (1:1.2.16~dfsg-2) UNRELEASED; urgency=low
+ [ Tzafrir Cohen ]
* NOT RELEASED YET
+ * Update standards version to 3.7.2 .
+ * ztdiag.dpatch: fix the ioctl ZT_CHANDIAG and enable it.
+ * Use the zaptel perl utilities to simplify zaptel init.
+ * zaptel_perl.dpatch: use vedorlib rather than an explicit path.
+ * Fix /etc/init.d/zaptel status .
+ * Support loading modules from /etc/init.d/zaptel start .
- -- Mark Purcell <msp at debian.org> Sat, 24 Mar 2007 10:14:20 +0000
+ -- Tzafrir Cohen <tzafrir.cohen at xorcom.com> Sat, 24 Mar 2007 20:02:03 +0200
zaptel (1:1.2.16~dfsg-1) unstable; urgency=low
Modified: zaptel/trunk/debian/docs
===================================================================
--- zaptel/trunk/debian/docs 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/docs 2007-03-24 18:18:32 UTC (rev 3325)
@@ -1,6 +1,5 @@
README
README.fxotune
README.fxsusb
-README.Linux26
xpp/README.Astribank
tonezones.txt
Modified: zaptel/trunk/debian/patches/00list
===================================================================
--- zaptel/trunk/debian/patches/00list 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/patches/00list 2007-03-24 18:18:32 UTC (rev 3325)
@@ -17,3 +17,4 @@
xpp_all_platforms
zaptel_perl
conglomerate_fixes
+ztdiag
Modified: zaptel/trunk/debian/patches/zaptel_perl.dpatch
===================================================================
--- zaptel/trunk/debian/patches/zaptel_perl.dpatch 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/patches/zaptel_perl.dpatch 2007-03-24 18:18:32 UTC (rev 3325)
@@ -17,7 +17,7 @@
UDEV_RULES_DIR = /etc/udev/rules.d
# Perl disabled by default, until we see it is safe:
-#PERLLIBDIR = $(shell eval `perl -V:sitelib`; echo "$$sitelib")
-+PERLLIBDIR = $(datadir)/perl5
++PERLLIBDIR = $(shell eval `perl -V:vendorlib`; echo "$$vendorlib")
XPD_FIRMWARE = $(wildcard ../firmwares/*.hex)
XPD_INIT_DATA = $(XPD_FIRMWARE) init_fxo_modes
Added: zaptel/trunk/debian/patches/ztdiag.dpatch
===================================================================
--- zaptel/trunk/debian/patches/ztdiag.dpatch 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/patches/ztdiag.dpatch 2007-03-24 18:18:32 UTC (rev 3325)
@@ -0,0 +1,109 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## ztdiag.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: ZT_CHANDIAG (used in ztdiag) is disabled by default, as it allocates
+## DP: a large struct on the stack. This patch allocates it in the heap,
+## DP: and also enables it by default.
+## DP: upstream bug: http://bugs.digium.com/view.php?id=9364 .
+
+ at DPATCH@
+diff -urNad zaptel-1.4.1~dfsg~/zaptel-base.c zaptel-1.4.1~dfsg/zaptel-base.c
+--- zaptel-1.4.1~dfsg~/zaptel-base.c 2007-03-24 10:20:58.000000000 +0200
++++ zaptel-1.4.1~dfsg/zaptel-base.c 2007-03-24 10:46:38.000000000 +0200
+@@ -2934,11 +2934,7 @@
+ struct zt_params param;
+ } stack;
+ struct zt_chan *chan;
+-#ifdef ALLOW_CHAN_DIAG
+- /* This structure is huge and will bork a 4k stack */
+- struct zt_chan mychan;
+ unsigned long flags;
+-#endif
+ int i,j;
+ int return_master = 0;
+
+@@ -3147,7 +3145,6 @@
+ if (copy_to_user((struct zt_spaninfo *) data,&stack.span,sizeof(stack.span)))
+ return -EFAULT;
+ break;
+-#ifdef ALLOW_CHAN_DIAG
+ case ZT_CHANDIAG:
+ get_user(j, (int *)data); /* get channel number from user */
+ /* make sure its a valid channel number */
+@@ -3155,49 +3152,54 @@
+ return -EINVAL;
+ /* if channel not mapped, not there */
+ if (!chans[j]) return -EINVAL;
+- /* lock irq state */
++ chan = kmalloc(sizeof(struct zt_chan), GFP_KERNEL);
++ if (!chan)
++ return -ENOMEM;
++
++ /* lock channel */
+ spin_lock_irqsave(&chans[j]->lock, flags);
+ /* make static copy of channel */
+- memcpy(&mychan,chans[j],sizeof(struct zt_chan));
+- /* let irq's go */
++ memcpy(chan,chans[j],sizeof(struct zt_chan));
++ /* release it. */
+ spin_unlock_irqrestore(&chans[j]->lock, flags);
++
+ printk("Dump of Zaptel Channel %d (%s,%d,%d):\n\n",j,
+- mychan.name,mychan.channo,mychan.chanpos);
++ chan->name,chan->channo,chan->chanpos);
+ printk("flags: %x hex, writechunk: %08lx, readchunk: %08lx\n",
+- mychan.flags, (long) mychan.writechunk, (long) mychan.readchunk);
++ chan->flags, (long) chan->writechunk, (long) chan->readchunk);
+ printk("rxgain: %08lx, txgain: %08lx, gainalloc: %d\n",
+- (long) mychan.rxgain, (long)mychan.txgain, mychan.gainalloc);
++ (long) chan->rxgain, (long)chan->txgain, chan->gainalloc);
+ printk("span: %08lx, sig: %x hex, sigcap: %x hex\n",
+- (long)mychan.span, mychan.sig, mychan.sigcap);
++ (long)chan->span, chan->sig, chan->sigcap);
+ printk("inreadbuf: %d, outreadbuf: %d, inwritebuf: %d, outwritebuf: %d\n",
+- mychan.inreadbuf, mychan.outreadbuf, mychan.inwritebuf, mychan.outwritebuf);
++ chan->inreadbuf, chan->outreadbuf, chan->inwritebuf, chan->outwritebuf);
+ printk("blocksize: %d, numbufs: %d, txbufpolicy: %d, txbufpolicy: %d\n",
+- mychan.blocksize, mychan.numbufs, mychan.txbufpolicy, mychan.rxbufpolicy);
++ chan->blocksize, chan->numbufs, chan->txbufpolicy, chan->rxbufpolicy);
+ printk("txdisable: %d, rxdisable: %d, iomask: %d\n",
+- mychan.txdisable, mychan.rxdisable, mychan.iomask);
++ chan->txdisable, chan->rxdisable, chan->iomask);
+ printk("curzone: %08lx, tonezone: %d, curtone: %08lx, tonep: %d\n",
+- (long) mychan.curzone, mychan.tonezone, (long) mychan.curtone, mychan.tonep);
++ (long) chan->curzone, chan->tonezone, (long) chan->curtone, chan->tonep);
+ printk("digitmode: %d, txdialbuf: %s, dialing: %d, aftdialtimer: %d, cadpos. %d\n",
+- mychan.digitmode, mychan.txdialbuf, mychan.dialing,
+- mychan.afterdialingtimer, mychan.cadencepos);
++ chan->digitmode, chan->txdialbuf, chan->dialing,
++ chan->afterdialingtimer, chan->cadencepos);
+ printk("confna: %d, confn: %d, confmode: %d, confmute: %d\n",
+- mychan.confna, mychan._confn, mychan.confmode, mychan.confmute);
++ chan->confna, chan->_confn, chan->confmode, chan->confmute);
+ printk("ec: %08lx, echocancel: %d, deflaw: %d, xlaw: %08lx\n",
+- (long) mychan.ec, mychan.echocancel, mychan.deflaw, (long) mychan.xlaw);
++ (long) chan->ec, chan->echocancel, chan->deflaw, (long) chan->xlaw);
+ printk("echostate: %02x, echotimer: %d, echolastupdate: %d\n",
+- (int) mychan.echostate, mychan.echotimer, mychan.echolastupdate);
++ (int) chan->echostate, chan->echotimer, chan->echolastupdate);
+ printk("itimer: %d, otimer: %d, ringdebtimer: %d\n\n",
+- mychan.itimer,mychan.otimer,mychan.ringdebtimer);
++ chan->itimer,chan->otimer,chan->ringdebtimer);
+ #if 0
+- if (mychan.ec) {
++ if (chan->ec) {
+ int x;
+ /* Dump the echo canceller parameters */
+- for (x=0;x<mychan.ec->taps;x++) {
+- printk("tap %d: %d\n", x, mychan.ec->fir_taps[x]);
++ for (x=0;x<chan->ec->taps;x++) {
++ printk("tap %d: %d\n", x, chan->ec->fir_taps[x]);
+ }
+ }
++ kfree(chan)
+ #endif
+-#endif /* ALLOW_CHAN_DIAG */
+ break;
+ default:
+ return -ENOTTY;
Property changes on: zaptel/trunk/debian/patches/ztdiag.dpatch
___________________________________________________________________
Name: svn:executable
+ *
Modified: zaptel/trunk/debian/rules
===================================================================
--- zaptel/trunk/debian/rules 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/rules 2007-03-24 18:18:32 UTC (rev 3325)
@@ -122,14 +122,9 @@
$(MAKE) install-programs INSTALL_PREFIX=$(CURDIR)/debian/tmp
$(MAKE) -C xpp/utils install DESTDIR=$(CURDIR)/debian/tmp
/sbin/ldconfig -n $(CURDIR)/debian/tmp/usr/lib
- install -m 644 zaptel.conf.sample $(CURDIR)/debian/tmp/etc/zaptel.conf
dh_install -a --sourcedir=$(CURDIR)/debian/tmp
- # using m_ prefix because the name "zaptel.rules" comes even
- # after z99_hal.rules.
- cp $(CURDIR)/debian/zaptel.udev.rules \
- $(CURDIR)/debian/$(PREFIX)/etc/udev/rules.d/m_zaptel.rules
cp debian/$(PREFIX).lintian \
$(CURDIR)/debian/$(PREFIX)/usr/share/lintian/overrides/$(PREFIX)
Modified: zaptel/trunk/debian/zaptel.init
===================================================================
--- zaptel/trunk/debian/zaptel.init 2007-03-24 17:41:30 UTC (rev 3324)
+++ zaptel/trunk/debian/zaptel.init 2007-03-24 18:18:32 UTC (rev 3325)
@@ -20,6 +20,12 @@
NAME=zaptel
DESC="Zaptel telephony kernel driver"
FXOTUNE=/usr/sbin/fxotune
+# defined in /etc/default/zaptel
+# ZAPTEL_MODS is a list of modules to be loaded at startup
+# However be aware that chances are that the zaptel hardware will
+# be detected automatically by hotplug/udev . If you want to affect
+# the order that modules load, add them to /etc/modules.
+ZAPTEL_MODS=
# Include am defaults if available
if [ -f /etc/default/zaptel ] ; then
@@ -36,56 +42,34 @@
exit 0
fi
-# defined in /etc/default/zaptel
-# ZAPTEL_MODS is a list of modules to be loaded at startup
-set -e
+# this checks that:
+# A. /dev/zap/pseudo exists (if devfs/udev is in use, it implies zaptel loaded)
+# B. Readable to the user running this script. No poblem if run by root.
+# C. There is an active zaptel timing source. Either a zaptel hardware
+# device or ztdummy.
+test_zaptel_timing() {
+ head -c 0 /dev/zap/pseudo 2>/dev/null
+}
-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
-}
+set -e
-fix_asterisbank_sync() {
- # do nothing if module not present
- if [ ! -d /proc/xpp ]; then return; fi
+# Initialize the Xorcom Astribank (xpp/)
+xpp_startup() {
+ # do nothing if the module xpp was not loaded
+ if [ ! -d /proc/xpp ]; then return 0; fi
+
+ echo "Waiting for Astribank devices to initialize:"
+ cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true
- #if ! grep -q '^HOST' /proc/xpp/sync 2>/dev/null; then return; fi
+ # overriding locales for the above two, as perl can be noisy
+ # when locales are missing.
+ # No register all the devices if they didn't auto-register:
+ LC_ALL=C zt_registration on
- 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`
-
- # do nothing if there is no bus:
- case "$bus" in [0-9]*):;; *) return;; esac
- sync_value="$bus 0"
- ;;
- 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 (used XPP_SYNC='$XPP_SYNC')"
- fi
+ # this one could actually be run after ztcfg:
+ LC_ALL=C xpp_sync "$XPP_SYNC"
}
# recursively unload a module and its dependencies, if possible.
@@ -100,8 +84,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:
- 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:
(unload_module $mod)
@@ -110,36 +93,14 @@
set -e
}
-# 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:
- # TODO: improve error reporting and produce a messagee here
- cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
- fi
-}
-
-# this checks that:
-# A. /dev/zap/pseudo exists (if devfs/udev is in use, it implies zaptel loaded)
-# B. Readable to the user running this script. No poblem if run by root.
-# C. There is an active zaptel timing source. Either a zaptel hardware
-# device or ztdummy.
-test_zaptel_timing() {
- head -c 0 /dev/zap/pseudo 2>/dev/null
-}
-
case "$1" in
start|reload)
echo -n "$DESC: "
- #for module in $ZAPTEL_MODS
- #do
- # modprobe $module
- #done
- wait_for_xpp
- zap_reg_xpp
- fix_asterisbank_sync
+ for module in $ZAPTEL_MODS
+ do
+ modprobe $module
+ done
+ xpp_startup
# If there is no zaptel timing source, load
# ztdummy. Other modules should have been loaded by
@@ -162,7 +123,7 @@
unload_module zaptel
;;
status)
- check_zaptel_timing
+ test_zaptel_timing
;;
force-reload|restart)
# there's no 'stop'
@@ -170,7 +131,7 @@
;;
*)
N=/etc/init.d/$NAME
- echo "Usage: $N {start|stop|restart|force-reload|status|unload}" >&2
+ echo "Usage: $N {start|stop|restart|force-reload|status|unload|status}" >&2
exit 1
;;
esac
More information about the Pkg-voip-commits
mailing list