[zaptel-commits] tzafrir: trunk r1393 - in /trunk/xpp: card_fxo.c xpp_zap.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Sep 4 16:18:32 MST 2006


Author: tzafrir
Date: Mon Sep  4 18:18:31 2006
New Revision: 1393

URL: http://svn.digium.com/view/zaptel?rev=1393&view=rev
Log:
FXO caller-id now works.

Modified:
    trunk/xpp/card_fxo.c
    trunk/xpp/xpp_zap.c

Modified: trunk/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxo.c?rev=1393&r1=1392&r2=1393&view=diff
==============================================================================
--- trunk/xpp/card_fxo.c (original)
+++ trunk/xpp/card_fxo.c Mon Sep  4 18:18:31 2006
@@ -214,7 +214,7 @@
 	}
 }
 
-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 @@
 	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 @@
 	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 @@
 	}
 	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 @@
 				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);
 				}
 			}
 		}

Modified: trunk/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpp_zap.c?rev=1393&r1=1392&r2=1393&view=diff
==============================================================================
--- trunk/xpp/xpp_zap.c (original)
+++ trunk/xpp/xpp_zap.c Mon Sep  4 18:18:31 2006
@@ -403,6 +403,10 @@
 	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 @@
 		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 @@
 	 * 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 @@
 	}
 
 	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);



More information about the zaptel-commits mailing list