summaryrefslogtreecommitdiff
path: root/wctdm.c
diff options
context:
space:
mode:
Diffstat (limited to 'wctdm.c')
-rwxr-xr-xwctdm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/wctdm.c b/wctdm.c
index 128b9ed..9c46f49 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -1657,6 +1657,22 @@ static int wctdm_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod.fxs.lasttxhook[chan->chanpos - 1]);
}
break;
+ case ZT_SETPOLARITY:
+ if (get_user(x, (int *)data))
+ return -EFAULT;
+ if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
+ return -EINVAL;
+ /* Can't change polarity while ringing or when open */
+ if ((wc->mod.fxs.lasttxhook[chan->chanpos -1 ] == 0x04) ||
+ (wc->mod.fxs.lasttxhook[chan->chanpos -1 ] == 0x00))
+ return -EINVAL;
+
+ if (x)
+ wc->mod.fxs.lasttxhook[chan->chanpos - 1] |= 0x04;
+ else
+ wc->mod.fxs.lasttxhook[chan->chanpos - 1] &= ~0x04;
+ wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod.fxs.lasttxhook[chan->chanpos - 1]);
+ break;
case WCTDM_GET_STATS:
if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) {
stats.tipvolt = wctdm_getreg(wc, chan->chanpos - 1, 80) * -376;