On Thu, 18 Feb 2016, Daniel Fraga wrote:

> On Thu, 18 Feb 2016 15:23:00 -0500 (EST)
> Alan Stern <st...@rowland.harvard.edu> wrote:
> 
> > Something like the patch below (untested).
> 
> > +   dev_info(&intf->dev, "post reset hid_start_in -> %d\n", status);
> 
>       Ok, so I got the following:
> 
> Feb 18 19:22:26 tux kernel: [  258.693120] usb 3-1.6: reset full-speed USB 
> device number 6 using ehci-pci
> Feb 18 19:22:26 tux kernel: [  258.783654] usbhid 3-1.6:1.0: post reset 
> hid_start_in -> -22

>       If you need more tests, just ask.

-22 is -EINVAL, so we need to figure out which of the many possible
EINVAL errors you're getting.  Try the patch below.

Alan Stern



Index: usb-4.4/drivers/hid/usbhid/hid-core.c
===================================================================
--- usb-4.4.orig/drivers/hid/usbhid/hid-core.c
+++ usb-4.4/drivers/hid/usbhid/hid-core.c
@@ -1427,6 +1427,7 @@ static int hid_post_reset(struct usb_int
        struct usb_host_interface *interface = intf->cur_altsetting;
        int status;
        char *rdesc;
+       extern int alantest;
 
        /* Fetch and examine the HID report descriptor. If this
         * has changed, then rebind. Since usbcore's check of the
@@ -1457,7 +1458,10 @@ static int hid_post_reset(struct usb_int
        clear_bit(HID_RESET_PENDING, &usbhid->iofl);
        spin_unlock_irq(&usbhid->lock);
        hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0);
+       alantest = 1;
        status = hid_start_in(hid);
+       alantest = 0;
+       dev_info(&intf->dev, "post reset hid_start_in -> %d\n", status);
        if (status < 0)
                hid_io_error(hid);
        usbhid_restart_queues(usbhid);
Index: usb-4.4/drivers/usb/core/urb.c
===================================================================
--- usb-4.4.orig/drivers/usb/core/urb.c
+++ usb-4.4/drivers/usb/core/urb.c
@@ -184,6 +184,9 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
 
 /*-------------------------------------------------------------------*/
 
+int alantest;
+EXPORT_SYMBOL(alantest);
+
 /**
  * usb_submit_urb - issue an asynchronous transfer request for an endpoint
  * @urb: pointer to the urb describing the request
@@ -332,8 +335,10 @@ int usb_submit_urb(struct urb *urb, gfp_
        int                             is_out;
        unsigned int                    allowed;
 
+       if (alantest)  dev_info(&urb->dev->dev, "submit A\n");
        if (!urb || !urb->complete)
                return -EINVAL;
+       if (alantest)  dev_info(&urb->dev->dev, "submit B\n");
        if (urb->hcpriv) {
                WARN_ONCE(1, "URB %p submitted while active\n", urb);
                return -EBUSY;
@@ -395,6 +400,7 @@ int usb_submit_urb(struct urb *urb, gfp_
         * but drivers only control those sizes for ISO.
         * while we're checking, initialize return status.
         */
+       if (alantest)  dev_info(&urb->dev->dev, "submit C\n");
        if (xfertype == USB_ENDPOINT_XFER_ISOC) {
                int     n, len;
 
@@ -433,6 +439,7 @@ int usb_submit_urb(struct urb *urb, gfp_
                        if (sg->length % max)
                                return -EINVAL;
        }
+       if (alantest)  dev_info(&urb->dev->dev, "submit D\n");
 
        /* the I/O buffer must be mapped/unmapped, except when length=0 */
        if (urb->transfer_buffer_length > INT_MAX)
@@ -487,6 +494,7 @@ int usb_submit_urb(struct urb *urb, gfp_
        case USB_ENDPOINT_XFER_ISOC:
        case USB_ENDPOINT_XFER_INT:
                /* too small? */
+               if (alantest)  dev_info(&urb->dev->dev, "submit E\n");
                switch (dev->speed) {
                case USB_SPEED_WIRELESS:
                        if ((urb->interval < 6)
@@ -497,6 +505,7 @@ int usb_submit_urb(struct urb *urb, gfp_
                                return -EINVAL;
                        break;
                }
+               if (alantest)  dev_info(&urb->dev->dev, "submit F\n");
                /* too big? */
                switch (dev->speed) {
                case USB_SPEED_SUPER:   /* units are 125us */
@@ -532,6 +541,7 @@ int usb_submit_urb(struct urb *urb, gfp_
                default:
                        return -EINVAL;
                }
+               if (alantest)  dev_info(&urb->dev->dev, "submit G\n");
                if (dev->speed != USB_SPEED_WIRELESS) {
                        /* Round down to a power of 2, no more than max */
                        urb->interval = min(max, 1 << ilog2(urb->interval));

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to