diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-04 23:18:31 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-04 23:18:31 +0000 |
commit | ee5282ac097e112e9baf1c760211e6ee0f2a4fe8 (patch) | |
tree | 6c1c0866487967f8bdfe847f78662918ed6f7238 /xpp | |
parent | 6e2fdc4fdd1f8be1c6d192d5230393489051e40d (diff) |
FXO caller-id now works.
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1393 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp')
-rw-r--r-- | xpp/card_fxo.c | 20 | ||||
-rw-r--r-- | xpp/xpp_zap.c | 14 |
2 files changed, 21 insertions, 13 deletions
diff --git a/xpp/card_fxo.c b/xpp/card_fxo.c index d3bde57..f775217 100644 --- a/xpp/card_fxo.c +++ b/xpp/card_fxo.c @@ -214,7 +214,7 @@ static void mark_ring(xpd_t *xpd, lineno_t pos, bool on) } } -static int __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool offhook) +static int __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool to_offhook) { int ret = 0; xpacket_t *pack; @@ -226,16 +226,16 @@ static int __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool offhook) BUG_ON(!xbus); BUG_ON(!xpd); priv = (struct FXO_priv_data*)xpd->priv; - value = (offhook) ? 0x09 : 0x08; + value = (to_offhook) ? 0x09 : 0x08; // value |= BIT(3); /* Bit 3 is for CID */ - DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (offhook)?"OFFHOOK":"ONHOOK"); - MARK_LED(xpd, pos, LED_GREEN, (offhook)?LED_ON:LED_OFF); + DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (to_offhook)?"OFFHOOK":"ONHOOK"); + MARK_LED(xpd, pos, LED_GREEN, (to_offhook)?LED_ON:LED_OFF); XPACKET_NEW(pack, xbus, FXO, DAA_WRITE, xpd->id); sc = &RPACKET_FIELD(pack, FXO, DAA_WRITE, slic_cmd); len = slic_cmd_direct_write(sc, BIT(pos), 0x05, value); pack->datalen = len; packet_send(xbus, pack); - if(!offhook) + if(!to_offhook) mark_ring(xpd, pos, 0); // No more rings #ifdef SOFT_RING priv->ring_sig[pos] = 0; @@ -243,7 +243,7 @@ static int __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool offhook) return ret; } -static void do_sethook(xpd_t *xpd, int pos, bool offhook) +static void do_sethook(xpd_t *xpd, int pos, bool to_offhook) { unsigned long flags; struct FXO_priv_data *priv; @@ -257,15 +257,16 @@ static void do_sethook(xpd_t *xpd, int pos, bool offhook) } spin_lock_irqsave(&xpd->lock, flags); mark_ring(xpd, pos, 0); // No more rings - __do_sethook(xpd->xbus, xpd, pos, offhook); - if(offhook) { + __do_sethook(xpd->xbus, xpd, pos, to_offhook); + if(to_offhook) { BIT_SET(xpd->offhook, pos); } else { BIT_CLR(xpd->offhook, pos); + BIT_CLR(xpd->cid_on, pos); xpd->delay_until_dialtone[pos] = 0; } spin_unlock_irqrestore(&xpd->lock, flags); - if(offhook) + if(to_offhook) wake_up_interruptible(&xpd->txstateq[pos]); } @@ -740,7 +741,6 @@ HANDLER_DEF(FXO, DAA_REPLY) if(!IS_SET(priv->battery, i)) { DBG("%s/%s: BATTERY ON (%04X) voltage=%d\n", xpd->xbus->busname, xpd->xpdname, lines, bat); BIT_SET(priv->battery, i); - update_line_status(xpd, i, 1); } } } diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c index e0e3560..b6bb618 100644 --- a/xpp/xpp_zap.c +++ b/xpp/xpp_zap.c @@ -403,6 +403,10 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo for_each_line(xpd, i) { len += sprintf(page + len, "%d ", IS_SET(xpd->offhook, i)); } + len += sprintf(page + len, "\n\t%-17s: ", "cid_on"); + for_each_line(xpd, i) { + len += sprintf(page + len, "%d ", IS_SET(xpd->cid_on, i)); + } len += sprintf(page + len, "\n\t%-17s: ", "ringing"); for_each_line(xpd, i) { len += sprintf(page + len, "%d ", xpd->ringing[i]); @@ -637,6 +641,7 @@ void update_line_status(xpd_t *xpd, int pos, bool to_offhook) zt_hooksig(chan, ZT_RXSIG_OFFHOOK); } else { BIT_CLR(xpd->offhook, pos); + BIT_CLR(xpd->cid_on, pos); zt_hooksig(chan, ZT_RXSIG_ONHOOK); } } @@ -654,10 +659,13 @@ void update_zap_ring(xpd_t *xpd, int pos, bool on) * it may call back into our xpp_hooksig() and cause * a nested spinlock scenario */ - if(on) + if(on) { + BIT_CLR(xpd->cid_on, pos); zt_hooksig(chan, ZT_RXSIG_RING); - else + } else { + BIT_SET(xpd->cid_on, pos); zt_hooksig(chan, ZT_RXSIG_OFFHOOK); + } } #ifdef CONFIG_PROC_FS @@ -978,7 +986,7 @@ static void xpp_receiveprep(xpd_t *xpd) } for (i = 0; i < channels; i++) { - if(IS_SET(xpd->offhook, i)) { + if(IS_SET(xpd->offhook, i) || IS_SET(xpd->cid_on, i)) { // memset((u_char *)readchunk, 0x5A, ZT_CHUNKSIZE); // DEBUG // fill_beep((u_char *)readchunk, 1); // DEBUG: BEEP memcpy(chans[i].readchunk, (u_char *)readchunk, ZT_CHUNKSIZE); |