[svn-commits] kmoore: tools/trunk r9909 - /tools/trunk/patlooptest.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 18 16:20:12 CDT 2011


Author: kmoore
Date: Mon Apr 18 16:20:10 2011
New Revision: 9909

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9909
Log:
tools: Allow patlooptest to activate and handle buffer events

The new buffer events code introduced in revision 9905 gives userspace
processes an interface to activate detection of buffer over and underflows.
This change allows patlooptest to take advantage of that feature to better
inform users of the cause of pattern errors.

Acked-by: Shaun Ruffell <sruffell at digium.com>
(original patch by Matt Fredrickson)

Modified:
    tools/trunk/patlooptest.c

Modified: tools/trunk/patlooptest.c
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/patlooptest.c?view=diff&rev=9909&r1=9908&r2=9909
==============================================================================
--- tools/trunk/patlooptest.c (original)
+++ tools/trunk/patlooptest.c Mon Apr 18 16:20:10 2011
@@ -208,12 +208,13 @@
 			outbuf[x] = c1++;
 		}
 
+write_again:
 		res = write(fd,outbuf,bs);
 		if (res != bs) {
-			printf("Res is %d: %s\n", res, strerror(errno));
-			ioctl(fd, DAHDI_GETEVENT, &x);
-			printf("Event: %d\n", x);
-			exit(1);
+			printf("W: Res is %d: %s\n", res, strerror(errno));
+ 			ioctl(fd, DAHDI_GETEVENT, &x);
+ 			printf("Event: %d\n", x);
+			goto write_again;
 		}
 
 		/* If this is the start of the test then skip a number of packets before test results */
@@ -225,13 +226,18 @@
 			if (!skipcount) {
 				printf("Going for it...\n");
 			}
+			i = 1;
+			ioctl(fd,DAHDI_BUFFER_EVENTS, &i);
 			continue;
 		}
 
+read_again:
 		res = read(fd, inbuf, bs);
 		if (res < bs) {
-			printf("read error: returned %d\n", res);
-			exit(1);
+			printf("R: Res is %d\n", res);
+			ioctl(fd, DAHDI_GETEVENT, &x);
+			printf("Event: %d\n", x);
+			goto read_again;
 		}
 		/* If first time through, set byte that is used to test further bytes */
 		if (!setup) {




More information about the svn-commits mailing list