Greg: This patch (as693) makes the usbtest driver report errors in the isochronous bulk transfer tests instead of always returning 0. As an arbitrary cutoff, an error is returned if more than 10% of the packet transfers fail.
For a test harness, it's especially important to report when errors occur! Alan Stern Signed-off-by: Alan Stern <[EMAIL PROTECTED]> --- Index: usb-2.6/drivers/usb/misc/usbtest.c =================================================================== --- usb-2.6.orig/drivers/usb/misc/usbtest.c +++ usb-2.6/drivers/usb/misc/usbtest.c @@ -1336,6 +1336,8 @@ struct iso_context { spinlock_t lock; struct completion done; unsigned long errors; + unsigned long submit_errors; + unsigned long packet_count; struct usbtest_dev *dev; }; @@ -1346,8 +1348,11 @@ static void iso_callback (struct urb *ur spin_lock(&ctx->lock); ctx->count--; + ctx->packet_count += urb->number_of_packets; if (urb->error_count > 0) ctx->errors += urb->error_count; + else if (urb->status != 0) + ctx->errors += urb->number_of_packets; if (urb->status == 0 && ctx->count > (ctx->pending - 1)) { int status = usb_submit_urb (urb, GFP_ATOMIC); @@ -1360,6 +1365,7 @@ static void iso_callback (struct urb *ur status); /* FALLTHROUGH */ case -ENODEV: /* disconnected */ + ++ctx->submit_errors; break; } } @@ -1369,8 +1375,8 @@ static void iso_callback (struct urb *ur if (ctx->pending == 0) { if (ctx->errors) dev_dbg (&ctx->dev->intf->dev, - "iso test, %lu errors\n", - ctx->errors); + "iso test, %lu errors out of %lu\n", + ctx->errors, ctx->packet_count); complete (&ctx->done); } done: @@ -1431,7 +1437,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usb_device *udev; unsigned i; unsigned long packets = 0; - int status; + int status = 0; struct urb *urbs[10]; /* FIXME no limit */ if (param->sglen > 10) @@ -1440,6 +1446,8 @@ test_iso_queue (struct usbtest_dev *dev, context.count = param->iterations * param->sglen; context.pending = param->sglen; context.errors = 0; + context.submit_errors = 0; + context.packet_count = 0; context.dev = dev; init_completion (&context.done); spin_lock_init (&context.lock); @@ -1478,6 +1486,7 @@ test_iso_queue (struct usbtest_dev *dev, spin_unlock_irq (&context.lock); goto fail; } + ++context.submit_errors; simple_free_urb (urbs [i]); context.pending--; @@ -1486,7 +1495,19 @@ test_iso_queue (struct usbtest_dev *dev, spin_unlock_irq (&context.lock); wait_for_completion (&context.done); - return 0; + + /* + * Isochronous transfers are expected to fail sometimes. As an + * arbitrary limit, we will report an error if any submissions + * fail or if the transfer failure rate is > 10%. + */ + if (status != 0) + ; + else if (context.submit_errors != 0) + status = -EACCES; + else if (context.errors > context.packet_count / 10) + status = -EIO; + return status; fail: for (i = 0; i < param->sglen; i++) { ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel