[zaptel-commits] mattf: branch mattf/zaptel-1.4-raceandlockingfix r4182 - in /team/mattf/zapte...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Sat Apr 19 16:49:35 CDT 2008


Author: mattf
Date: Sat Apr 19 16:49:35 2008
New Revision: 4182

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4182
Log:
Merged revisions 4165-4170,4173,4175-4176 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

........
r4165 | tzafrir | 2008-04-10 11:15:23 -0500 (Thu, 10 Apr 2008) | 5 lines

Officially bumping xpp version (xpp/.version) to 5566 .

Merged revisions 4164 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

........
r4166 | tzafrir | 2008-04-10 13:11:51 -0500 (Thu, 10 Apr 2008) | 2 lines

zaptel_svn_tarball - get a tarball fron an SVN snapshot.

........
r4167 | sruffell | 2008-04-10 16:01:59 -0500 (Thu, 10 Apr 2008) | 2 lines

Fixed typo in makefile which was preventing make from installing the udev rules.

........
r4168 | dbailey | 2008-04-10 17:25:30 -0500 (Thu, 10 Apr 2008) | 3 lines

Correct problem where drivers implementing echocan_with_params was not getting called
to disable the echo canceller

........
r4169 | mattf | 2008-04-11 16:16:47 -0500 (Fri, 11 Apr 2008) | 1 line

Make sure that we disable the echo canceller on the old style echocan() function even if parameters are passed in.
........
r4170 | mattf | 2008-04-11 16:17:55 -0500 (Fri, 11 Apr 2008) | 1 line

Take out part of a commit to the wct4xxp driver that wasn't supposed to go in
........
r4173 | kpfleming | 2008-04-17 07:20:26 -0500 (Thu, 17 Apr 2008) | 6 lines

when processing ZT_SET_DIALPARAMS, don't return an error for out-of-range tone durations, just ignore them (so that applications that don't initialize the entire zt_dialparams structure won't fail to set the ones they do initialize)

(closes issue #12456)
Reported by: fnordian
Tested by: fnordian

........
r4175 | tzafrir | 2008-04-17 09:27:50 -0500 (Thu, 17 Apr 2008) | 5 lines

Avoid a double-free in ztdynamic.c ztdynamic_chanfree.diff from bug #12406 .

Merged revisions 4174 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

........
r4176 | jdixon | 2008-04-18 10:19:00 -0500 (Fri, 18 Apr 2008) | 2 lines

Fixed monitoring of zap pseudo channels

........

Added:
    team/mattf/zaptel-1.4-raceandlockingfix/build_tools/zaptel_svn_tarball
      - copied unchanged from r4176, branches/1.4/build_tools/zaptel_svn_tarball
Modified:
    team/mattf/zaptel-1.4-raceandlockingfix/   (props changed)
    team/mattf/zaptel-1.4-raceandlockingfix/Makefile
    team/mattf/zaptel-1.4-raceandlockingfix/kernel/xpp/.version
    team/mattf/zaptel-1.4-raceandlockingfix/kernel/zaptel-base.c
    team/mattf/zaptel-1.4-raceandlockingfix/kernel/ztdynamic.c

Propchange: team/mattf/zaptel-1.4-raceandlockingfix/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/mattf/zaptel-1.4-raceandlockingfix/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 19 16:49:35 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-4160
+/branches/1.4:1-4181

Modified: team/mattf/zaptel-1.4-raceandlockingfix/Makefile
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.4-raceandlockingfix/Makefile?view=diff&rev=4182&r1=4181&r2=4182
==============================================================================
--- team/mattf/zaptel-1.4-raceandlockingfix/Makefile (original)
+++ team/mattf/zaptel-1.4-raceandlockingfix/Makefile Sat Apr 19 16:49:35 2008
@@ -504,11 +504,11 @@
 		N=$$[$$N+1]; \
 	done
 else # DYNFS
-  ifneq (yes,$(UDEVRULES))
+  ifneq (yes,$(UDEVRULES)) #!UDEVRULES
+	@echo "**** Dynamic filesystem detected -- not creating device nodes"
+  else # UDEVRULES
 	install -d $(DESTDIR)/etc/udev/rules.d
 	build_tools/genudevrules > $(DESTDIR)/etc/udev/rules.d/zaptel.rules
-  else # !UDEVRULES
-	@echo "**** Dynamic filesystem detected -- not creating device nodes"
   endif
 endif
 

Modified: team/mattf/zaptel-1.4-raceandlockingfix/kernel/xpp/.version
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.4-raceandlockingfix/kernel/xpp/.version?view=diff&rev=4182&r1=4181&r2=4182
==============================================================================
--- team/mattf/zaptel-1.4-raceandlockingfix/kernel/xpp/.version (original)
+++ team/mattf/zaptel-1.4-raceandlockingfix/kernel/xpp/.version Sat Apr 19 16:49:35 2008
@@ -1,1 +1,1 @@
-trunk-r5512
+trunk-r5566

Modified: team/mattf/zaptel-1.4-raceandlockingfix/kernel/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.4-raceandlockingfix/kernel/zaptel-base.c?view=diff&rev=4182&r1=4181&r2=4182
==============================================================================
--- team/mattf/zaptel-1.4-raceandlockingfix/kernel/zaptel-base.c (original)
+++ team/mattf/zaptel-1.4-raceandlockingfix/kernel/zaptel-base.c Sat Apr 19 16:49:35 2008
@@ -995,6 +995,22 @@
 }
 
 
