[Asterisk-cvs] zaptel wcfxs.c,1.67,1.68

markster at lists.digium.com markster at lists.digium.com
Fri May 28 12:01:49 CDT 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv9797

Modified Files:
	wcfxs.c 
Log Message:
Report battery in fxstest stat 


Index: wcfxs.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxs.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- wcfxs.c	26 May 2004 18:22:52 -0000	1.67
+++ wcfxs.c	28 May 2004 16:16:44 -0000	1.68
@@ -1404,12 +1404,16 @@
 		}
 		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;




More information about the svn-commits mailing list