Martin Diehl wrote:

Ok, here we are. New release of the usbtest-firmware (attached).

Your ".ihx" seemed to give some problems in light testing, but ISO worked (with your usbtest patches) ... nice!

 - short read errors for bulk IN, all tests
 - testusb -at14 -s256 -v1 (control out) failed

The first one's a killer; your old "ep2_inout.ihx" doesn't
have that particular issue, or gadget zero.


I had to modify the usbtest driver to accept the changed altsetting and enable autoconfig (required for iso and ctrl_out tests). I've also changed it so we can test both bulk and iso in the same altsetting.

Nice cleanups, thanks. Gadget zero should probably do something similar on hardware that can do that, like net2280 (could act just like your EZ-USB firmware) and mq11xx_udc (not as many endpoints, so bulk and ISO tests need their own altsettings).

See the attached update.  It cleans up a handful of messages,
and tightens up the unlink tests a bit to make sure the right
fault code is returned from unlink.

- Dave

--- 1.30/drivers/usb/misc/usbtest.c     Fri Feb 20 07:59:50 2004
+++ edited/drivers/usb/misc/usbtest.c   Fri Mar  5 20:25:56 2004
@@ -149,8 +149,6 @@
                                if (!out)
                                        out = e;
                        }
-                       if (in && out)
-                               goto found;
                        continue;
 try_iso:
                        if (e->desc.bEndpointAddress & USB_DIR_IN) {
@@ -160,9 +158,9 @@
                                if (!iso_out)
                                        iso_out = e;
                        }
-                       if (iso_in && iso_out)
-                               goto found;
                }
+               if ((in && out)  ||  (iso_in && iso_out))
+                       goto found;
        }
        return -EINVAL;
 
@@ -181,7 +179,8 @@
                        in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
                dev->out_pipe = usb_sndbulkpipe (udev,
                        out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
-       } else if (iso_in) {
+       }
+       if (iso_in) {
                dev->iso_in = &iso_in->desc;
                dev->in_iso_pipe = usb_rcvisocpipe (udev,
                                iso_in->desc.bEndpointAddress
@@ -211,7 +210,7 @@
 static struct urb *simple_alloc_urb (
        struct usb_device       *udev,
        int                     pipe,
-       long                    bytes
+       unsigned long           bytes
 )
 {
        struct urb              *urb;
@@ -916,7 +915,7 @@
                        req.wValue = cpu_to_le16 (USB_DT_INTERFACE << 8);
                        // interface == 0
                        len = sizeof (struct usb_interface_descriptor);
-                       expected = -EPIPE;
+                       expected = EPIPE;
                        break;
                // NOTE: two consecutive stalls in the queue here.
                // that tests fault recovery a bit more aggressively.
@@ -945,7 +944,7 @@
                        req.wValue = cpu_to_le16 (USB_DT_ENDPOINT << 8);
                        // endpoint == 0
                        len = sizeof (struct usb_interface_descriptor);
-                       expected = -EPIPE;
+                       expected = EPIPE;
                        break;
                // NOTE: sometimes even a third fault in the queue!
                case 12:        // get string 0 descriptor (MAY STALL)
@@ -1072,7 +1071,7 @@
         * due to errors, or is just NAKing requests.
         */
        if ((retval = usb_submit_urb (urb, SLAB_KERNEL)) != 0) {
-               dbg ("submit/unlink fail %d", retval);
+               dev_dbg (&dev->intf->dev, "submit fail %d\n", retval);
                return retval;
        }
 
@@ -1087,18 +1086,22 @@
                 * "normal" drivers would prevent resubmission, but
                 * since we're testing unlink paths, we can't.
                 */
-               dbg ("unlink retry");
+               dev_dbg (&dev->intf->dev, "unlink retry\n");
                goto retry;
        }
        if (!(retval == 0 || retval == -EINPROGRESS)) {
-               dbg ("submit/unlink fail %d", retval);
+               dev_dbg (&dev->intf->dev, "unlink fail %d\n", retval);
                return retval;
        }
 
        wait_for_completion (&completion);
        retval = urb->status;
        simple_free_urb (urb);
-       return retval;
+
+       if (async)
+               return (retval != -ECONNRESET) ? -ECONNRESET : 0;
+       else
+               return (retval != -ENOENT) ? -ENOENT : 0;
 }
 
 static int unlink_simple (struct usbtest_dev *dev, int pipe, int len)
@@ -1534,6 +1537,7 @@
                        up (&dev->sem);
                        return res;
                }
+               dev_dbg(&intf->dev, "set to alt %d\n", dev->info->alt);
        }
 
        /*
@@ -1723,7 +1727,8 @@
                        retval = unlink_simple (dev, dev->in_pipe,
                                                param->length);
                if (retval)
-                       dbg ("unlink reads failed, iterations left %d", i);
+                       dev_dbg (&intf->dev, "unlink reads failed %d, "
+                               "iterations left %d\n", retval, i);
                break;
        case 12:
                if (dev->out_pipe == 0 || !param->length)
@@ -1735,7 +1740,8 @@
                        retval = unlink_simple (dev, dev->out_pipe,
                                                param->length);
                if (retval)
-                       dbg ("unlink writes failed, iterations left %d", i);
+                       dev_dbg (&intf->dev, "unlink writes failed %d, "
+                               "iterations left %d\n", retval, i);
                break;
 
        /* ep halt tests */
@@ -1965,7 +1971,10 @@
        .name           = "usb test device",
        .ep_in          = 2,
        .ep_out         = 2,
-       .alt            = 0,
+       .alt            = 1,
+       .autoconf       = 1,            // iso and ctrl_out need autoconf
+       .ctrl_out       = 1,
+       .iso            = 1,            // iso_ep's are #8 in/out
 };
 
 /* peripheral running Linux and 'zero.c' test firmware, or

Reply via email to