From f85c3104b6ba263be89d89f3ba0fbcae5d1ad495 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 27 Jul 2007 19:36:55 +0000 Subject: Merged revisions 2787 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.4 ........ r2787 | mattf | 2007-07-27 14:36:06 -0500 (Fri, 27 Jul 2007) | 1 line Quick fix for the could not fill input buffer problem ........ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2788 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- fxotune.c | 24 +++++++++++++++++------- 1 file 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 */ -- cgit v1.2.3