[zaptel-commits] tzafrir: trunk r1288 - /trunk/xpp/card_fxo.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Aug 9 20:21:48 MST 2006


Author: tzafrir
Date: Wed Aug  9 22:21:47 2006
New Revision: 1288

URL: http://svn.digium.com/view/zaptel?rev=1288&view=rev
Log:
card_fxo.c: Fix a potential bug: battery voltage is a 2's complement value.

Modified:
    trunk/xpp/card_fxo.c

Modified: trunk/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxo.c?rev=1288&r1=1287&r2=1288&view=diff
==============================================================================
--- trunk/xpp/card_fxo.c (original)
+++ trunk/xpp/card_fxo.c Wed Aug  9 22:21:47 2006
@@ -699,14 +699,15 @@
 	if(!info->indirect && info->reg_num == DAA_VBAT_REGISTER) {
 		xpp_line_t	last_batt_on = priv->battery;
 		xpp_line_t	changed_lines;
+		signed char	bat = info->data_low;
 		int		i;
 
-		if(abs(info->data_low) < BAT_THRESHOLD) {
+		if(abs(bat) < BAT_THRESHOLD) {
 			priv->battery &= ~lines;
-			// DBG("%s/%s: BATTERY OFF (%04X) = %d\n", xpd->xbus->busname, xpd->xpdname, lines, info->data_low);
+			// DBG("%s/%s: BATTERY OFF (%04X) = %d\n", xpd->xbus->busname, xpd->xpdname, lines, bat);
 		} else {
 			priv->battery |= lines;
-			// DBG("%s/%s: BATTERY ON (%04X) = %d\n", xpd->xbus->busname, xpd->xpdname, lines, info->data_low);
+			// DBG("%s/%s: BATTERY ON (%04X) = %d\n", xpd->xbus->busname, xpd->xpdname, lines, bat);
 		}
 		changed_lines = last_batt_on ^ priv->battery;
 		for_each_line(xpd, i) {



More information about the zaptel-commits mailing list