On Tue, 23 Feb 2016, Daniel Fraga wrote:

> On Tue, 23 Feb 2016 10:19:30 -0500 (EST)
> Alan Stern <[email protected]> wrote:
> 
> > All right; let's try a slightly different approach that shouldn't cause 
> > any crashes at all.
> 
>       Unfortunately it still crashed with this new patch. I took a
> picture:
> 
> http://imgur.com/OJCB129

I don't see any crash in that photo.

Also, it looks like the log results in this run were different from 
what you posted before.  Earlier you had "usbhid 3-1.6:1.0: post reset
hid_start_in -> -22" but the photo shows "usbhid 3-1.3:1.1: post reset
hid_start_in -> 0" (I think -- the photo is hard to read).

So either the mouse is plugged into a different port and is behaving 
differently, or else the photo shows the results for a different 
device, which isn't very useful.

Let's forget about trying to trace into the USB core and instead trace
just the usbhid driver.

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,6 +86,11 @@ 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) {
+                       pr_info("hid_start_in: urbin %p\n", usbhid->urbin);
+                       mdelay(5000);
+                       pr_info("hid_start_in: dev %p\n", usbhid->urbin->dev);
+               }
                rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC);
                if (rc != 0) {
                        clear_bit(HID_IN_RUNNING, &usbhid->iofl);
@@ -106,7 +111,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 +128,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 +695,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);
@@ -1139,7 +1144,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, 0);
                if (ret) {
                        dev_err(&hid->dev,
                                "failed to start in urb: %d\n", ret);
@@ -1457,7 +1462,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 +1504,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