diff options
Diffstat (limited to 'wctdm.c')
-rwxr-xr-x | wctdm.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1404,12 +1404,16 @@ static int wcfxs_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat } break; case WCFXS_GET_STATS: - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) + if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { + stats.tipvolt = wcfxs_getreg(wc, chan->chanpos - 1, 80) * -376; + stats.ringvolt = wcfxs_getreg(wc, chan->chanpos - 1, 81) * -376; + stats.batvolt = wcfxs_getreg(wc, chan->chanpos - 1, 82) * -376; + } else if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { + stats.tipvolt = (signed char)wcfxs_getreg(wc, chan->chanpos - 1, 29) * 1000; + stats.ringvolt = (signed char)wcfxs_getreg(wc, chan->chanpos - 1, 29) * 1000; + stats.batvolt = (signed char)wcfxs_getreg(wc, chan->chanpos - 1, 29) * 1000; + } else return -EINVAL; - stats.tipvolt = wcfxs_getreg(wc, chan->chanpos - 1, 80) * -376; - - stats.ringvolt = wcfxs_getreg(wc, chan->chanpos - 1, 81) * -376; - stats.batvolt = wcfxs_getreg(wc, chan->chanpos - 1, 82) * -376; if (copy_to_user((struct wcfxs_stats *)data, &stats, sizeof(stats))) return -EFAULT; break; |