[asterisk-dev] chan_dahdi: hw vs sw gains

Jaco Kroon jaco at uls.co.za
Fri Aug 30 03:41:54 CDT 2013


Hi Guys,

In chan_dahdi.conf one is able to set txgain and rxgain.  These gains
set the sw gain from what I understand of the code.

In the CLI one is able to set either hwgain or swgain using "dahdi set
hwgain" or "dahdi set swgain".  Until around 12 hours back I thought the
rx|txgain settings in chan_dahdi.conf set the hwgain values, and I would
typically just make a call from my clients' analog line, then make that
end up in a milliwat application and use set hwgain rx until things was
at the right level, tx I would typically leave alone (I know it's
possible to do the loopback call thing and I've done this in the past
but it's non-trivial to get exactly right).

The import thing to note is that I used "dahdi set hwgain", not swgain. 
So yesterday I noticed that when setting the gains the output of 'dahdi
show channel' didn't change (I've reported a bug on this at
https://issues.asterisk.org/jira/browse/ASTERISK-22429, and supplied a
preliminary patch).  The patch just updates the rx|txgain values in the
dahdi_pvt struct, as well as add hw[tx|rx]gain values which is used to
track changes, but initialization remains a problem.  It also updates
the dahdi show channel output to show both HW and SW Gains, as well as
to make it clearer which set of values is which.

The problem I'm experiencing is that because rxgain and txgain sets the
swgains, and the hwgains remains whatever is currently set in the
kernel, if you set the hwgains and then reload/restart dahdi, expecting
your old (or new) config values from the configuration to take effect it
is skewed by whatever is set at hw level.  In my case I had the gains
set to 0.0 in the config initially, then opened them up slowly using
"dahdi set hwgain" until the levels were acceptable.  I then set
rx|txgain in chan_dahdi.conf, and then restarted asterisk as a whole to
check that everything was good.  Unfortunately things sounded horrible. 
Things went sane again after reloading the dahdi modules at kernel
level.  And this is what launched the investigation.

My suggestion is to explicitly reset the hwgain values on
restart/reload, as well as add two config options "hwtxgain" and
"hwrxgain" (possibly rename the existing options to swtxgain and
swrxgain, keeping the originals as alias), but I'm not 100% sure where
this should happen.
-- 
Kind Regards,
Jaco Kroon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130830/f8fa0692/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .eml_jaco.png
Type: image/png
Size: 26699 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130830/f8fa0692/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jaco.vcf
Type: text/x-vcard
Size: 231 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130830/f8fa0692/attachment-0001.vcf>


More information about the asterisk-dev mailing list