USB: usbtest fix coding style
Signed-off-by: Martin Fuzzey <mfuzzey@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
80f0cf3947
commit
fabbf2196d
@@ -13,17 +13,16 @@
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// FIXME make these public somewhere; usbdevfs.h?
|
/* FIXME make these public somewhere; usbdevfs.h? */
|
||||||
//
|
|
||||||
struct usbtest_param {
|
struct usbtest_param {
|
||||||
// inputs
|
/* inputs */
|
||||||
unsigned test_num; /* 0..(TEST_CASES-1) */
|
unsigned test_num; /* 0..(TEST_CASES-1) */
|
||||||
unsigned iterations;
|
unsigned iterations;
|
||||||
unsigned length;
|
unsigned length;
|
||||||
unsigned vary;
|
unsigned vary;
|
||||||
unsigned sglen;
|
unsigned sglen;
|
||||||
|
|
||||||
// outputs
|
/* outputs */
|
||||||
struct timeval duration;
|
struct timeval duration;
|
||||||
};
|
};
|
||||||
#define USBTEST_REQUEST _IOWR('U', 100, struct usbtest_param)
|
#define USBTEST_REQUEST _IOWR('U', 100, struct usbtest_param)
|
||||||
@@ -115,7 +114,7 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
|
|||||||
case USB_ENDPOINT_XFER_ISOC:
|
case USB_ENDPOINT_XFER_ISOC:
|
||||||
if (dev->info->iso)
|
if (dev->info->iso)
|
||||||
goto try_iso;
|
goto try_iso;
|
||||||
// FALLTHROUGH
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -215,7 +214,7 @@ static struct urb *simple_alloc_urb (
|
|||||||
return urb;
|
return urb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned pattern = 0;
|
static unsigned pattern;
|
||||||
static unsigned mod_pattern;
|
static unsigned mod_pattern;
|
||||||
module_param_named(pattern, mod_pattern, uint, S_IRUGO | S_IWUSR);
|
module_param_named(pattern, mod_pattern, uint, S_IRUGO | S_IWUSR);
|
||||||
MODULE_PARM_DESC(mod_pattern, "i/o pattern (0 == zeroes)");
|
MODULE_PARM_DESC(mod_pattern, "i/o pattern (0 == zeroes)");
|
||||||
@@ -228,7 +227,7 @@ static inline void simple_fill_buf (struct urb *urb)
|
|||||||
|
|
||||||
switch (pattern) {
|
switch (pattern) {
|
||||||
default:
|
default:
|
||||||
// FALLTHROUGH
|
/* FALLTHROUGH */
|
||||||
case 0:
|
case 0:
|
||||||
memset(buf, 0, len);
|
memset(buf, 0, len);
|
||||||
break;
|
break;
|
||||||
@@ -299,7 +298,8 @@ static int simple_io (
|
|||||||
init_completion(&completion);
|
init_completion(&completion);
|
||||||
if (usb_pipeout(urb->pipe))
|
if (usb_pipeout(urb->pipe))
|
||||||
simple_fill_buf(urb);
|
simple_fill_buf(urb);
|
||||||
if ((retval = usb_submit_urb (urb, GFP_KERNEL)) != 0)
|
retval = usb_submit_urb(urb, GFP_KERNEL);
|
||||||
|
if (retval != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* NOTE: no timeouts; can't be broken out of by interrupt */
|
/* NOTE: no timeouts; can't be broken out of by interrupt */
|
||||||
@@ -426,9 +426,9 @@ static int perform_sglist (
|
|||||||
/* FIXME if endpoint halted, clear halt (and log) */
|
/* FIXME if endpoint halted, clear halt (and log) */
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME for unlink or fault handling tests, don't report
|
/* FIXME for unlink or fault handling tests, don't report
|
||||||
// failure if retval is as we expected ...
|
* failure if retval is as we expected ...
|
||||||
|
*/
|
||||||
if (retval)
|
if (retval)
|
||||||
ERROR(tdev, "perform_sglist failed, "
|
ERROR(tdev, "perform_sglist failed, "
|
||||||
"iterations left %d, status %d\n",
|
"iterations left %d, status %d\n",
|
||||||
@@ -470,7 +470,7 @@ static int get_altsetting (struct usbtest_dev *dev)
|
|||||||
return dev->buf[0];
|
return dev->buf[0];
|
||||||
case 0:
|
case 0:
|
||||||
retval = -ERANGE;
|
retval = -ERANGE;
|
||||||
// FALLTHROUGH
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -621,8 +621,9 @@ static int ch9_postconfig (struct usbtest_dev *dev)
|
|||||||
return (retval < 0) ? retval : -EDOM;
|
return (retval < 0) ? retval : -EDOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME cross-checking udev->config[i] to make sure usbcore
|
/* FIXME cross-checking udev->config[i] to make sure usbcore
|
||||||
// parsed it right (etc) would be good testing paranoia
|
* parsed it right (etc) would be good testing paranoia
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and sometimes [9.2.6.6] speed dependent descriptors */
|
/* and sometimes [9.2.6.6] speed dependent descriptors */
|
||||||
@@ -663,7 +664,7 @@ static int ch9_postconfig (struct usbtest_dev *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME fetch strings from at least the device descriptor
|
/* FIXME fetch strings from at least the device descriptor */
|
||||||
|
|
||||||
/* [9.4.5] get_status always works */
|
/* [9.4.5] get_status always works */
|
||||||
retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
|
retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
|
||||||
@@ -672,8 +673,9 @@ static int ch9_postconfig (struct usbtest_dev *dev)
|
|||||||
return (retval < 0) ? retval : -EDOM;
|
return (retval < 0) ? retval : -EDOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME configuration.bmAttributes says if we could try to set/clear
|
/* FIXME configuration.bmAttributes says if we could try to set/clear
|
||||||
// the device's remote wakeup feature ... if we can, test that here
|
* the device's remote wakeup feature ... if we can, test that here
|
||||||
|
*/
|
||||||
|
|
||||||
retval = usb_get_status(udev, USB_RECIP_INTERFACE,
|
retval = usb_get_status(udev, USB_RECIP_INTERFACE,
|
||||||
iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
|
iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
|
||||||
@@ -681,7 +683,7 @@ static int ch9_postconfig (struct usbtest_dev *dev)
|
|||||||
dev_err(&iface->dev, "get interface status --> %d\n", retval);
|
dev_err(&iface->dev, "get interface status --> %d\n", retval);
|
||||||
return (retval < 0) ? retval : -EDOM;
|
return (retval < 0) ? retval : -EDOM;
|
||||||
}
|
}
|
||||||
// FIXME get status for each endpoint in the interface
|
/* FIXME get status for each endpoint in the interface */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -812,7 +814,8 @@ error:
|
|||||||
|
|
||||||
/* resubmit if we need to, else mark this as done */
|
/* resubmit if we need to, else mark this as done */
|
||||||
if ((status == 0) && (ctx->pending < ctx->count)) {
|
if ((status == 0) && (ctx->pending < ctx->count)) {
|
||||||
if ((status = usb_submit_urb (urb, GFP_ATOMIC)) != 0) {
|
status = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
|
if (status != 0) {
|
||||||
ERROR(ctx->dev,
|
ERROR(ctx->dev,
|
||||||
"can't resubmit ctrl %02x.%02x, err %d\n",
|
"can't resubmit ctrl %02x.%02x, err %d\n",
|
||||||
reqp->bRequestType, reqp->bRequest, status);
|
reqp->bRequestType, reqp->bRequest, status);
|
||||||
@@ -874,99 +877,103 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
|
|||||||
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
|
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
|
||||||
|
|
||||||
switch (i % NUM_SUBCASES) {
|
switch (i % NUM_SUBCASES) {
|
||||||
case 0: // get device descriptor
|
case 0: /* get device descriptor */
|
||||||
req.wValue = cpu_to_le16(USB_DT_DEVICE << 8);
|
req.wValue = cpu_to_le16(USB_DT_DEVICE << 8);
|
||||||
len = sizeof(struct usb_device_descriptor);
|
len = sizeof(struct usb_device_descriptor);
|
||||||
break;
|
break;
|
||||||
case 1: // get first config descriptor (only)
|
case 1: /* get first config descriptor (only) */
|
||||||
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
||||||
len = sizeof(struct usb_config_descriptor);
|
len = sizeof(struct usb_config_descriptor);
|
||||||
break;
|
break;
|
||||||
case 2: // get altsetting (OFTEN STALLS)
|
case 2: /* get altsetting (OFTEN STALLS) */
|
||||||
req.bRequest = USB_REQ_GET_INTERFACE;
|
req.bRequest = USB_REQ_GET_INTERFACE;
|
||||||
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
|
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
|
||||||
// index = 0 means first interface
|
/* index = 0 means first interface */
|
||||||
len = 1;
|
len = 1;
|
||||||
expected = EPIPE;
|
expected = EPIPE;
|
||||||
break;
|
break;
|
||||||
case 3: // get interface status
|
case 3: /* get interface status */
|
||||||
req.bRequest = USB_REQ_GET_STATUS;
|
req.bRequest = USB_REQ_GET_STATUS;
|
||||||
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
|
req.bRequestType = USB_DIR_IN|USB_RECIP_INTERFACE;
|
||||||
// interface 0
|
/* interface 0 */
|
||||||
len = 2;
|
len = 2;
|
||||||
break;
|
break;
|
||||||
case 4: // get device status
|
case 4: /* get device status */
|
||||||
req.bRequest = USB_REQ_GET_STATUS;
|
req.bRequest = USB_REQ_GET_STATUS;
|
||||||
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
|
req.bRequestType = USB_DIR_IN|USB_RECIP_DEVICE;
|
||||||
len = 2;
|
len = 2;
|
||||||
break;
|
break;
|
||||||
case 5: // get device qualifier (MAY STALL)
|
case 5: /* get device qualifier (MAY STALL) */
|
||||||
req.wValue = cpu_to_le16 (USB_DT_DEVICE_QUALIFIER << 8);
|
req.wValue = cpu_to_le16 (USB_DT_DEVICE_QUALIFIER << 8);
|
||||||
len = sizeof(struct usb_qualifier_descriptor);
|
len = sizeof(struct usb_qualifier_descriptor);
|
||||||
if (udev->speed != USB_SPEED_HIGH)
|
if (udev->speed != USB_SPEED_HIGH)
|
||||||
expected = EPIPE;
|
expected = EPIPE;
|
||||||
break;
|
break;
|
||||||
case 6: // get first config descriptor, plus interface
|
case 6: /* get first config descriptor, plus interface */
|
||||||
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
||||||
len = sizeof(struct usb_config_descriptor);
|
len = sizeof(struct usb_config_descriptor);
|
||||||
len += sizeof(struct usb_interface_descriptor);
|
len += sizeof(struct usb_interface_descriptor);
|
||||||
break;
|
break;
|
||||||
case 7: // get interface descriptor (ALWAYS STALLS)
|
case 7: /* get interface descriptor (ALWAYS STALLS) */
|
||||||
req.wValue = cpu_to_le16 (USB_DT_INTERFACE << 8);
|
req.wValue = cpu_to_le16 (USB_DT_INTERFACE << 8);
|
||||||
// interface == 0
|
/* interface == 0 */
|
||||||
len = sizeof(struct usb_interface_descriptor);
|
len = sizeof(struct usb_interface_descriptor);
|
||||||
expected = -EPIPE;
|
expected = -EPIPE;
|
||||||
break;
|
break;
|
||||||
// NOTE: two consecutive stalls in the queue here.
|
/* NOTE: two consecutive stalls in the queue here.
|
||||||
// that tests fault recovery a bit more aggressively.
|
* that tests fault recovery a bit more aggressively. */
|
||||||
case 8: // clear endpoint halt (MAY STALL)
|
case 8: /* clear endpoint halt (MAY STALL) */
|
||||||
req.bRequest = USB_REQ_CLEAR_FEATURE;
|
req.bRequest = USB_REQ_CLEAR_FEATURE;
|
||||||
req.bRequestType = USB_RECIP_ENDPOINT;
|
req.bRequestType = USB_RECIP_ENDPOINT;
|
||||||
// wValue 0 == ep halt
|
/* wValue 0 == ep halt */
|
||||||
// wIndex 0 == ep0 (shouldn't halt!)
|
/* wIndex 0 == ep0 (shouldn't halt!) */
|
||||||
len = 0;
|
len = 0;
|
||||||
pipe = usb_sndctrlpipe(udev, 0);
|
pipe = usb_sndctrlpipe(udev, 0);
|
||||||
expected = EPIPE;
|
expected = EPIPE;
|
||||||
break;
|
break;
|
||||||
case 9: // get endpoint status
|
case 9: /* get endpoint status */
|
||||||
req.bRequest = USB_REQ_GET_STATUS;
|
req.bRequest = USB_REQ_GET_STATUS;
|
||||||
req.bRequestType = USB_DIR_IN|USB_RECIP_ENDPOINT;
|
req.bRequestType = USB_DIR_IN|USB_RECIP_ENDPOINT;
|
||||||
// endpoint 0
|
/* endpoint 0 */
|
||||||
len = 2;
|
len = 2;
|
||||||
break;
|
break;
|
||||||
case 10: // trigger short read (EREMOTEIO)
|
case 10: /* trigger short read (EREMOTEIO) */
|
||||||
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
||||||
len = 1024;
|
len = 1024;
|
||||||
expected = -EREMOTEIO;
|
expected = -EREMOTEIO;
|
||||||
break;
|
break;
|
||||||
// NOTE: two consecutive _different_ faults in the queue.
|
/* NOTE: two consecutive _different_ faults in the queue. */
|
||||||
case 11: // get endpoint descriptor (ALWAYS STALLS)
|
case 11: /* get endpoint descriptor (ALWAYS STALLS) */
|
||||||
req.wValue = cpu_to_le16(USB_DT_ENDPOINT << 8);
|
req.wValue = cpu_to_le16(USB_DT_ENDPOINT << 8);
|
||||||
// endpoint == 0
|
/* endpoint == 0 */
|
||||||
len = sizeof(struct usb_interface_descriptor);
|
len = sizeof(struct usb_interface_descriptor);
|
||||||
expected = EPIPE;
|
expected = EPIPE;
|
||||||
break;
|
break;
|
||||||
// NOTE: sometimes even a third fault in the queue!
|
/* NOTE: sometimes even a third fault in the queue! */
|
||||||
case 12: // get string 0 descriptor (MAY STALL)
|
case 12: /* get string 0 descriptor (MAY STALL) */
|
||||||
req.wValue = cpu_to_le16(USB_DT_STRING << 8);
|
req.wValue = cpu_to_le16(USB_DT_STRING << 8);
|
||||||
// string == 0, for language IDs
|
/* string == 0, for language IDs */
|
||||||
len = sizeof(struct usb_interface_descriptor);
|
len = sizeof(struct usb_interface_descriptor);
|
||||||
// may succeed when > 4 languages
|
/* may succeed when > 4 languages */
|
||||||
expected = EREMOTEIO; // or EPIPE, if no strings
|
expected = EREMOTEIO; /* or EPIPE, if no strings */
|
||||||
break;
|
break;
|
||||||
case 13: // short read, resembling case 10
|
case 13: /* short read, resembling case 10 */
|
||||||
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
|
||||||
// last data packet "should" be DATA1, not DATA0
|
/* last data packet "should" be DATA1, not DATA0 */
|
||||||
len = 1024 - udev->descriptor.bMaxPacketSize0;
|
len = 1024 - udev->descriptor.bMaxPacketSize0;
|
||||||
expected = -EREMOTEIO;
|
expected = -EREMOTEIO;
|
||||||
break;
|
break;
|
||||||
case 14: // short read; try to fill the last packet
|
case 14: /* short read; try to fill the last packet */
|
||||||
req.wValue = cpu_to_le16((USB_DT_DEVICE << 8) | 0);
|
req.wValue = cpu_to_le16((USB_DT_DEVICE << 8) | 0);
|
||||||
/* device descriptor size == 18 bytes */
|
/* device descriptor size == 18 bytes */
|
||||||
len = udev->descriptor.bMaxPacketSize0;
|
len = udev->descriptor.bMaxPacketSize0;
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 8: len = 24; break;
|
case 8:
|
||||||
case 16: len = 32; break;
|
len = 24;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
len = 32;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
expected = -EREMOTEIO;
|
expected = -EREMOTEIO;
|
||||||
break;
|
break;
|
||||||
@@ -1033,7 +1040,7 @@ static void unlink1_callback (struct urb *urb)
|
|||||||
{
|
{
|
||||||
int status = urb->status;
|
int status = urb->status;
|
||||||
|
|
||||||
// we "know" -EPIPE (stall) never happens
|
/* we "know" -EPIPE (stall) never happens */
|
||||||
if (!status)
|
if (!status)
|
||||||
status = usb_submit_urb(urb, GFP_ATOMIC);
|
status = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
if (status) {
|
if (status) {
|
||||||
@@ -1061,7 +1068,8 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
|
|||||||
* FIXME want additional tests for when endpoint is STALLing
|
* FIXME want additional tests for when endpoint is STALLing
|
||||||
* due to errors, or is just NAKing requests.
|
* due to errors, or is just NAKing requests.
|
||||||
*/
|
*/
|
||||||
if ((retval = usb_submit_urb (urb, GFP_KERNEL)) != 0) {
|
retval = usb_submit_urb(urb, GFP_KERNEL);
|
||||||
|
if (retval != 0) {
|
||||||
dev_err(&dev->intf->dev, "submit fail %d\n", retval);
|
dev_err(&dev->intf->dev, "submit fail %d\n", retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -1434,7 +1442,7 @@ static struct urb *iso_alloc_urb (
|
|||||||
}
|
}
|
||||||
|
|
||||||
urb->complete = iso_callback;
|
urb->complete = iso_callback;
|
||||||
// urb->context = SET BY CALLER
|
/* urb->context = SET BY CALLER */
|
||||||
urb->interval = 1 << (desc->bInterval - 1);
|
urb->interval = 1 << (desc->bInterval - 1);
|
||||||
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
|
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
|
||||||
return urb;
|
return urb;
|
||||||
@@ -1569,7 +1577,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
struct timeval start;
|
struct timeval start;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
// FIXME USBDEVFS_CONNECTINFO doesn't say how fast the device is.
|
/* FIXME USBDEVFS_CONNECTINFO doesn't say how fast the device is. */
|
||||||
|
|
||||||
pattern = mod_pattern;
|
pattern = mod_pattern;
|
||||||
|
|
||||||
@@ -1634,7 +1642,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk sink (maybe accepts short writes)
|
/* FIRMWARE: bulk sink (maybe accepts short writes) */
|
||||||
retval = simple_io(dev, urb, param->iterations, 0, 0, "test1");
|
retval = simple_io(dev, urb, param->iterations, 0, 0, "test1");
|
||||||
simple_free_urb(urb);
|
simple_free_urb(urb);
|
||||||
break;
|
break;
|
||||||
@@ -1649,7 +1657,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk source (maybe generates short writes)
|
/* FIRMWARE: bulk source (maybe generates short writes) */
|
||||||
retval = simple_io(dev, urb, param->iterations, 0, 0, "test2");
|
retval = simple_io(dev, urb, param->iterations, 0, 0, "test2");
|
||||||
simple_free_urb(urb);
|
simple_free_urb(urb);
|
||||||
break;
|
break;
|
||||||
@@ -1664,7 +1672,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk sink (maybe accepts short writes)
|
/* FIRMWARE: bulk sink (maybe accepts short writes) */
|
||||||
retval = simple_io(dev, urb, param->iterations, param->vary,
|
retval = simple_io(dev, urb, param->iterations, param->vary,
|
||||||
0, "test3");
|
0, "test3");
|
||||||
simple_free_urb(urb);
|
simple_free_urb(urb);
|
||||||
@@ -1680,7 +1688,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk source (maybe generates short writes)
|
/* FIRMWARE: bulk source (maybe generates short writes) */
|
||||||
retval = simple_io(dev, urb, param->iterations, param->vary,
|
retval = simple_io(dev, urb, param->iterations, param->vary,
|
||||||
0, "test4");
|
0, "test4");
|
||||||
simple_free_urb(urb);
|
simple_free_urb(urb);
|
||||||
@@ -1699,7 +1707,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk sink (maybe accepts short writes)
|
/* FIRMWARE: bulk sink (maybe accepts short writes) */
|
||||||
retval = perform_sglist(dev, param->iterations, dev->out_pipe,
|
retval = perform_sglist(dev, param->iterations, dev->out_pipe,
|
||||||
&req, sg, param->sglen);
|
&req, sg, param->sglen);
|
||||||
free_sglist(sg, param->sglen);
|
free_sglist(sg, param->sglen);
|
||||||
@@ -1717,7 +1725,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk source (maybe generates short writes)
|
/* FIRMWARE: bulk source (maybe generates short writes) */
|
||||||
retval = perform_sglist(dev, param->iterations, dev->in_pipe,
|
retval = perform_sglist(dev, param->iterations, dev->in_pipe,
|
||||||
&req, sg, param->sglen);
|
&req, sg, param->sglen);
|
||||||
free_sglist(sg, param->sglen);
|
free_sglist(sg, param->sglen);
|
||||||
@@ -1734,7 +1742,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk sink (maybe accepts short writes)
|
/* FIRMWARE: bulk sink (maybe accepts short writes) */
|
||||||
retval = perform_sglist(dev, param->iterations, dev->out_pipe,
|
retval = perform_sglist(dev, param->iterations, dev->out_pipe,
|
||||||
&req, sg, param->sglen);
|
&req, sg, param->sglen);
|
||||||
free_sglist(sg, param->sglen);
|
free_sglist(sg, param->sglen);
|
||||||
@@ -1751,7 +1759,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// FIRMWARE: bulk source (maybe generates short writes)
|
/* FIRMWARE: bulk source (maybe generates short writes) */
|
||||||
retval = perform_sglist(dev, param->iterations, dev->in_pipe,
|
retval = perform_sglist(dev, param->iterations, dev->in_pipe,
|
||||||
&req, sg, param->sglen);
|
&req, sg, param->sglen);
|
||||||
free_sglist(sg, param->sglen);
|
free_sglist(sg, param->sglen);
|
||||||
@@ -1844,7 +1852,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
"TEST 15: write %d iso, %d entries of %d bytes\n",
|
"TEST 15: write %d iso, %d entries of %d bytes\n",
|
||||||
param->iterations,
|
param->iterations,
|
||||||
param->sglen, param->length);
|
param->sglen, param->length);
|
||||||
// FIRMWARE: iso sink
|
/* FIRMWARE: iso sink */
|
||||||
retval = test_iso_queue(dev, param,
|
retval = test_iso_queue(dev, param,
|
||||||
dev->out_iso_pipe, dev->iso_out);
|
dev->out_iso_pipe, dev->iso_out);
|
||||||
break;
|
break;
|
||||||
@@ -1857,14 +1865,14 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
"TEST 16: read %d iso, %d entries of %d bytes\n",
|
"TEST 16: read %d iso, %d entries of %d bytes\n",
|
||||||
param->iterations,
|
param->iterations,
|
||||||
param->sglen, param->length);
|
param->sglen, param->length);
|
||||||
// FIRMWARE: iso source
|
/* FIRMWARE: iso source */
|
||||||
retval = test_iso_queue(dev, param,
|
retval = test_iso_queue(dev, param,
|
||||||
dev->in_iso_pipe, dev->iso_in);
|
dev->in_iso_pipe, dev->iso_in);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// FIXME unlink from queue (ring with N urbs)
|
/* FIXME unlink from queue (ring with N urbs) */
|
||||||
|
|
||||||
// FIXME scatterlist cancel (needs helper thread)
|
/* FIXME scatterlist cancel (needs helper thread) */
|
||||||
|
|
||||||
}
|
}
|
||||||
do_gettimeofday(¶m->duration);
|
do_gettimeofday(¶m->duration);
|
||||||
@@ -1880,7 +1888,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static unsigned force_interrupt = 0;
|
static unsigned force_interrupt;
|
||||||
module_param(force_interrupt, uint, 0);
|
module_param(force_interrupt, uint, 0);
|
||||||
MODULE_PARM_DESC(force_interrupt, "0 = test default; else interrupt");
|
MODULE_PARM_DESC(force_interrupt, "0 = test default; else interrupt");
|
||||||
|
|
||||||
@@ -1930,7 +1938,8 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
dev->intf = intf;
|
dev->intf = intf;
|
||||||
|
|
||||||
/* cacheline-aligned scratch for i/o */
|
/* cacheline-aligned scratch for i/o */
|
||||||
if ((dev->buf = kmalloc (TBUF_SIZE, GFP_KERNEL)) == NULL) {
|
dev->buf = kmalloc(TBUF_SIZE, GFP_KERNEL);
|
||||||
|
if (dev->buf == NULL) {
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -1984,10 +1993,18 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
dev_info(&intf->dev, "%s speed {control%s%s%s%s%s} tests%s\n",
|
dev_info(&intf->dev, "%s speed {control%s%s%s%s%s} tests%s\n",
|
||||||
({ char *tmp;
|
({ char *tmp;
|
||||||
switch (udev->speed) {
|
switch (udev->speed) {
|
||||||
case USB_SPEED_LOW: tmp = "low"; break;
|
case USB_SPEED_LOW:
|
||||||
case USB_SPEED_FULL: tmp = "full"; break;
|
tmp = "low";
|
||||||
case USB_SPEED_HIGH: tmp = "high"; break;
|
break;
|
||||||
default: tmp = "unknown"; break;
|
case USB_SPEED_FULL:
|
||||||
|
tmp = "full";
|
||||||
|
break;
|
||||||
|
case USB_SPEED_HIGH:
|
||||||
|
tmp = "high";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tmp = "unknown";
|
||||||
|
break;
|
||||||
}; tmp; }),
|
}; tmp; }),
|
||||||
info->ctrl_out ? " in/out" : "",
|
info->ctrl_out ? " in/out" : "",
|
||||||
rtest, wtest,
|
rtest, wtest,
|
||||||
@@ -2050,9 +2067,9 @@ static struct usbtest_info fw_info = {
|
|||||||
.ep_in = 2,
|
.ep_in = 2,
|
||||||
.ep_out = 2,
|
.ep_out = 2,
|
||||||
.alt = 1,
|
.alt = 1,
|
||||||
.autoconf = 1, // iso and ctrl_out need autoconf
|
.autoconf = 1, /* iso and ctrl_out need autoconf */
|
||||||
.ctrl_out = 1,
|
.ctrl_out = 1,
|
||||||
.iso = 1, // iso_ep's are #8 in/out
|
.iso = 1, /* iso_ep's are #8 in/out */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* peripheral running Linux and 'zero.c' test firmware, or
|
/* peripheral running Linux and 'zero.c' test firmware, or
|
||||||
@@ -2145,7 +2162,7 @@ static const struct usb_device_id id_table[] = {
|
|||||||
|
|
||||||
#ifdef KEYSPAN_19Qi
|
#ifdef KEYSPAN_19Qi
|
||||||
/* Keyspan 19qi uses an21xx (original EZ-USB) */
|
/* Keyspan 19qi uses an21xx (original EZ-USB) */
|
||||||
// this does not coexist with the real Keyspan 19qi driver!
|
/* this does not coexist with the real Keyspan 19qi driver! */
|
||||||
{ USB_DEVICE(0x06cd, 0x010b),
|
{ USB_DEVICE(0x06cd, 0x010b),
|
||||||
.driver_info = (unsigned long) &ez1_info,
|
.driver_info = (unsigned long) &ez1_info,
|
||||||
},
|
},
|
||||||
@@ -2155,7 +2172,7 @@ static const struct usb_device_id id_table[] = {
|
|||||||
|
|
||||||
#ifdef IBOT2
|
#ifdef IBOT2
|
||||||
/* iBOT2 makes a nice source of high speed bulk-in data */
|
/* iBOT2 makes a nice source of high speed bulk-in data */
|
||||||
// this does not coexist with a real iBOT2 driver!
|
/* this does not coexist with a real iBOT2 driver! */
|
||||||
{ USB_DEVICE(0x0b62, 0x0059),
|
{ USB_DEVICE(0x0b62, 0x0059),
|
||||||
.driver_info = (unsigned long) &ibot2_info,
|
.driver_info = (unsigned long) &ibot2_info,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user