summaryrefslogtreecommitdiff
path: root/fxotune.c
diff options
context:
space:
mode:
Diffstat (limited to 'fxotune.c')
-rw-r--r--fxotune.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fxotune.c b/fxotune.c
index 08c4454..9e12f3a 100644
--- a/fxotune.c
+++ b/fxotune.c
@@ -332,11 +332,14 @@ static int maptone(int whichzap, int freq, char *dialstr, int delayuntilsilence)
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 @@ static int acim_tune2(int whichzap, int freq, char *dialstr, int delayuntilsilen
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 @@ static int acim_tune(int whichzap, char *dialstr, int delayuntilsilence, int sil
}
/* 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 */