+static inline int hw_echocancel_off(struct zt_chan *chan)
+{
+	struct zt_echocanparams ecp;
+	
+	int ret = -ENODEV;
+	if (chan->span) {
+		if (chan->span->echocan) {
+			ret = chan->span->echocan(chan, 0);
+		} else if (chan->span->echocan_with_params) {
+			memset(&ecp, 0, sizeof(ecp));  /* Sets tap length to 0 */
+			ret = chan->span->echocan_with_params(chan, &ecp, NULL);
+		}
+	}
+	return ret;
+}
+
 static void close_channel(struct zt_chan *chan)
 {
 	unsigned long flags;
@@ -1074,8 +1090,7 @@
 
 	spin_unlock_irqrestore(&chan->lock, flags);
 
-	if (chan->span && chan->span->echocan)
-		chan->span->echocan(chan, 0);
+	hw_echocancel_off(chan);
 
 	if (rxgain)
 		kfree(rxgain);
@@ -2376,8 +2391,7 @@
 	spin_unlock_irqrestore(&chan->lock, flags);
 	set_tone_zone(chan, -1);
 
-	if (chan->span && chan->span->echocan)
-		chan->span->echocan(chan, 0);
+	hw_echocancel_off(chan);
 
 	if (rxgain)
 		kfree(rxgain);
@@ -3908,14 +3922,16 @@
 	case ZT_SET_DIALPARAMS:
 		if (copy_from_user(&tdp, (struct zt_dialparams *) data, sizeof(tdp)))
 			return -EFAULT;
-		if ((tdp.dtmf_tonelen > 4000) || (tdp.dtmf_tonelen < 10))
-			return -EINVAL;
-		if ((tdp.mfv1_tonelen > 4000) || (tdp.mfv1_tonelen < 10))
-			return -EINVAL;
-		if ((tdp.mfr2_tonelen > 4000) || (tdp.mfr2_tonelen < 10))
-			return -EINVAL;
-
-		global_dialparams = tdp;
+
+		if ((tdp.dtmf_tonelen <= 4000) || (tdp.dtmf_tonelen >= 10)) {
+			global_dialparams.dtmf_tonelen = tdp.dtmf_tonelen;
+		}
+		if ((tdp.mfv1_tonelen <= 4000) || (tdp.mfv1_tonelen >= 10)) {
+			global_dialparams.mfv1_tonelen = tdp.mfv1_tonelen;
+		}
+		if ((tdp.mfr2_tonelen <= 4000) || (tdp.mfr2_tonelen >= 10)) {
+			global_dialparams.mfr2_tonelen = tdp.mfr2_tonelen;
+		}
 
 		/* update the lengths in all currently loaded zones */
 		write_lock(&zone_lock);
@@ -3926,27 +3942,27 @@
 				continue;
 
 			for (i = 0; i < sizeof(z->dtmf) / sizeof(z->dtmf[0]); i++) {
-				z->dtmf[i].tonesamples = tdp.dtmf_tonelen * ZT_CHUNKSIZE;
+				z->dtmf[i].tonesamples = global_dialparams.dtmf_tonelen * ZT_CHUNKSIZE;
 			}
 
 			/* for MFR1, we only adjust the length of the digits */
 			for (i = ZT_TONE_MFR1_0; i <= ZT_TONE_MFR1_9; i++) {
-				z->mfr1[i - ZT_TONE_MFR1_BASE].tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE;
+				z->mfr1[i - ZT_TONE_MFR1_BASE].tonesamples = global_dialparams.mfv1_tonelen * ZT_CHUNKSIZE;
 			}
 
 			for (i = 0; i < sizeof(z->mfr2_fwd) / sizeof(z->mfr2_fwd[0]); i++) {
-				z->mfr2_fwd[i].tonesamples = tdp.mfr2_tonelen * ZT_CHUNKSIZE;
+				z->mfr2_fwd[i].tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE;
 			}
 
 			for (i = 0; i < sizeof(z->mfr2_rev) / sizeof(z->mfr2_rev[0]); i++) {
-				z->mfr2_rev[i].tonesamples = tdp.mfr2_tonelen * ZT_CHUNKSIZE;
+				z->mfr2_rev[i].tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE;
 			}
 		}
 		write_unlock(&zone_lock);
 
