patlooptest: Ignore the first buffered event
Fixes the feature introduced in r9909 that allows patlooptest to monitor channel events. Patlooptest was reporting events that we don't care about, prior to reading from the channel. This fix ignore the first event read on a channel and reports all subsequent events properly. Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10071 17933a7a-c749-41c5-a318-cba88f637d49
This commit is contained in:
parent
f2152481e9
commit
505621a31c
@ -167,6 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
char * device;
|
char * device;
|
||||||
int opt;
|
int opt;
|
||||||
int oldstyle_cmdline = 1;
|
int oldstyle_cmdline = 1;
|
||||||
|
unsigned int event_count = 0;
|
||||||
|
|
||||||
/* Parse the command line arguments */
|
/* Parse the command line arguments */
|
||||||
while((opt = getopt(argc, argv, "b:s:t:r:v?h")) != -1) {
|
while((opt = getopt(argc, argv, "b:s:t:r:v?h")) != -1) {
|
||||||
@ -248,9 +249,14 @@ int main(int argc, char *argv[])
|
|||||||
write_again:
|
write_again:
|
||||||
res = write(fd,outbuf,bs);
|
res = write(fd,outbuf,bs);
|
||||||
if (res != bs) {
|
if (res != bs) {
|
||||||
printf("W: Res is %d: %s\n", res, strerror(errno));
|
if (ELAST == errno) {
|
||||||
ioctl(fd, DAHDI_GETEVENT, &x);
|
ioctl(fd, DAHDI_GETEVENT, &x);
|
||||||
printf("Event: %d\n", x);
|
if (event_count > 0)
|
||||||
|
printf("Event: %d\n", x);
|
||||||
|
++event_count;
|
||||||
|
} else {
|
||||||
|
printf("W: Res is %d: %s\n", res, strerror(errno));
|
||||||
|
}
|
||||||
goto write_again;
|
goto write_again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user