On Mon, 29 Feb 2016, Daniel Fraga wrote:

> On Mon, 29 Feb 2016 16:28:40 -0500 (EST)
> Alan Stern <[email protected]> wrote:
> 
> > Okay, that's what I had guessed.  Somehow usbhid->urbin is getting set 
> > to NULL.  Maybe the patch below will indicate why.  When you post the 
> > log, include everything that mentions the 3-1.6 device -- even if they 
> > precede the suspend test.
> 
>       Ok, before the suspend test:
> 
> Feb 29 18:40:47 tux kernel: [    3.512861] usb 3-1.6: new full-speed USB 
> device number 6 using ehci-pci
> Feb 29 18:41:55 tux kernel: [  118.890031] usbhid 3-1.6:1.0: hid_cease_io urb 
>           (null)

Now we're making progress!  That shows a problem right there; we ought 
to have more stuff about 3-1.6 between those two lines.

The next patch adds some more debugging output.  For this test you 
don't even have to suspend the system; all I need to see is the output 
for 3-1.6 during boot-up and shortly thereafter.

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
@@ -75,7 +75,7 @@ static int hid_submit_ctrl(struct hid_de
 static void hid_cancel_delayed_stuff(struct usbhid_device *usbhid);
 
 /* Start up the input URB */
-static int hid_start_in(struct hid_device *hid)
+static int hid_start_in(struct hid_device *hid, int alantest)
 {
        unsigned long flags;
        int rc = 0;
@@ -86,8 +86,12 @@ static int hid_start_in(struct hid_devic
                        !test_bit(HID_DISCONNECTED, &usbhid->iofl) &&
                        !test_bit(HID_SUSPENDED, &usbhid->iofl) &&
                        !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) {
+               if (alantest)
+                       dev_info(&usbhid->intf->dev, "hid_start_in: urbin 
%p\n", usbhid->urbin);
                rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC);
                if (rc != 0) {
+                       if (alantest)
+                               dev_info(&usbhid->intf->dev, "start failed: 
%d\n", rc);
                        clear_bit(HID_IN_RUNNING, &usbhid->iofl);
                        if (rc == -ENOSPC)
                                set_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
@@ -106,7 +110,7 @@ static void hid_retry_timeout(unsigned l
        struct usbhid_device *usbhid = hid->driver_data;
 
        dev_dbg(&usbhid->intf->dev, "retrying intr urb\n");
-       if (hid_start_in(hid))
+       if (hid_start_in(hid, 0))
                hid_io_error(hid);
 }
 
@@ -123,7 +127,7 @@ static void hid_reset(struct work_struct
                rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid->urbin->pipe);
                clear_bit(HID_CLEAR_HALT, &usbhid->iofl);
                if (rc == 0) {
-                       hid_start_in(hid);
+                       hid_start_in(hid, 0);
                } else {
                        dev_dbg(&usbhid->intf->dev,
                                        "clear-halt failed: %d\n", rc);
@@ -690,7 +694,7 @@ int usbhid_open(struct hid_device *hid)
                }
                usbhid->intf->needs_remote_wakeup = 1;
                set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
-               res = hid_start_in(hid);
+               res = hid_start_in(hid, 0);
                if (res) {
                        if (res != -ENOSPC) {
                                hid_io_error(hid);
@@ -1100,6 +1104,7 @@ static int usbhid_start(struct hid_devic
                                continue;
                        if (!(usbhid->urbin = usb_alloc_urb(0, GFP_KERNEL)))
                                goto fail;
+                       dev_info(&intf->dev, "usbhid_start urb %p\n", 
usbhid->urbin);
                        pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
                        usb_fill_int_urb(usbhid->urbin, dev, pipe, 
usbhid->inbuf, insize,
                                         hid_irq_in, hid, interval);
@@ -1117,6 +1122,8 @@ static int usbhid_start(struct hid_devic
                        usbhid->urbout->transfer_flags |= 
URB_NO_TRANSFER_DMA_MAP;
                }
        }
+       if (!usbhid->urbin)
+               dev_info(&intf->dev, "no input endpoint!\n");
 
        usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
        if (!usbhid->urbctrl) {
@@ -1139,7 +1146,7 @@ static int usbhid_start(struct hid_devic
                if (ret)
                        goto fail;
                usbhid->intf->needs_remote_wakeup = 1;
-               ret = hid_start_in(hid);
+               ret = hid_start_in(hid, 1);
                if (ret) {
                        dev_err(&hid->dev,
                                "failed to start in urb: %d\n", ret);
@@ -1162,6 +1169,7 @@ static int usbhid_start(struct hid_devic
        return 0;
 
 fail:
+       dev_info(&intf->dev, "usbhid_start fail urb %p\n", usbhid->urbin);
        usb_free_urb(usbhid->urbin);
        usb_free_urb(usbhid->urbout);
        usb_free_urb(usbhid->urbctrl);
@@ -1194,6 +1202,7 @@ static void usbhid_stop(struct hid_devic
 
        hid->claimed = 0;
 
+       dev_info(&usbhid->intf->dev, "usbhid_stop urb %p\n", usbhid->urbin);
        usb_free_urb(usbhid->urbin);
        usb_free_urb(usbhid->urbctrl);
        usb_free_urb(usbhid->urbout);
@@ -1399,6 +1408,7 @@ static void hid_cancel_delayed_stuff(str
 static void hid_cease_io(struct usbhid_device *usbhid)
 {
        del_timer_sync(&usbhid->io_retry);
+       dev_info(&usbhid->intf->dev, "hid_cease_io urb %p\n", usbhid->urbin);
        usb_kill_urb(usbhid->urbin);
        usb_kill_urb(usbhid->urbctrl);
        usb_kill_urb(usbhid->urbout);
@@ -1457,7 +1467,8 @@ 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);
-       status = hid_start_in(hid);
+       status = hid_start_in(hid, 1);
+       dev_info(&intf->dev, "post reset hid_start_in -> %d\n", status);
        if (status < 0)
                hid_io_error(hid);
        usbhid_restart_queues(usbhid);
@@ -1498,7 +1509,7 @@ static int hid_resume_common(struct hid_
        usbhid_restart_queues(usbhid);
        spin_unlock_irq(&usbhid->lock);
 
-       status = hid_start_in(hid);
+       status = hid_start_in(hid, 0);
        if (status < 0)
                hid_io_error(hid);
 

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

Reply via email to