[aadk-commits] dbailey: uClinux/trunk r551 - in /uClinux/trunk/uClinux-dist: linux-2.6.x/dri...

SVN commits to the AADK repository aadk-commits at lists.digium.com
Tue Jul 31 14:46:05 CDT 2007


Author: dbailey
Date: Tue Jul 31 14:46:04 2007
New Revision: 551

URL: http://svn.digium.com/view/aadk?view=rev&rev=551
Log:
Ported Matt F's fix (r2787)  "Quick fix for the could not fill input buffer problem"

Modified:
    uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/fxotune.c
    uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxotune.c

Modified: uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/fxotune.c
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/fxotune.c?view=diff&rev=551&r1=550&r2=551
==============================================================================
--- uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/fxotune.c (original)
+++ uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/fxotune.c Tue Jul 31 14:46:04 2007
@@ -52,6 +52,7 @@
 "		options : [-b <device>][-w <waveform>]\n"
 "		   [-n <dialstring>][-l <delaytosilence>][-m <silencegoodfor>]\n"
 "	-v : more output (-vv, -vvv also)\n"
+"       -c <config_file>\n"
 "\n"
 "		<calibtype>      - type of calibration\n"
 "		                   (default 2, old method 1)\n"
@@ -66,7 +67,10 @@
 "		<device>         - the device to perform waveform dump on\n"
 "		                   (default 1)\n"
 "		<waveform>       - -1 for multitone waveform, or frequency of\n"
-"		                   single tone (default -1)\n";
+"		                   single tone (default -1)\n"
+"               <config_file>    - Alternative file to set from / calibrate to.\n"
+"                                  (Default: /etc/fxotune.conf)\n"
+;
 
 
 #define OUT_OF_BOUNDS(x) ((x) < 0 || (x) > 255)
@@ -328,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 */
@@ -480,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 */
@@ -622,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 */
@@ -919,6 +933,9 @@
 					if (argv[i+1][0] != '-' && argv[i+1][0] != '/')
 						dialstr = argv[++i];
 				}
+				continue;
+			case 'c':
+				configfile = moreargs ? argv[++i] : configfile;
 				continue;
 			case 'd':
 				dodump = 1;

Modified: uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxotune.c
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxotune.c?view=diff&rev=551&r1=550&r2=551
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxotune.c (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxotune.c Tue Jul 31 14:46:04 2007
@@ -54,6 +54,7 @@
 "		options : [-b <device>][-w <waveform>]\n"
 "		   [-n <dialstring>][-l <delaytosilence>][-m <silencegoodfor>]\n"
 "	-v : more output (-vv, -vvv also)\n"
+"	-c : <config_file>\n"
 "\n"
 "		<calibtype>      - type of calibration\n"
 "		                   (default 2, old method 1)\n"
@@ -68,7 +69,10 @@
 "		<device>         - the device to perform waveform dump on\n"
 "		                   (default 1)\n"
 "		<waveform>       - -1 for multitone waveform, or frequency of\n"
-"		                   single tone (default -1)\n";
+"		                   single tone (default -1)\n"
+"		<config_file>    - Alternative file to set from / calibrate to.\n"
+"                                  (Default: /etc/fxotune.conf)\n"
+;
 
 
 #define OUT_OF_BOUNDS(x) ((x) < 0 || (x) > 255)
@@ -174,9 +178,9 @@
  *
  * @return 16bit slinear sample for the specified index
  */
-static short inline gentone(int hz, int idx)
+static short inline gentone(int hz, int index)
 {
-	return loudness * sin((idx * 2.0 * M_PI * hz)/8000);
+	return loudness * sin((index * 2.0 * M_PI * hz)/8000);
 }
 
 /**
@@ -188,14 +192,14 @@
  *
  * @return 16bit slinear sample for the specified index
  */
-static short inline genwaveform(int idx)
+static short inline genwaveform(int index)
 {
 	int freqs[] = {300, 600, 900, 1004, 1300, 1600}; /* chose 1004 Hz to include the milliwatt test tone frequency - but there was no particular reson to do so */
 	int freqcount = 6;
 	int i = 0;
 	float response = (float)0;
 	for (i = 0; i < freqcount; i++){
-		response += sin((idx * 2.0 * M_PI * freqs[i])/8000);
+		response += sin((index * 2.0 * M_PI * freqs[i])/8000);
 	}
 	
 
@@ -330,11 +334,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 */
@@ -482,11 +489,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 */
@@ -624,10 +634,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 */
@@ -921,6 +935,9 @@
 					if (argv[i+1][0] != '-' && argv[i+1][0] != '/')
 						dialstr = argv[++i];
 				}
+				continue;
+			case 'c':
+				configfile = moreargs ? argv[++i] : configfile;
 				continue;
 			case 'd':
 				dodump = 1;




More information about the aadk-commits mailing list