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@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9995 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell
2011-06-28 21:29:20 +00:00
parent 15c12a08f8
commit 355ab14d47

View File

@@ -4828,6 +4828,21 @@ static int dahdi_ioctl_shutdown(unsigned long data)
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 @@ static int dahdi_ioctl_attach_echocan(unsigned long data)
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)