[zaptel-commits] mattf: branch 1.4 r2787 - /branches/1.4/fxotune.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Jul 27 14:36:07 CDT 2007


Author: mattf
Date: Fri Jul 27 14:36:06 2007
New Revision: 2787

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2787
Log:
Quick fix for the could not fill input buffer problem

Modified:
    branches/1.4/fxotune.c

Modified: branches/1.4/fxotune.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/fxotune.c?view=diff&rev=2787&r1=2786&r2=2787
==============================================================================
--- branches/1.4/fxotune.c (original)
+++ branches/1.4/fxotune.c Fri Jul 27 14:36:06 2007
@@ -332,11 +332,14 @@
 		return -1;
 	}
 
-	/* read return response */
+retry:
+		/* read return response */
 	res = read(whichzap, inbuf, BUFFER_LENGTH);
 	if (res != BUFFER_LENGTH) {
-		fprintf(stderr, "Could not fill input buffer\n");
-		return -1;
+		int x;
+
+		ioctl(whichzap, ZT_GETEVENT, &x);
+		goto retry;
 	}
 
 	/* write content of output buffer to debug file */
@@ -484,11 +487,14 @@
 			return -1;
 		}
 
+retry:
 		/* read return response */
 		res = read(whichzap, inbuf, BUFFER_LENGTH);
 		if (res != BUFFER_LENGTH) {
-			fprintf(stderr, "Could not fill input buffer - got %d bytes, expected %d bytes\n", res, BUFFER_LENGTH);
-			return -1;
+			int x;
+
+			ioctl(whichzap, ZT_GETEVENT, &x);
+			goto retry;
 		}
 
 		/* calculate RMS of response */
@@ -626,10 +632,14 @@
 			}
 
 			/* read return response */
+retry:
+			/* read return response */
 			res = read(whichzap, inbuf, BUFFER_LENGTH);
 			if (res != BUFFER_LENGTH) {
-				fprintf(stderr, "Could not fill input buffer\n");
-				return -1;
+				int x;
+	
+				ioctl(whichzap, ZT_GETEVENT, &x);
+				goto retry;
 			}
 
 			/* calculate power of response */




More information about the zaptel-commits mailing list