-		dtmf_silence.tonesamples = tdp.dtmf_tonelen * ZT_CHUNKSIZE;
-		mfr1_silence.tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE;
-		mfr2_silence.tonesamples = tdp.mfr2_tonelen * ZT_CHUNKSIZE;
+		dtmf_silence.tonesamples = global_dialparams.dtmf_tonelen * ZT_CHUNKSIZE;
+		mfr1_silence.tonesamples = global_dialparams.mfv1_tonelen * ZT_CHUNKSIZE;
+		mfr2_silence.tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE;
 
 		break;
 	case ZT_GET_DIALPARAMS:
@@ -4603,8 +4619,7 @@
 		chan->echolastupdate = 0;
 		chan->echotimer = 0;
 		spin_unlock_irqrestore(&chan->lock, flags);
-		if (chan->span && chan->span->echocan)
-			chan->span->echocan(chan, 0);
+		hw_echocancel_off(chan);
 		if (tec)
 			echo_can_free(tec);
 
@@ -4635,14 +4650,10 @@
 	/* attempt to use the span's echo canceler; fall back to built-in
 	   if it fails (but not if an error occurs) */
 	if (chan->span) {
-		if (ecp->param_count) {
-			if (chan->span->echocan_with_params)
-				ret = chan->span->echocan_with_params(chan, ecp, params);
-		} else if (chan->span->echocan) {
+		if (chan->span->echocan_with_params)
+			ret = chan->span->echocan_with_params(chan, ecp, params);
+		else if (chan->span->echocan)
 			ret = chan->span->echocan(chan, ecp->tap_length);
-		} else if (chan->span->echocan_with_params) {
-			ret = chan->span->echocan_with_params(chan, ecp, NULL);
-		}
 	}
 	
 	if (ret == -ENODEV) {
@@ -4751,8 +4762,7 @@
 			/* Disable any native echo cancellation as well */
 			spin_unlock_irqrestore(&chan->lock, flags);
 
-			if (chan->span && chan->span->echocan)
-				chan->span->echocan(chan, 0);
+			hw_echocancel_off(chan);
 
 			if (rxgain)
 				kfree(rxgain);
@@ -4804,8 +4814,8 @@
 					chan->gainalloc = 0;
 					chan->flags &= ~ZT_FLAG_AUDIO;
 					chan->flags |= (ZT_FLAG_PPP | ZT_FLAG_HDLC | ZT_FLAG_FCS);
-					if (chan->span && chan->span->echocan)
-						chan->span->echocan(chan, 0);
+					hw_echocancel_off(chan);
+					
 					if (tec)
 						echo_can_free(tec);
 				} else
@@ -5126,6 +5136,11 @@
 		span->deflaw = ZT_LAW_MULAW;
 	}
 
+	if (span->echocan && span->echocan_with_params) {
+		printk("zaptel: Span %s implements both echocan and echocan_with_params functions, preserving only echocan_with_params, please fix driver!\n", span->name);
+		span->echocan = NULL;
+	}
+
 	for (x=0;x<span->channels;x++) {
 		span->chans[x].span = span;
 		zt_chan_reg(&span->chans[x]); 
@@ -5547,8 +5562,11 @@
 					SCSS(ms->conflast, conf_sums[ms->_confn]);
 					/* Really add in new value */
 					ACSS(conf_sums[ms->_confn], ms->conflast);
-				} else memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short));
-				memcpy(getlin, ms->getlin, ZT_CHUNKSIZE * sizeof(short));
+					memcpy(ms->getlin, getlin, ZT_CHUNKSIZE * sizeof(short));
+				} else {
+					memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short));
+					memcpy(getlin, ms->getlin, ZT_CHUNKSIZE * sizeof(short));
+				}
 				txb[0] = ZT_LIN2X(0, ms);
 				memset(txb + 1, txb[0], ZT_CHUNKSIZE - 1);
 				break;
@@ -6524,7 +6542,7 @@
 				/* Convert back */
 				for(x=0;x<ZT_CHUNKSIZE;x++)
 					rxb[x] = ZT_LIN2X(putlin[x], ms);
-				memcpy(ss->getlin, putlin, ZT_CHUNKSIZE * sizeof(short));
+				memcpy(ss->putlin, putlin, ZT_CHUNKSIZE * sizeof(short));
 				break;
 			   }
 			/* fall through */

Modified: team/mattf/zaptel-1.4-raceandlockingfix/kernel/ztdynamic.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.4-raceandlockingfix/kernel/ztdynamic.c?view=diff&rev=4182&r1=4181&r2=4182
==============================================================================
--- team/mattf/zaptel-1.4-raceandlockingfix/kernel/ztdynamic.c (original)
+++ team/mattf/zaptel-1.4-raceandlockingfix/kernel/ztdynamic.c Sat Apr 19 16:49:35 2008
@@ -433,7 +433,7 @@
 		kfree(z->msgbuf);
 
 	/* Free channels */
-	if (z->chans);
+	if (z->chans)
 		vfree(z->chans);
 	/* Free z */
 	kfree(z);




More information about the zaptel-commits mailing list