diff options
author | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-07-27 19:36:06 +0000 |
---|---|---|
committer | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-07-27 19:36:06 +0000 |
commit | 0653ee7f6013a821caf6962f0c46233e4296ebf5 (patch) | |
tree | 9c2411ce071751bf6478ff9adfb87d14d51b4ebd | |
parent | 3f91cd988336d5472b003bbeaba7d3144d737145 (diff) |
Quick fix for the could not fill input buffer problem
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@2787 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | fxotune.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -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 */ |