summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Knoblich <stkn@gentoo.org>2005-12-02 03:32:51 +0000
committerStefan Knoblich <stkn@gentoo.org>2005-12-02 03:32:51 +0000
commit04e2783a4c5a37e422cfb4b90ed42d381b7e4bf5 (patch)
tree3b41c0865ddb424352433179072e064ee64cbfba /net-misc
parentRevision bumped, new bristuff version (RC8q). (diff)
downloadgentoo-2-04e2783a4c5a37e422cfb4b90ed42d381b7e4bf5.tar.gz
gentoo-2-04e2783a4c5a37e422cfb4b90ed42d381b7e4bf5.tar.bz2
gentoo-2-04e2783a4c5a37e422cfb4b90ed42d381b7e4bf5.zip
New version, uk callerid support for x100p clones added, ebuild cleanups, new bristuff version (RC8q).
(Portage version: 2.0.51.22-r2)
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/zaptel/ChangeLog13
-rw-r--r--net-misc/zaptel/files/digest-zaptel-1.0.102
-rw-r--r--net-misc/zaptel/files/zaptel-1.0.10-devfs26.diff220
-rw-r--r--net-misc/zaptel/files/zaptel-1.0.10-gentoo.diff116
-rw-r--r--net-misc/zaptel/files/zaptel-1.0.10-ukcid.patch139
-rw-r--r--net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8q.patch191
-rw-r--r--net-misc/zaptel/zaptel-1.0.10.ebuild258
-rw-r--r--net-misc/zaptel/zaptel-1.0.9_p2.ebuild4
8 files changed, 940 insertions, 3 deletions
diff --git a/net-misc/zaptel/ChangeLog b/net-misc/zaptel/ChangeLog
index 0c46e5053d89..6fb4b25a4153 100644
--- a/net-misc/zaptel/ChangeLog
+++ b/net-misc/zaptel/ChangeLog
@@ -1,6 +1,17 @@
# 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.66 2005/11/20 21:36:46 stkn Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/ChangeLog,v 1.67 2005/12/02 03:32:51 stkn Exp $
+
+*zaptel-1.0.10 (02 Dec 2005)
+
+ 02 Dec 2005; Stefan Knoblich <stkn@gentoo.org>
+ +files/zaptel-bristuff-0.2.0-RC8q.patch,
+ +files/zaptel-1.0.10-devfs26.diff, +files/zaptel-1.0.10-gentoo.diff,
+ +files/zaptel-1.0.10-ukcid.patch, zaptel-1.0.9_p2.ebuild,
+ +zaptel-1.0.10.ebuild:
+ New version, bugfixes, new bristuff version (RC8q), several cleanups
+ and uk callerid support for x100p clones added. No florz patches for
+ 1.0.10 + RC8q available at the moment. Fixed SRC_URI in old ebuild.
20 Nov 2005; Stefan Knoblich <stkn@gentoo.org> zaptel-1.2.0.ebuild:
Re-enabled bri support.
diff --git a/net-misc/zaptel/files/digest-zaptel-1.0.10 b/net-misc/zaptel/files/digest-zaptel-1.0.10
new file mode 100644
index 000000000000..d272b0a9b4f2
--- /dev/null
+++ b/net-misc/zaptel/files/digest-zaptel-1.0.10
@@ -0,0 +1,2 @@
+MD5 a0ee0e7b276abe8ef88030d1252d6a3d zaptel-1.0.10.tar.gz 327832
+MD5 215dd795ce8ea72370b2e9d1bb7d8f6a bristuff-0.2.0-RC8q.tar.gz 152037
diff --git a/net-misc/zaptel/files/zaptel-1.0.10-devfs26.diff b/net-misc/zaptel/files/zaptel-1.0.10-devfs26.diff
new file mode 100644
index 000000000000..9b62e69764c1
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-1.0.10-devfs26.diff
@@ -0,0 +1,220 @@
+--- zaptel-1.0.10/zaptel.c.orig 2005-09-02 22:27:45.000000000 +0200
++++ zaptel-1.0.10/zaptel.c 2005-11-22 19:25:39.000000000 +0100
+@@ -148,12 +148,14 @@
+
+ /* Here are a couple important little additions for devfs */
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ static devfs_handle_t zaptel_devfs_dir;
+ static devfs_handle_t channel;
+ static devfs_handle_t pseudo;
+ static devfs_handle_t ctl;
+ static devfs_handle_t timer;
+ #endif
++#endif
+
+ /* udev necessary data structures. Yeah! */
+ #ifdef CONFIG_ZAP_UDEV
+@@ -1123,6 +1125,7 @@
+ }
+
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ static devfs_handle_t register_devfs_channel(struct zt_chan *chan, devfs_handle_t dir)
+ {
+ char path[100];
+@@ -1165,6 +1168,36 @@
+
+ return chan_dev;
+ }
++#else
++static dev_t register_devfs_channel(struct zt_chan *chan, dev_t dir)
++{
++#ifdef HAS_DEVFS_MK_SYMLINK
++ char link[100];
++ char path[100];
++#endif
++ dev_t chan_dev;
++ umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
++
++ /* create /dev/zap/span%d/%d channel device node */
++ if ((chan_dev = devfs_mk_cdev(MKDEV(ZT_MAJOR, chan->channo), mode, "zap/span%d/%d", dir, chan->chanpos)) < 0) {
++ printk("zaptel: Something really bad happened. Unable to register devfs entry\n");
++ return 0;
++ }
++
++#ifdef HAS_DEVFS_MK_SYMLINK
++ /* link /dev/zap/span%d/%d -> /dev/zap/%d ?!? */
++ sprintf(path, "zap/span%d/%d", dir, chan->chanpos);
++ sprintf(link, "zap/%d", chan->channo);
++ devfs_mk_symlink(link, path);
++#else
++ /* register /dev/zap/%d channel node directly */
++ if(devfs_mk_cdev(MKDEV(ZT_MAJOR, chan->channo), mode, "zap/%d", chan->channo) < 0) {
++ printk("zaptel: Unable to register compat devfs entry\n");
++ }
++#endif
++ return chan_dev;
++}
++#endif
+ #endif /* CONFIG_DEVFS_FS */
+
+ static int zt_chan_reg(struct zt_chan *chan)
+@@ -4404,6 +4437,7 @@
+ #endif
+
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ {
+ char span_name[50];
+ sprintf(span_name, "span%d", span->spanno);
+@@ -4413,6 +4447,15 @@
+ chan->fhandle = register_devfs_channel(chan, chan->span->dhandle); /* Register our stuff with devfs */
+ }
+ }
++#else
++ {
++ devfs_mk_dir("zap/span%d", span->spanno);
++ for (x = 0; x < span->channels; x++) {
++ struct zt_chan *chan = &span->chans[x];
++ register_devfs_channel(chan, span->spanno); /* Register our stuff with devfs */
++ }
++ }
++#endif
+ #endif /* CONFIG_DEVFS_FS */
+
+ #ifdef CONFIG_ZAP_UDEV
+@@ -4460,11 +4503,22 @@
+ remove_proc_entry(tempfile, NULL);
+ #endif /* CONFIG_PROC_FS */
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ for (x = 0; x < span->channels; x++) {
+ devfs_unregister(span->chans[x].fhandle);
+ devfs_unregister(span->chans[x].fhandle_symlink);
+ }
+ devfs_unregister(span->dhandle);
++#else
++ for (x = 0; x < span->channels; x++) {
++ /* remove symlink/compat device first */
++ devfs_remove("zap/%d", span->chans[x].channo);
++ /* remove channel device */
++ devfs_remove("zap/span%d/%d", span->spanno, span->chans[x].chanpos);
++ }
++ /* remove span dir */
++ devfs_remove("zap/span%d", span->spanno);
++#endif
+ #endif /* CONFIG_DEVFS_FS */
+
+ #ifdef CONFIG_ZAP_UDEV
+@@ -6452,6 +6506,7 @@
+ #endif /* CONFIG_ZAP_UDEV */
+
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ {
+ umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
+ devfs_register_chrdev(ZT_MAJOR, "zaptel", &zt_fops);
+@@ -6463,6 +6518,22 @@
+ ctl = devfs_register(zaptel_devfs_dir, "ctl", DEVFS_FL_DEFAULT, ZT_MAJOR, 0, mode, &zt_fops, NULL);
+ }
+ #else
++ {
++ umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
++ if ((res = register_chrdev(ZT_MAJOR, "zaptel", &zt_fops)) < 0) {
++ printk(KERN_ERR "Unable to register for device on %d, error: %d\n", ZT_MAJOR, res);
++ return res;
++ }
++
++ devfs_mk_dir("zap");
++
++ devfs_mk_cdev(MKDEV(ZT_MAJOR, 253), mode, "zap/timer");
++ devfs_mk_cdev(MKDEV(ZT_MAJOR, 254), mode, "zap/channel");
++ devfs_mk_cdev(MKDEV(ZT_MAJOR, 255), mode, "zap/pseudo");
++ devfs_mk_cdev(MKDEV(ZT_MAJOR, 0), mode, "zap/ctl");
++ }
++#endif
++#else
+ if ((res = register_chrdev(ZT_MAJOR, "zaptel", &zt_fops))) {
+ printk(KERN_ERR "Unable to register tor device on %d\n", ZT_MAJOR);
+ return res;
+@@ -6493,6 +6564,7 @@
+ if (tone_zones[x])
+ kfree(tone_zones[x]);
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ devfs_unregister(timer);
+ devfs_unregister(channel);
+ devfs_unregister(pseudo);
+@@ -6508,6 +6580,16 @@
+ class_destroy(zap_class);
+ #endif /* CONFIG_ZAP_UDEV */
+ unregister_chrdev(ZT_MAJOR, "zaptel");
++
++ devfs_remove("zap/timer");
++ devfs_remove("zap/ctl");
++ devfs_remove("zap/pseudo");
++ devfs_remove("zap/channel");
++
++ devfs_remove("zap");
++#endif
++#else
++ unregister_chrdev(ZT_MAJOR, "zaptel");
+ #endif
+ #ifdef CONFIG_ZAPTEL_WATCHDOG
+ watchdog_cleanup();
+--- zaptel-1.0.10/zaptel.h.orig 2005-11-15 15:28:44.000000000 +0100
++++ zaptel-1.0.10/zaptel.h 2005-11-22 19:25:39.000000000 +0100
+@@ -52,18 +52,17 @@
+ #define zap_pci_module pci_register_driver
+ #else
+ #define zap_pci_module pci_module_init
++/* devfs_mk_symlink has been removed in 2.6.10 */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++#define HAS_DEVFS_MK_SYMLINK
++#endif
+ #endif
+
+ #include "ecdis.h"
+ #include "fasthdlc.h"
+ #endif
+ #ifdef CONFIG_DEVFS_FS
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+ #include <linux/devfs_fs_kernel.h>
+-#else
+-#undef CONFIG_DEVFS_FS
+-//#warning "Zaptel doesn't support DEVFS in post 2.4 kernels. Disabling DEVFS in zaptel"
+-#endif
+ #endif /* CONFIG_DEVFS_FS */
+ #include <linux/ioctl.h>
+
+@@ -71,6 +70,8 @@
+ #define ELAST 500
+ #endif
+
++
++
+ /* Per-span configuration values */
+ #define ZT_CONFIG_TXLEVEL 7 /* bits 0-2 are tx level */
+
+@@ -1153,8 +1154,10 @@
+ #endif
+
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ devfs_handle_t fhandle; /* File handle in devfs for the channel */
+ devfs_handle_t fhandle_symlink;
++#endif
+ #endif /* CONFIG_DEVFS_FS */
+ };
+
+@@ -1290,7 +1293,9 @@
+ int lastalarms; /* Previous alarms */
+
+ #ifdef CONFIG_DEVFS_FS
++#ifndef LINUX26
+ devfs_handle_t dhandle; /* Directory name */
++#endif
+ #endif
+ /* If the watchdog detects no received data, it will call the
+ watchdog routine */
diff --git a/net-misc/zaptel/files/zaptel-1.0.10-gentoo.diff b/net-misc/zaptel/files/zaptel-1.0.10-gentoo.diff
new file mode 100644
index 000000000000..4724762e8916
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-1.0.10-gentoo.diff
@@ -0,0 +1,116 @@
+--- zaptel-1.0.10/Makefile.orig 2005-11-04 06:03:38.000000000 +0100
++++ zaptel-1.0.10/Makefile 2005-11-22 19:14:05.000000000 +0100
+@@ -15,13 +15,13 @@
+ HOSTCC=gcc
+ # If you want to build for a kernel other than the current kernel,set KVERS
+ KVERS?=`uname -r`
+-KINCLUDES=$(shell if [ -d /usr/src/linux-2.4/include ]; then echo /usr/src/linux-2.4/include ; else echo /usr/src/linux/include ; fi)
++KINCLUDES=/usr/src/linux/include
+
+-CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
++CFLAGS+=-I. -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+ CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
+ CFLAGS+=$(shell if uname -m | grep -q x86_64; then echo "-m64"; fi)
+ LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
+-KFLAGS+=-I/usr/src/linux-2.4/include -O6
++KFLAGS+=-I/usr/src/linux/include -O6
+ KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I/usr/src/linux/drivers/net \
+ -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I/usr/src/linux/drivers/net/wan -I /usr/src/linux/include -I/usr/src/linux/include/net
+ KFLAGS+=$(shell if [ -f $(KINCLUDES)/linux/modversions.h ] ; then echo "-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h" ; fi)
+@@ -41,7 +41,7 @@
+ CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
+
+ BUILDVER=$(shell if echo -n $(KVERS) | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi)
+-MODCONF=$(shell if [ -d $(ROOT_PREFIX)/etc/modprobe.d ]; then echo "$(ROOT_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(ROOT_PREFIX)/etc/modutils ]; then echo "$(ROOT_PREFIX)/etc/modutils/zaptel"; elif [ -f $(ROOT_PREFIX)/etc/modprobe.conf ]; then echo "$(ROOT_PREFIX)/etc/modprobe.conf"; elif [ -f $(ROOT_PREFIX)/etc/modules.conf ]; then echo "$(ROOT_PREFIX)/etc/modules.conf"; else echo $(ROOT_PREFIX)/etc/conf.modules ; fi)
++MODCONF=$(INSTALL_PREFIX)/etc/modules.d/zaptel
+
+ ifeq (${BUILDVER},linux24)
+ #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
+@@ -60,7 +60,7 @@
+ TZOBJS=zonedata.lo tonezone.lo
+ LIBTONEZONE=libtonezone.so.1.0
+ MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \
+- ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp # ztdummy
++ ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp ztdummy
+ #MODULES+=wcfxsusb
+
+ MODULESO=$(shell for x in $(MODULES); do echo "$$x.o "; done )
+@@ -264,7 +264,7 @@
+ @echo "**** If you are running udev, read README.udev"
+ endif
+
+-install: all devices
++install: devices
+ install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
+ if [ -f sethdlc-new ]; then \
+ install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
+@@ -288,45 +288,24 @@
+ fi; \
+ fi
+ install -D -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE)
+- if [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE); fi
+ install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
+ install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux/torisa.h
+ install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
+ ( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
+- [ `id -u` = 0 ] && /sbin/ldconfig || :
+- if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi
+- cat $(MODCONF).bak | grep -v "alias char-major-250" | \
+- grep -v "post-install torisa /sbin/ztcfg" | \
+- grep -v "post-install wcfxsusb /sbin/ztcfg" | \
+- grep -v "alias wcfxs" | \
+- grep -v "post-install wcfxs /sbin/ztcfg" > $(MODCONF) || true
++ if [ ! -d `dirname $(MODCONF)` ]; then install -d -m 755 `dirname $(MODCONF)` ; fi
++ /sbin/ldconfig -n $(INSTALL_PREFIX)/usr/lib
+ if ! grep "options torisa" $(MODCONF); then \
+ echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
+ fi
+ if ! grep "alias char-major-196" $(MODCONF); then \
+ echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
+ fi
+- for x in $(MODULES); do \
+- if ! grep "post-install $$x" $(MODCONF); then \
+- if ! grep "install $$x " $(MODCONF); then \
+- if [ "$$x" != "zaptel" ] ; then \
+- if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /sbin/ztcfg" >> $(MODCONF); \
+- else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
+- fi; \
+- fi; \
+- fi; \
+- fi; \
+- done
+ if ! grep "alias wctdm" $(MODCONF); then \
+ echo "alias wctdm wcfxs" >> $(MODCONF); \
+ fi
+ if ! grep "alias wct2xxp" $(MODCONF); then \
+ echo "alias wct2xxp wct4xxp" >> $(MODCONF); \
+ fi
+- if [ -d /etc/modutils ]; then \
+- /sbin/update-modules ; \
+- fi
+- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
+ [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
+
+ config:
+--- zaptel-1.0.10/Makefile.orig 2005-11-22 19:22:28.000000000 +0100
++++ zaptel-1.0.10/Makefile 2005-11-22 19:23:34.000000000 +0100
+@@ -49,7 +49,7 @@
+ endif
+ ifeq (${BUILDVER},linux26)
+ #Tests for newer linux-2.6 udev support
+-DYNFS=$(shell ps ax | grep -v grep | grep udevd && echo "yes")
++DYNFS=$(shell ps ax | grep -v grep | grep -q "udevd\|devfsd" && echo "yes")
+ endif
+
+ CHKCONFIG=$(shell sh -c 'type -p chkconfig' 2> /dev/null)
+--- zaptel-1.0.10/Makefile.orig 2005-11-22 19:40:18.000000000 +0100
++++ zaptel-1.0.10/Makefile 2005-11-22 19:41:01.000000000 +0100
+@@ -200,7 +200,7 @@
+
+ $(LIBTONEZONE): $(TZOBJS)
+ $(CC) -shared -Wl,-soname,libtonezone.so.1 -lm -o $@ $(TZOBJS)
+- [ `id -u` = 0 ] && /sbin/ldconfig || :
++ /sbin/ldconfig -n .
+ ln -sf libtonezone.so.1 libtonezone.so
+
+ ztcfg.c: ztcfg.h
diff --git a/net-misc/zaptel/files/zaptel-1.0.10-ukcid.patch b/net-misc/zaptel/files/zaptel-1.0.10-ukcid.patch
new file mode 100644
index 000000000000..940abf8b0a98
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-1.0.10-ukcid.patch
@@ -0,0 +1,139 @@
+Index: zaptel.c
+===================================================================
+RCS file: /usr/cvsroot/zaptel/zaptel.c,v
+retrieving revision 1.95.2.1
+diff -u -r1.95.2.1 zaptel.c
+--- zaptel.c 6 Oct 2004 22:11:41 -0000 1.95.2.1
++++ zaptel.c 2 Nov 2004 10:59:16 -0000
+@@ -703,6 +703,20 @@
+ unsigned char *newbuf, *oldbuf;
+ unsigned long flags;
+ int x;
++
++ /* Allocate history buffer, or not. This probably shouldn't
++ * be here, but it's convenient */
++ if(!j)
++ {
++ if(ss->history) kfree(ss->history);
++ ss->history = NULL;
++ }
++ else
++ {
++ if(!ss->history) ss->history=kmalloc(ZT_HISTORY_BUF_LEN, GFP_KERNEL);
++ }
++ ss->historypos=0;
++
+ /* Check numbufs */
+ if (numbufs < 2)
+ numbufs = 2;
+@@ -3856,11 +3870,12 @@
+ {
+ struct zt_chan *chan = chans[unit];
+ unsigned long flags;
+- int j, rv;
++ int j, k1, k2, rv;
+ int ret;
+ int oldconf;
+ void *rxgain=NULL;
+ echo_can_state_t *ec, *tec;
++ struct zt_history hist;
+
+ if (!chan)
+ return -ENOSYS;
+@@ -4186,6 +4201,29 @@
+ return -EINVAL;
+ break;
+ #endif
++ case ZT_GET_HISTORY:
++ if (copy_from_user(&hist,(struct zt_history *) data,sizeof(hist)))
++ return -EIO;
++
++ if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL);
++ if (!chan->history) return -EINVAL;
++ j=hist.len;
++ k1=ZT_HISTORY_BUF_LEN-chan->historypos;
++ k2=chan->historypos;
++ if(j>0 && k1>0)
++ {
++ if (copy_to_user(hist.buf,chan->history+chan->historypos,min(j,k1)))
++ return -EIO;
++ j-=min(j,k1);
++ }
++ if(j>0 && k2>0)
++ {
++ if (copy_to_user(hist.buf+k1,chan->history,min(j,k2)))
++ return -EIO;
++ j-=min(j,k2);
++ }
++ /* Probably should assert j==0 here */
++ break;
+ default:
+ return zt_chanandpseudo_ioctl(inode, file, cmd, data, unit);
+ }
+@@ -5371,6 +5409,15 @@
+ if (!(ms->flags & ZT_FLAG_PSEUDO)) {
+ memcpy(ms->putlin, putlin, ZT_CHUNKSIZE * sizeof(short));
+ memcpy(ms->putraw, rxb, ZT_CHUNKSIZE);
++ }
++
++ /* Store in the history buffer */
++ if(ms->history)
++ {
++ memcpy(ms->history+ms->historypos,rxb,ZT_CHUNKSIZE);
++ ms->historypos+=ZT_CHUNKSIZE;
++ if(ms->historypos >= ZT_HISTORY_BUF_LEN)
++ ms->historypos=0;
+ }
+
+ /* Take the rxc, twiddle it for conferencing if appropriate and put it
+Index: zaptel.h
+===================================================================
+RCS file: /usr/cvsroot/zaptel/zaptel.h,v
+retrieving revision 1.38
+diff -u -r1.38 zaptel.h
+--- zaptel.h 27 Sep 2004 19:50:03 -0000 1.38
++++ zaptel.h 2 Nov 2004 10:59:17 -0000
+@@ -137,6 +137,8 @@
+ #define ZT_MAX_NUM_BUFS 32
+ #define ZT_MAX_BUF_SPACE 32768
+
++#define ZT_HISTORY_BUF_LEN 16384 /* Count of ulaw samples */
++
+ #define ZT_DEFAULT_BLOCKSIZE 1024
+ #define ZT_DEFAULT_MTR_MRU 2048
+
+@@ -277,6 +279,11 @@
+ int reserved[4]; /* Reserved for future expansion -- always set to 0 */
+ } ZT_DIAL_PARAMS;
+
++typedef struct zt_history
++{
++ unsigned char *buf; /* Sample buffer */
++ int len; /* Length of buffer, in bytes */
++} ZT_HISTORY;
+
+ typedef struct zt_dynamic_span {
+ char driver[20]; /* Which low-level driver to use */
+@@ -584,6 +591,11 @@
+ #define ZT_TIMERPONG _IOW (ZT_CODE, 53, int)
+
+ /*
++ * Return history buffer
++ */
++#define ZT_GET_HISTORY _IOR(ZT_CODE, 54, struct zt_history)
++
++/*
+ * Set/get signalling freeze
+ */
+ #define ZT_SIGFREEZE _IOW (ZT_CODE, 54, int)
+@@ -989,6 +1001,10 @@
+ wait_queue_head_t writebufq; /* write wait queue */
+
+ int blocksize; /* Block size */
++
++
++ u_char *history; /* History buffer, for pre-ring caller ID (ZT_HISTORY_BUF_LEN) */
++ u_short historypos; /* Current position within buffer */
+
+ int eventinidx; /* out index in event buf (circular) */
+ int eventoutidx; /* in index in event buf (circular) */
diff --git a/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8q.patch b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8q.patch
new file mode 100644
index 000000000000..d513f3eb5838
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8q.patch
@@ -0,0 +1,191 @@
+diff -ur zaptel-1.0.10.orig/Makefile zaptel-1.0.10/Makefile
+--- zaptel-1.0.10.orig/Makefile 2005-11-04 06:03:38.000000000 +0100
++++ zaptel-1.0.10/Makefile 2005-11-30 13:10:47.000000000 +0100
+@@ -346,7 +346,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
+@@ -354,3 +354,4 @@
+ rm -f libtonezone*
+ rm -f tor2ee
+ rm -f core
++ rm -rf .tmp_versions
+diff -ur zaptel-1.0.10.orig/zaptel.c zaptel-1.0.10/zaptel.c
+--- zaptel-1.0.10.orig/zaptel.c 2005-09-02 22:27:45.000000000 +0200
++++ zaptel-1.0.10/zaptel.c 2005-11-30 13:10:47.000000000 +0100
+@@ -4875,11 +4875,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]) {
+@@ -4924,6 +4953,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));
+@@ -4934,7 +4974,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)
+@@ -4972,8 +5012,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;
+@@ -5672,6 +5721,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)
+@@ -5730,6 +5786,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.10.orig/zaptel.h zaptel-1.0.10/zaptel.h
+--- zaptel-1.0.10.orig/zaptel.h 2005-11-15 15:28:44.000000000 +0100
++++ zaptel-1.0.10/zaptel.h 2005-11-30 13:10:47.000000000 +0100
+@@ -962,6 +962,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 */
+@@ -1036,7 +1043,7 @@
+ int txbufpolicy; /* Buffer policy */
+ int rxbufpolicy; /* Buffer policy */
+ int txdisable; /* Disable transmitter */
+- int rxdisable; /* Disable receiver */
++ int rxdisable; /* Disable receiver */
+
+
+ /* Tone zone stuff */
+@@ -1199,6 +1206,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.10.orig/zconfig.h zaptel-1.0.10/zconfig.h
+--- zaptel-1.0.10.orig/zconfig.h 2005-01-02 01:19:57.000000000 +0100
++++ zaptel-1.0.10/zconfig.h 2005-11-30 13:10:47.000000000 +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.10.ebuild b/net-misc/zaptel/zaptel-1.0.10.ebuild
new file mode 100644
index 000000000000..5040d4181f59
--- /dev/null
+++ b/net-misc/zaptel/zaptel-1.0.10.ebuild
@@ -0,0 +1,258 @@
+# 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.10.ebuild,v 1.1 2005/12/02 03:32:51 stkn Exp $
+
+IUSE="bri devfs26 rtc ukcid"
+
+inherit toolchain-funcs eutils linux-mod
+
+BRI_VERSION="0.2.0-RC8q"
+#FLORZ_VERSION="0.2.0-RC8o_florz-9"
+
+MY_PV="${PV/_p/.}"
+
+DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
+HOMEPAGE="http://www.asterisk.org"
+SRC_URI="http://ftp1.digium.com/pub/telephony/zaptel/zaptel-${MY_PV}.tar.gz
+ bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
+# florz? ( http://zaphfc.florz.dyndns.org/zaphfc_${FLORZ_VERSION}.diff.gz )"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+DEPEND="virtual/libc
+ virtual/linux-sources
+ >=dev-libs/newt-0.50.0"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+S_BRI="${WORKDIR}/bristuff-${BRI_VERSION}"
+
+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 disables udev support to avoid conflicts"
+ ewarn " 2. It is not 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}
+ # patch makefile(s) for gentoo
+ epatch ${FILESDIR}/${PN}-1.0.10-gentoo.diff
+
+ # devfs support
+ if use devfs26; then
+ einfo "Enabling experimental devfs support for linux-2.6..."
+ epatch ${FILESDIR}/${PN}-1.0.10-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}/${PN}-1.0.4-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 ${S_BRI}
+
+# 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 \
+ cwain/cwain.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 \
+ cwain/Makefile
+
+ sed -i -e "s:^\(CFLAGS+=-I. \).*:\1 \$(ZAP):" \
+ zaphfc/Makefile
+
+ # replace uname -r with $(KVERS)
+ # and add KVERS?="$(uname -r)" to all bristuff Makefiles
+ find ${S_BRI} -iname "Makefile" -exec sed -i \
+ -e "s:\`uname -r\`:\$(KVERS):g" \
+ -e "s:uname -r:echo -n \$(KVERS):g" \
+ -e "1 i KVERS?=\$(shell uname -r)" {} \;
+ fi
+
+
+ cd ${S}
+ #######################################################################
+ # apply other patches here,
+ # make sure they work with things that have been added before!
+ #
+
+ # apply x86 rtc patch for ztdummy (http://bugs.digium.com/view.php?id=4301)
+ # this won't have any effect on non-x86 systems...
+ if use rtc; then
+ if use x86 || use amd64; then
+ epatch ${FILESDIR}/${PN}-1.0.9-rtc.patch
+ else
+ ewarn "RTC is unsupported on your arch, skipping patch"
+ fi
+ fi
+
+
+ # UK callerid patch, adds support for british-telecoms callerid to x100p cards
+ # see http://www.lusyn.com/asterisk/patches.html for more information
+ use ukcid && \
+ epatch ${FILESDIR}/${PN}-1.0.10-ukcid.patch
+}
+
+src_compile() {
+ make \
+ KVERS=${KV_FULL} ARCH=$(tc-arch-kernel) \
+ KERNEL_SOURCE=/usr/src/linux || die
+
+ if use bri; then
+ cd ${S_BRI}
+ for x in cwain qozap zaphfc; do
+ make \
+ KVERS=${KV_FULL} \
+ ARCH=$(tc-arch-kernel) \
+ KERNEL_SOURCE=/usr/src/linux \
+ -C ${x} || die "make ${x} failed"
+ done
+ fi
+}
+
+src_install() {
+ make INSTALL_PREFIX=${D} ARCH=$(tc-arch-kernel) \
+ KVERS=${KV_FULL} KERNEL_SOURCE=/usr/src/linux 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
+
+ # install all header files for wanpipe
+ insinto /usr/include/zaptel
+ doins *.h
+
+ if use bri; then
+ einfo "Installing bri"
+ cd ${S_BRI}
+
+ insinto /lib/modules/${KV_FULL}/misc
+ doins qozap/qozap.${KV_OBJ}
+ doins zaphfc/zaphfc.${KV_OBJ}
+ doins cwain/cwain.${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
+
+ docinto bristuff/qozap
+ dodoc qozap/LICENSE qozap/TODO qozap/*.conf*
+
+ docinto bristuff/zaphfc
+ dodoc zaphfc/LICENSE zaphfc/*.conf
+
+ docinto bristuff/cwain
+ dodoc cwain/TODO cwain/LICENSE
+ fi
+
+ # install init script
+ newinitd ${FILESDIR}/zaptel.rc6 zaptel
+ newconfd ${FILESDIR}/zaptel.confd zaptel
+
+ # install devfsd rule file
+ insinto /etc/devfs.d
+ newins ${FILESDIR}/zaptel.devfsd zaptel
+
+ # install udev rule file
+ insinto /etc/udev/rules.d
+ newins ${FILESDIR}/zaptel.udevd 10-zaptel.rules
+
+ # fix permissions if there's no udev / devfs around
+ if [[ -d ${D}/dev/zap ]]; then
+ chown -R root:dialout ${D}/dev/zap
+ chmod -R u=rwX,g=rwX,o= ${D}/dev/zap
+ fi
+}
+
+pkg_postinst() {
+ linux-mod_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
+
+ 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
+
+ # fix permissions if there's no udev / devfs around
+ if [[ -d ${ROOT}/dev/zap ]]; then
+ chown -R root:dialout ${ROOT}/dev/zap
+ chmod -R u=rwX,g=rwX,o= ${ROOT}/dev/zap
+ fi
+}
diff --git a/net-misc/zaptel/zaptel-1.0.9_p2.ebuild b/net-misc/zaptel/zaptel-1.0.9_p2.ebuild
index 5fb105e993cc..4ff6e1a53d53 100644
--- a/net-misc/zaptel/zaptel-1.0.9_p2.ebuild
+++ b/net-misc/zaptel/zaptel-1.0.9_p2.ebuild
@@ -1,6 +1,6 @@
# 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.9_p2.ebuild,v 1.1 2005/09/15 02:29:49 stkn Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/zaptel-1.0.9_p2.ebuild,v 1.2 2005/12/02 03:32:51 stkn Exp $
IUSE="devfs26 bri florz rtc"
@@ -13,7 +13,7 @@ MY_PV="${PV/_p/.}"
DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
HOMEPAGE="http://www.asterisk.org"
-SRC_URI="ftp://ftp.digium.com/pub/telephony/zaptel/zaptel-${MY_PV}.tar.gz
+SRC_URI="ftp://ftp.digium.com/pub/telephony/zaptel/old/zaptel-${MY_PV}.tar.gz
bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )
florz? ( http://zaphfc.florz.dyndns.org/zaphfc_${FLORZ_VERSION}.diff.gz )"