summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Knoblich <stkn@gentoo.org>2005-03-10 00:19:16 +0000
committerStefan Knoblich <stkn@gentoo.org>2005-03-10 00:19:16 +0000
commitc6a19dd3d52e1fbd906193d5e474d69ec151609a (patch)
tree24af25af1b121c74a082971640c8d42960187353 /net-misc/zaptel
parentmore 2.10 stuff (diff)
downloadgentoo-2-c6a19dd3d52e1fbd906193d5e474d69ec151609a.tar.gz
gentoo-2-c6a19dd3d52e1fbd906193d5e474d69ec151609a.tar.bz2
gentoo-2-c6a19dd3d52e1fbd906193d5e474d69ec151609a.zip
New version. Adds bristuff support.
(Portage version: 2.0.51-r15)
Diffstat (limited to 'net-misc/zaptel')
-rw-r--r--net-misc/zaptel/ChangeLog8
-rw-r--r--net-misc/zaptel/files/digest-zaptel-1.0.63
-rw-r--r--net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC7k.patch191
-rw-r--r--net-misc/zaptel/zaptel-1.0.6.ebuild213
4 files changed, 414 insertions, 1 deletions
diff --git a/net-misc/zaptel/ChangeLog b/net-misc/zaptel/ChangeLog
index a02db2c4eb68..b14e7a500e0c 100644
--- a/net-misc/zaptel/ChangeLog
+++ b/net-misc/zaptel/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-misc/zaptel
# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/ChangeLog,v 1.31 2005/02/14 20:23:45 stkn Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/ChangeLog,v 1.32 2005/03/10 00:19:16 stkn Exp $
+
+*zaptel-1.0.6 (10 Mar 2005)
+
+ 10 Mar 2005; Stefan Knoblich <stkn@gentoo.org>
+ +files/zaptel-bristuff-0.2.0-RC7k.patch, +zaptel-1.0.6.ebuild:
+ New version. Adds bristuff (+florz patches) support.
14 Feb 2005; Stefan Knoblich <stkn@gentoo.org>
+files/zaptel-1.0.4-experimental-devfs26.diff, zaptel-1.0.4.ebuild:
diff --git a/net-misc/zaptel/files/digest-zaptel-1.0.6 b/net-misc/zaptel/files/digest-zaptel-1.0.6
new file mode 100644
index 000000000000..cfa408f2679f
--- /dev/null
+++ b/net-misc/zaptel/files/digest-zaptel-1.0.6
@@ -0,0 +1,3 @@
+MD5 4f6b2627b45537774ac1aba3c17624c6 zaptel-1.0.6.tar.gz 316568
+MD5 b07d5f949b90677a2925ba2dd50593cb bristuff-0.2.0-RC7k.tar.gz 114265
+MD5 510ab7103516fd574fd5f38db2a08c81 zaphfc_0.2.0-RC7j_florz-4.diff.gz 10204
diff --git a/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC7k.patch b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC7k.patch
new file mode 100644
index 000000000000..b622ba8f19e9
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC7k.patch
@@ -0,0 +1,191 @@
+diff -ur zaptel-1.0.6.orig/Makefile zaptel-1.0.6/Makefile
+--- zaptel-1.0.6.orig/Makefile 2005-02-07 05:20:33.000000000 +0100
++++ zaptel-1.0.6/Makefile 2005-02-28 10:58:47.381479600 +0100
+@@ -334,7 +334,7 @@
+
+ clean:
+ rm -f torisatool makefw tor2fw.h
+- rm -f zttool
++ rm -f zttool ztspeed zttest ztmonitor
+ rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
+ rm -f $(TZOBJS) $(LIBTONEZONE) *.lo
+ rm -f *.ko *.mod.c .*o.cmd
+@@ -342,3 +342,4 @@
+ rm -f libtonezone*
+ rm -f tor2ee
+ rm -f core
++ rm -rf .tmp_versions
+diff -ur zaptel-1.0.6.orig/zaptel.c zaptel-1.0.6/zaptel.c
+--- zaptel-1.0.6.orig/zaptel.c 2005-01-17 02:58:09.000000000 +0100
++++ zaptel-1.0.6/zaptel.c 2005-02-28 10:58:47.389478384 +0100
+@@ -4775,11 +4775,40 @@
+ *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
+ }
+ bytes -= left;
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ /*
++ * Let's get this right, we want to transmit complete frames only.
++ * The card driver will do the dirty HDLC work for us.
++ * txb (transmit buffer) is supposed to be big enough to store one frame
++ * we will make this as big as the D fifo (1KB or 2KB)
++ */
++
++ /* there are 'left' bytes in the user buffer left to transmit */
++ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
++ if (left > ms->maxbytes2transmit) {
++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
++ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
++ txb += ms->maxbytes2transmit;
++ ms->bytes2transmit = ms->maxbytes2transmit;
++ ms->eoftx = 0;
++ } else {
++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
++ ms->writeidx[ms->outwritebuf] += left + 2;
++ txb += left;
++ ms->bytes2transmit = left;
++ ms->eoftx = 1;
++ }
++ bytes = 0;
++#endif
+ } else {
+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
+ ms->writeidx[ms->outwritebuf]+=left;
+ txb += left;
+ bytes -= left;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ ms->bytes2transmit=ZT_CHUNKSIZE;
++#endif
+ }
+ /* Check buffer status */
+ if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
+@@ -4824,6 +4853,17 @@
+ /* Transmit a flag if this is an HDLC channel */
+ if (ms->flags & ZT_FLAG_HDLC)
+ fasthdlc_tx_frame_nocheck(&ms->txhdlc);
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ if(ms->flags & ZT_FLAG_BRIDCHAN) {
++ // if (ms->bytes2transmit > 0) {
++ // txb += 2;
++ // ms->bytes2transmit -= 2;
++ bytes=0;
++ ms->eoftx = 1;
++// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
++ // }
++ }
++#endif
+ #ifdef CONFIG_ZAPATA_NET
+ if (ms->flags & ZT_FLAG_NETDEV)
+ netif_wake_queue(ztchan_to_dev(ms));
+@@ -4834,7 +4874,7 @@
+ tasklet_schedule(&ms->ppp_calls);
+ }
+ #endif
+- }
++ }
+ } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) {
+ left = ms->curtone->tonesamples - ms->tonep;
+ if (left > bytes)
+@@ -4872,8 +4912,17 @@
+ } else if (ms->flags & ZT_FLAG_CLEAR) {
+ /* Clear channels should idle with 0xff for the sake
+ of silly PRI's that care about idle B channels */
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ // ms->bytes2transmit=0;
++#endif
+ memset(txb, 0xff, bytes);
+ bytes = 0;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
++ // ms->bytes2transmit = ZT_CHUNKSIZE - bytes;
++ bytes = 0;
++ if (ms->bytes2transmit > 0) printk(KERN_CRIT "bytes2transmit %d\n",ms->bytes2transmit);
++#endif
+ } else {
+ memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
+ bytes = 0;
+@@ -5533,6 +5582,13 @@
+ int left, x;
+
+ int bytes = ZT_CHUNKSIZE;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ bytes = ms->bytes2receive;
++ if (bytes < 1) return;
++// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
++ }
++#endif
+
+ while(bytes) {
+ #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
+@@ -5591,6 +5647,19 @@
+ }
+ }
+ }
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
++ rxb += left;
++ ms->readidx[ms->inreadbuf] += left;
++ bytes -= left;
++ if (ms->eofrx == 1) {
++ eof=1;
++ }
++// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
++ ms->bytes2receive = 0;
++ ms->eofrx = 0;
++#endif
+ } else {
+ /* Not HDLC */
+ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
+diff -ur zaptel-1.0.6.orig/zaptel.h zaptel-1.0.6/zaptel.h
+--- zaptel-1.0.6.orig/zaptel.h 2004-09-27 21:50:03.000000000 +0200
++++ zaptel-1.0.6/zaptel.h 2005-02-28 10:58:47.392477928 +0100
+@@ -932,6 +932,13 @@
+ int do_ppp_error;
+ struct sk_buff_head ppp_rq;
+ #endif
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ int bytes2receive;
++ int maxbytes2transmit; /* size of the tx buffer in the card driver */
++ int bytes2transmit;
++ int eofrx;
++ int eoftx;
++#endif
+ spinlock_t lock;
+ char name[40]; /* Name */
+ /* Specified by zaptel */
+@@ -1006,7 +1013,7 @@
+ int txbufpolicy; /* Buffer policy */
+ int rxbufpolicy; /* Buffer policy */
+ int txdisable; /* Disable transmitter */
+- int rxdisable; /* Disable receiver */
++ int rxdisable; /* Disable receiver */
+
+
+ /* Tone zone stuff */
+@@ -1169,6 +1176,10 @@
+ #define ZT_FLAG_T1PPP (1 << 15)
+ #define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
+
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++#define ZT_FLAG_BRIDCHAN (1 << 17)
++#endif
++
+ struct zt_span {
+ spinlock_t lock;
+ void *pvt; /* Private stuff */
+diff -ur zaptel-1.0.6.orig/zconfig.h zaptel-1.0.6/zconfig.h
+--- zaptel-1.0.6.orig/zconfig.h 2005-01-02 01:19:57.000000000 +0100
++++ zaptel-1.0.6/zconfig.h 2005-02-28 10:58:47.393477776 +0100
+@@ -127,4 +127,10 @@
+ */
+ /* #define TDM_REVH_MATCHALL */
+
++/*
++ * Uncomment the following for BRI D channels
++ *
++ */
++#define CONFIG_ZAPATA_BRI_DCHANS
++
+ #endif
diff --git a/net-misc/zaptel/zaptel-1.0.6.ebuild b/net-misc/zaptel/zaptel-1.0.6.ebuild
new file mode 100644
index 000000000000..38c79f2da57b
--- /dev/null
+++ b/net-misc/zaptel/zaptel-1.0.6.ebuild
@@ -0,0 +1,213 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/zaptel-1.0.6.ebuild,v 1.1 2005/03/10 00:19:16 stkn Exp $
+
+IUSE="devfs26 bri florz"
+
+inherit toolchain-funcs eutils linux-mod
+
+BRI_VERSION="0.2.0-RC7k"
+FLORZ_VERSION="0.2.0-RC7j_florz-4"
+
+DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
+HOMEPAGE="http://www.asterisk.org"
+SRC_URI="ftp://ftp.asterisk.org/pub/telephony/zaptel/zaptel-${PV}.tar.gz
+ bri? http://www.junghanns.net/asterisk/downloads/bristuff-${BRI_VERSION}.tar.gz
+ florz? http://zaphfc.florz.dyndns.org/zaphfc_${FLORZ_VERSION}.diff.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~ppc ~amd64"
+
+DEPEND="virtual/libc
+ virtual/linux-sources
+ >=dev-libs/newt-0.50.0"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ # show an nice warning message about zaptel not supporting devfs on 2.6
+ if kernel_is 2 6 && linux_chkconfig_present DEVFS_FS ; then
+ echo
+ einfo "You're using a 2.6 kernel with DEVFS."
+ einfo "The Zaptel drivers won't work unless you either:"
+ einfo " * switch to udev"
+ einfo " * write a script that re-creates the necessary device nodes for you"
+ einfo " * enable the devfs26 useflag (see below)"
+ einfo ""
+ einfo "There's an experimental patch which adds devfs support when using linux-2.6, but:"
+ einfo " 1. It's an ugly hack atm and needs a cleanup..."
+ einfo " 2. I was only abled to test loding / unloading with the ztd-eth driver..."
+ einfo " 3. I _really_ don't know if it works with real hardware..."
+ einfo " 4. It disables udev support to avoid conflicts"
+ eerror " 5. And more important: This is not officially supported by Digium / the Asterisk project!"
+ einfo ""
+ einfo "If you're still interested, abort now (ctrl+c) and enable the devfs26 USE-flag"
+ einfo "Feedback and bug-reports should go to: stkn@gentoo.org"
+ einfo "You have been warned!"
+ echo
+ einfo "Sleeping 20 Seconds..."
+ epause 20
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+
+ cd ${S}
+ # >= 1.0.3 requires new patch (-modulesd patch renamed to -gentoo)
+ epatch ${FILESDIR}/${PN}-1.0.3-gentoo.diff
+
+ # remove all from install target
+ sed -i -e "s#^\(install:\)[ \t]\+all[ \t]\+\(.*\)#\1 \2#" Makefile
+
+ # enable ztdummy...
+ sed -i -e "s:#\( ztdummy.*\):\1:" Makefile
+
+ # devfs support
+ if use devfs26; then
+ einfo "Enabling experimental devfs support for linux-2.6..."
+ epatch ${FILESDIR}/${PN}-1.0.4-experimental-devfs26.diff
+
+ # disable udev
+ sed -i -e "s:#define[\t ]\+\(CONFIG_ZAP_UDEV\):#undef \1:" \
+ zconfig.h
+ fi
+
+ # apply patch for gcc-3.4.x if that's the compiler in use...
+ # fixes (#76707)
+ if use x86 && [[ `gcc-fullversion` = "3.4.3" ]]; then
+ epatch ${FILESDIR}/${P}-gcc34.patch
+ fi
+
+ # try to apply bristuff patch
+ if use bri; then
+ einfo "Patching zaptel w/ BRI stuff (${BRI_VERSION})"
+ epatch ${FILESDIR}/zaptel-bristuff-${BRI_VERSION}.patch
+
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+
+ if use florz; then
+ einfo "Using florz patches (${FLORZ_VERSION}) for zaphfc"
+ epatch ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
+ fi
+
+ # patch includes
+ sed -i -e "s:^#include.*zaptel\.h.*:#include <zaptel.h>:" \
+ qozap/qozap.c \
+ zaphfc/zaphfc.c
+
+ # patch makefiles
+ sed -i -e "s:^ZAP[\t ]*=.*:ZAP=-I${S}:" \
+ -e "s:^MODCONF=.*:MODCONF=/etc/modules.d/zaptel:" \
+ -e "s:linux-2.6:linux:g" \
+ qozap/Makefile \
+ zaphfc/Makefile
+
+ sed -i -e "s:^\(CFLAGS+=-I. \).*:\1 \$(ZAP):" \
+ zaphfc/Makefile
+ fi
+
+}
+
+src_compile() {
+ # TODO: bristuff modules
+
+ set_arch_to_kernel
+ make || die
+
+ if use bri; then
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+ make -C qozap || die
+ make -C zaphfc || die
+ fi
+ set_arch_to_portage
+}
+
+src_install() {
+ make INSTALL_PREFIX=${D} install || die
+
+ dodoc ChangeLog README README.udev README.Linux26 README.fxsusb zaptel.init
+ dodoc zaptel.conf.sample LICENSE zaptel.sysconfig
+
+ # additional tools
+ dobin ztmonitor ztspeed zttest
+
+ if use bri; then
+ einfo "Installing bri"
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+
+ insinto /lib/modules/${KV_FULL}/misc
+ doins qozap/qozap.${KV_OBJ}
+ doins zaphfc/zaphfc.${KV_OBJ}
+
+ # install example configs for octoBRI and quadBRI
+ insinto /etc
+ doins qozap/zaptel.conf.octoBRI
+ newins qozap/zaptel.conf zaptel.conf.quadBRI
+ newins zaphfc/zaptel.conf zaptel.conf.zaphfc
+
+ insinto /etc/asterisk
+ doins qozap/zapata.conf.octoBRI
+ newins qozap/zapata.conf zapata.conf.quadBRI
+ newins zaphfc/zapata.conf zapata.conf.zaphfc
+
+ docinto bristuff
+ dodoc CHANGES INSTALL README-ZAPHFC-USERS.1st
+
+ docinto bristuff/qozap
+ dodoc qozap/LICENSE qozap/TODO qozap/*.conf*
+
+ docinto bristuff/zaphfc
+ dodoc zaphfc/LICENSE zaphfc/*.conf
+ fi
+
+ # install init script
+ exeinto /etc/init.d
+ newexe ${FILESDIR}/zaptel.rc6 zaptel
+ insinto /etc/conf.d
+ newins ${FILESDIR}/zaptel.confd zaptel
+}
+
+pkg_postinst() {
+ if use devfs26; then
+ ewarn "*** Warning! ***"
+ ewarn "Devfs support for linux-2.6 is experimental and not"
+ ewarn "supported by digium or the asterisk project!"
+ echo
+ ewarn "Send bug-reports to: stkn@gentoo.org"
+ fi
+
+ echo
+ einfo "Use the /etc/init.d/zaptel script to load zaptel.conf settings on startup!"
+ echo
+
+ # devfs26 disables udev ... so don't nag users
+ if ! use devfs26; then
+# FIXME!! Can we (we should) do this automatically
+ einfo "If you're using udev add the following to"
+ einfo "/etc/udev/rules.d/50-udev.rules (as in README.udev):"
+ einfo "# Section for zaptel device"
+ einfo "KERNEL=\"zapctl\", NAME=\"zap/ctl\""
+ einfo "KERNEL=\"zaptimer\", NAME=\"zap/timer\""
+ einfo "KERNEL=\"zapchannel\", NAME=\"zap/channel\""
+ einfo "KERNEL=\"zappseudo\", NAME=\"zap/pseudo\""
+ einfo "KERNEL=\"zap[0-9]*\", NAME=\"zap/%n\""
+ echo
+ fi
+
+ if use bri; then
+ einfo "Bristuff configs have been merged as:"
+ einfo ""
+ einfo "${ROOT}etc/"
+ einfo " zaptel.conf.zaphfc"
+ einfo " zaptel.conf.quadBRI"
+ einfo " zaptel.conf.octoBRI"
+ einfo ""
+ einfo "${ROOT}etc/asterisk/"
+ einfo " zapata.conf.zaphfc"
+ einfo " zapata.conf.quadBRI"
+ einfo " zapata.conf.octoBRI"
+ echo
+ fi
+}