summaryrefslogtreecommitdiff
path: root/wcfxs.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-28 16:16:44 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-28 16:16:44 +0000
commit90c3049b6685b7407f61b403b4945b6044495a14 (patch)
tree2803fc369078b152dd70e8518f547f5fc900eb70 /wcfxs.c
parentee6cba5c4e2c97cd0d8e73bfecc3f3c21e8573a6 (diff)
Report battery in fxstest stat
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@404 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-xwcfxs.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/wcfxs.c b/wcfxs.c
index ec20762..d02017d 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -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;