[svn-commits] sruffell: linux/trunk r9995 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 28 16:29:24 CDT 2011


Author: sruffell
Date: Tue Jun 28 16:29:20 2011
New Revision: 9995

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9995
Log:
dahdi: Always attach hwec to a channel if available.

In previous releases of DAHDI if dahdi_cfg attached a software echocan
to a channel and a hardware echocan was available, the hardware echocan
would be used instead of the software echocan.

Since the 2.4 branch was created a new feature was merged into
dahdi-linux where it was possible to mix software echocan and hardware
echocan on a channel. This required using "hwec" as the echocan in the
/etc/dahdi/system.conf file so that what was specified in the
configuration file is what was actually used.

This has resulted in users upgrading to the trunk of dahdi without
updating their /etc/dahdi/system.conf file and just suddenly not using
any hardware echocans any longer.

The capability to mix software and hardware echocans on a span will be
revisted when running dahdi_cfg on any preexisting configuration files
doesn't just silently turn off hardware echocan.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9995&r1=9994&r2=9995
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Tue Jun 28 16:29:20 2011
@@ -4828,6 +4828,21 @@
 	return 0;
 }
 
+/**
+ * dahdi_is_hwec_available - Is hardware echocan available on a channel?
+ * @chan: The channel to check
+ *
+ * Returns true if there is a hardware echocan available for the attached
+ * channel, or false otherwise.
+ *
+ */
+static bool dahdi_is_hwec_available(const struct dahdi_chan *chan)
+{
+	if (!hwec_factory.get_name(chan))
+		return false;
+	return true;
+}
+
 static int dahdi_ioctl_attach_echocan(unsigned long data)
 {
 	unsigned long flags;
@@ -4842,7 +4857,15 @@
 	if (!chan)
 		return -EINVAL;
 
-	ae.echocan[sizeof(ae.echocan) - 1] = 0;
+	if (dahdi_is_hwec_available(chan)) {
+		/* If there is a hardware echocan available we'll always use
+		 * it instead of any configured software echocan. This matches
+		 * the behavior in dahdi 2.4.1.2 and earlier releases. */
+		strlcpy(ae.echocan, hwec_def_name, sizeof(ae.echocan));
+	} else {
+		ae.echocan[sizeof(ae.echocan) - 1] = 0;
+	}
+
 	if (ae.echocan[0]) {
 		new = find_echocan(ae.echocan);
 		if (!new)




More information about the svn-commits mailing list