[svn-commits] rmeyerriecks: tools/trunk r10071 - /tools/trunk/patlooptest.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 21 12:29:38 CDT 2011


Author: rmeyerriecks
Date: Thu Jul 21 12:29:34 2011
New Revision: 10071

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10071
Log:
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 at digium.com>

Modified:
    tools/trunk/patlooptest.c

Modified: tools/trunk/patlooptest.c
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/patlooptest.c?view=diff&rev=10071&r1=10070&r2=10071
==============================================================================
--- tools/trunk/patlooptest.c (original)
+++ tools/trunk/patlooptest.c Thu Jul 21 12:29:34 2011
@@ -167,6 +167,7 @@
 	char * device;
 	int opt;
 	int oldstyle_cmdline = 1;
+	unsigned int event_count = 0;
 
 	/* Parse the command line arguments */
 	while((opt = getopt(argc, argv, "b:s:t:r:v?h")) != -1) {
@@ -248,9 +249,14 @@
 write_again:
 		res = write(fd,outbuf,bs);
 		if (res != bs) {
-			printf("W: Res is %d: %s\n", res, strerror(errno));
- 			ioctl(fd, DAHDI_GETEVENT, &x);
- 			printf("Event: %d\n", x);
+			if (ELAST == errno) {
+				ioctl(fd, DAHDI_GETEVENT, &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;
 		}
 




More information about the svn-commits mailing list