[Pkg-voip-commits] r1159 - in zaptel/trunk/debian: . patches

Tzafrir Cohen tzafrir-guest at costa.debian.org
Wed Jan 11 19:25:58 UTC 2006


Author: tzafrir-guest
Date: 2006-01-11 19:25:56 +0000 (Wed, 11 Jan 2006)
New Revision: 1159

Added:
   zaptel/trunk/debian/patches/ukcid.dpatch
Modified:
   zaptel/trunk/debian/changelog
   zaptel/trunk/debian/patches/00list
Log:
ukcid.dpatch: uk Caller ID patch for X100P (zaptel part)


Modified: zaptel/trunk/debian/changelog
===================================================================
--- zaptel/trunk/debian/changelog	2006-01-11 19:14:59 UTC (rev 1158)
+++ zaptel/trunk/debian/changelog	2006-01-11 19:25:56 UTC (rev 1159)
@@ -2,6 +2,7 @@
 
   * Use KSRC as proposed on http://wiki.debian.org/KernelModulesPackaging to
     build zaptel kernel module (Closes: #343521)
+  * ukcid.dpatch: for UK Caller ID support (Zaptel part)
 
  -- Kilian Krause <kilian at debian.org>  Wed, 11 Jan 2006 18:01:39 +0100
 

Modified: zaptel/trunk/debian/patches/00list
===================================================================
--- zaptel/trunk/debian/patches/00list	2006-01-11 19:14:59 UTC (rev 1158)
+++ zaptel/trunk/debian/patches/00list	2006-01-11 19:25:56 UTC (rev 1159)
@@ -7,5 +7,6 @@
 #Makefile_xpp
 # touches the Makefile as well:
 echocan_env
+ukcid
 xpp
 bristuff-0.3.0-PRE1f

Added: zaptel/trunk/debian/patches/ukcid.dpatch
===================================================================
--- zaptel/trunk/debian/patches/ukcid.dpatch	2006-01-11 19:14:59 UTC (rev 1158)
+++ zaptel/trunk/debian/patches/ukcid.dpatch	2006-01-11 19:25:56 UTC (rev 1159)
@@ -0,0 +1,139 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## ukcid.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: UK Caller-ID patch from http://www.lusyn.com/asterisk/patches.html , 
+## DP: zaptel part
+
+ at DPATCH@
+diff -urNad zaptel-1.1.9.0beta2/zaptel.c /tmp/dpep.qnDT2q/zaptel-1.1.9.0beta2/zaptel.c
+--- zaptel-1.1.9.0beta2/zaptel.c	2005-10-04 23:34:36.000000000 +0300
++++ /tmp/dpep.qnDT2q/zaptel-1.1.9.0beta2/zaptel.c	2005-11-01 23:37:26.435046197 +0200
+@@ -734,6 +734,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;
+@@ -3955,11 +3969,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;
+@@ -4311,6 +4326,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);
+ 	}
+@@ -5575,6 +5613,15 @@
+ 		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
+ 	   back */
+diff -urNad zaptel-1.1.9.0beta2/zaptel.h /tmp/dpep.qnDT2q/zaptel-1.1.9.0beta2/zaptel.h
+--- zaptel-1.1.9.0beta2/zaptel.h	2005-10-27 18:05:07.000000000 +0200
++++ /tmp/dpep.qnDT2q/zaptel-1.1.9.0beta2/zaptel.h	2005-11-01 23:37:26.446044778 +0200
+@@ -143,6 +143,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
+ 
+@@ -289,6 +291,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 */
+@@ -604,6 +611,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)
+@@ -1039,6 +1051,10 @@
+ 	
+ 	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) */
+ 	unsigned int	eventbuf[ZT_MAX_EVENTSIZE];  /* event circ. buffer */


Property changes on: zaptel/trunk/debian/patches/ukcid.dpatch
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-voip-commits mailing list