Commit:     5e2a55f25d255a356bdaf2cb04c71b8d76c307a8
Parent:     48b4554aca28f721d3dfbab077c05032b3d1cd31
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 20 19:03:31 2007 +0100
Committer:  Jiri Kosina <[EMAIL PROTECTED]>
CommitDate: Wed Apr 11 10:36:02 2007 +0200

    USB HID: fix retry & reset logic
    The USB HID driver fails to reset its error-retry timeout when there
    has been a long time interval between I/O errors with no successful URB
    completions in the meantime.  As a result, the very next error would
    trigger an immediate reset, even if it was a chance event occurring
    long after the previous error.
    More USB keyboards and mice than one might expect end up getting I/O
    errors. Almost always this results from hardware problems of one sort of
    another. For example, people attach the device to a USB extension cable,
    which degrades the signal.  Or they simply have poor quality cables to
    begin with. Or they use a KVM switch which doesn't handle USB messages
    correctly. Etc...
    There have been reports from several users in which these I/O
    errors would occur more or less randomly, at intervals ranging from
    seconds to minutes.  The error-handling code in hid-core.c was originally
    meant for situations where a single outage would persist for a few hundred
    ms (electromagnetic interference, for example).  It didn't work right when
    these more sporadic errors occurred, because of a flaw in the logic
    which this patch fixes.
    This patch (as873) fixes that oversight.
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Signed-off-by: Jiri Kosina <[EMAIL PROTECTED]>
 drivers/hid/usbhid/hid-core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 7c0fc11..35a41e6 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -554,6 +554,11 @@ static void hid_io_error(struct hid_device *hid)
        if (usb_get_intfdata(usbhid->intf) == NULL)
                goto done;
+       /* If it has been a while since the last error, we'll assume
+        * this a brand new error and reset the retry timeout. */
+       if (time_after(jiffies, usbhid->stop_retry + HZ/2))
+               usbhid->retry_delay = 0;
        /* When an error occurs, retry at increasing intervals */
        if (usbhid->retry_delay == 0) {
                usbhid->retry_delay = 13;       /* Then 26, 52, 104, 104, ... */
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to