Commit 529ba76c authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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.
parent 6df6a80d
......@@ -149,8 +149,6 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
if (!out)
out = e;
}
if (in && out)
goto found;
continue;
try_iso:
if (e->desc.bEndpointAddress & USB_DIR_IN) {
......@@ -160,9 +158,9 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
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 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
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 void simple_callback (struct urb *urb, struct pt_regs *regs)
static struct urb *simple_alloc_urb (
struct usb_device *udev,
int pipe,
long bytes
unsigned long bytes
)
{
struct urb *urb;
......@@ -912,7 +911,7 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
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 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
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 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
* 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 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
* "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 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
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 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
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 @@ static struct usbtest_info fw_info = {
.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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment