ChangeSet 1.1608.84.27, 2004/03/10 13:31:12-08:00, [EMAIL PROTECTED]

[PATCH] USB: usbtest updates (new firmware)

This includes some small updates to "usbtest", mostly
from Martin Diehl.  Please merge.



usbtest updates, supporting new firmware

    - Support the new usbtest_fw-20040305 EZ-USB firmware,
      which renumerates and handles full speed ISO transfers.
      (From Martin Diehl.)

    - Minor cleanups:  use dev_dbg(), let some slightly-off
      devices work in the control queueing test.

    - Be pickier about unlink tests:  insist that async
      and sync unlinks give the appropriate fault code.


 drivers/usb/misc/usbtest.c |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)


diff -Nru a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
--- a/drivers/usb/misc/usbtest.c        Tue Mar 16 15:02:04 2004
+++ b/drivers/usb/misc/usbtest.c        Tue Mar 16 15:02:04 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;
@@ -912,7 +911,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.
@@ -941,7 +940,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)
@@ -1068,7 +1067,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;
        }
 
@@ -1083,18 +1082,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)
@@ -1719,7 +1722,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)
@@ -1731,7 +1735,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 */
@@ -1961,7 +1966,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



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to