On Tue, 3 Jan 2006 10:44:12 -0500 (EST), Alan Stern <[EMAIL PROTECTED]> wrote:

> This patch (as628) fixes the USB HID core's interpretation of the -EILSEQ
> error code.  Contrary to the comments in the driver, the code does not
> always indicate a disconnection.  The new treatment is not ideal because
> it doesn't retry the transfer, but at least it doesn't give up completely
> on the device and it won't spam the kernel log with error messages.

I think I am confused here. The new treatment (in the patch) always retries
the transfer, whereaes old treatment was to give up... Here:

> @@ -927,8 +927,9 @@ static void hid_irq_in(struct urb *urb, 
>               case -ENOENT:
>               case -EPERM:
>               case -ESHUTDOWN:        /* unplug */
> -             case -EILSEQ:           /* unplug timeout on uhci */
>                       return;
> +             case -EILSEQ:           /* protocol error or unplug */
> +             case -EPROTO:           /* protocol error or unplug */
>               case -ETIMEDOUT:        /* NAK */
>                       break;
>               default:                /* error */

Now the _very_ old treatment was to retransmit with an error message.
Is this what you mean?

The problem you are going to hit with your always-resubmit patch is
when an unplug manages to loop and monopolize the CPU, thus not
allowing the disconnect thread to run.

We were hashing this with Fujitsu and other sufferers of strange Intel
hardware (imagine UHCI on ia64) in bug 167070 (unfortunately, private),
and we zeroed on the attached patch. It came out with RHEL 4 U3 Beta
in December, so not a lot of generic testing mileage is on it yet, only
unit and function tests. It applies to not just old, but old-old
2.6.9 base, so please keep it in mind.

BTW, you probably want to switch from cc-ing Vojtech to cc-ing Dmitry.

-- Pete

diff -urp -X dontdiff linux-2.6.9-16.EL/drivers/usb/input/hid-core.c 
linux-2.6.9-16.EL.z1/drivers/usb/input/hid-core.c
--- linux-2.6.9-16.EL/drivers/usb/input/hid-core.c      2005-08-16 
18:27:59.000000000 -0700
+++ linux-2.6.9-16.EL.z1/drivers/usb/input/hid-core.c   2005-11-15 
09:21:18.000000000 -0800
@@ -918,14 +918,26 @@ static void hid_irq_in(struct urb *urb, 
        struct hid_device       *hid = urb->context;
        int                     status;
 
+       if (urb->status == -EILSEQ) {   /* unplug (on uhci) or other error */
+               if (hid->error_count >= 100) {
+                       info("not resubmitting, input%d", hid->ifnum);
+                       return;
+               }
+               hid->error_count++;
+       } else {
+               hid->error_count = 0;
+       }
+
        switch (urb->status) {
                case 0:                 /* success */
                        hid_input_report(HID_INPUT_REPORT, urb, regs);
                        break;
                case -ECONNRESET:       /* unlink */
                case -ENOENT:
-               case -ESHUTDOWN:
+               case -EPERM:
+               case -ESHUTDOWN:        /* unplug */
                        return;
+               case -EILSEQ:
                case -ETIMEDOUT:        /* NAK */
                        break;
                default:                /* error */
diff -urp -X dontdiff linux-2.6.9-16.EL/drivers/usb/input/hid.h 
linux-2.6.9-16.EL.z1/drivers/usb/input/hid.h
--- linux-2.6.9-16.EL/drivers/usb/input/hid.h   2004-10-18 14:53:06.000000000 
-0700
+++ linux-2.6.9-16.EL.z1/drivers/usb/input/hid.h        2005-09-01 
22:26:57.000000000 -0700
@@ -382,6 +382,8 @@ struct hid_device {                                         
        /* device repo
        char phys[64];                                                  /* 
Device physical location */
        char uniq[64];                                                  /* 
Device unique identifier (serial #) */
 
+       int error_count;
+
        void *ff_private;                                               /* 
Private data for the force-feedback driver */
        void (*ff_exit)(struct hid_device*);                            /* 
Called by hid_exit_ff(hid) */
        int (*ff_event)(struct hid_device *hid, struct input_dev *input,


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to