diff options
author | Shaun Ruffell <sruffell@digium.com> | 2011-06-28 21:29:20 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2011-06-28 21:29:20 +0000 |
commit | 58a742a41a0f8942fc36757003d7266111135854 (patch) | |
tree | 35d6dab5ae6f4eef84861dd17583ca50fe91bb13 /drivers/dahdi/dahdi-base.c | |
parent | 71234e254b574d31d442703e04fdbdcba653010c (diff) |
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
Diffstat (limited to 'drivers/dahdi/dahdi-base.c')
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 84aea3e..dd9cd78 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -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) |