From: Anssi Hannula <anssi.hannula@gmail.com>
To: Dmitriy Geels <dmitriy.geels@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: hid-pidff bug: fails to find all required reports of saitek gamepad
Date: Fri, 08 May 2009 02:57:32 +0300 [thread overview]
Message-ID: <4A03756C.6020703@gmail.com> (raw)
In-Reply-To: <4A037290.60602@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
Anssi Hannula wrote:
> Dmitriy Geels wrote:
>> 2009/3/8 Anssi Hannula <anssi.hannula@gmail.com>:
>>> Dmitriy Geels wrote:
>>>> 2009/3/7 Anssi Hannula <anssi.hannula@gmail.com>:
>>>>> Provide the kernel log again, this time with debug=2 set for hid module
>>>>> and having run "fftest" with only one effect and then "ffmvforce".
>>>> here is it: http://paste.org.ru/index.pl?4bwah8
>>> Apply attached patch that adds more debug output and try this again.
>> Here is log: http://paste.org.ru/index.pl?0mtjuz
>>
>
> Sorry for the long delay.
>
> Try the attached (untested) patch. It adds a simple timeout to the hid
> ctrl and out urbs, discarding the faulty urb instead of getting stuck.
And of course there was an error, attached is a fixed patch :)
--
Anssi Hannula
[-- Attachment #2: hid-usb-add-urb-timeout.diff --]
[-- Type: text/plain, Size: 3377 bytes --]
---
drivers/hid/usbhid/hid-core.c | 18 ++++++++++++++++++
drivers/hid/usbhid/usbhid.h | 2 ++
2 files changed, 20 insertions(+)
Index: linux-2629-pidff/drivers/hid/usbhid/hid-core.c
===================================================================
--- linux-2629-pidff.orig/drivers/hid/usbhid/hid-core.c 2009-02-13 03:47:15.000000000 +0200
+++ linux-2629-pidff/drivers/hid/usbhid/hid-core.c 2009-05-08 02:55:59.000000000 +0300
@@ -251,6 +251,8 @@ static int hid_submit_out(struct hid_dev
return -1;
}
+ add_timer(&usbhid->urb_out_timeout, jiffies + msecs_to_jiffies(8000));
+
return 0;
}
@@ -303,6 +305,8 @@ static int hid_submit_ctrl(struct hid_de
return -1;
}
+ add_timer(&usbhid->urb_ctrl_timeout, jiffies + msecs_to_jiffies(8000));
+
return 0;
}
@@ -317,6 +321,8 @@ static void hid_irq_out(struct urb *urb)
unsigned long flags;
int unplug = 0;
+ del_timer(&usbhid->urb_out_timeout);
+
switch (urb->status) {
case 0: /* success */
break;
@@ -364,6 +370,7 @@ static void hid_ctrl(struct urb *urb)
unsigned long flags;
int unplug = 0;
+ del_timer(&usbhid->urb_ctrl_timeout);
spin_lock_irqsave(&usbhid->ctrllock, flags);
switch (urb->status) {
@@ -405,6 +412,13 @@ static void hid_ctrl(struct urb *urb)
wake_up(&usbhid->wait);
}
+static void hid_urb_timeout(unsigned long timer_data)
+{
+ struct urb *hid_urb = (struct urb *)timer_data;
+ dev_warn(&hid_urb->dev->dev, "hid urb timeout\n");
+ usb_unlink_urb(hid_urb);
+}
+
void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir)
{
int head;
@@ -851,6 +865,8 @@ static int usbhid_start(struct hid_devic
init_waitqueue_head(&usbhid->wait);
INIT_WORK(&usbhid->reset_work, hid_reset);
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
+ setup_timer(&usbhid->urb_out_timeout, hid_urb_timeout, (unsigned long) usbhid->urbout);
+ setup_timer(&usbhid->urb_ctrl_timeout, hid_urb_timeout, (unsigned long) usbhid->urbctrl);
spin_lock_init(&usbhid->inlock);
spin_lock_init(&usbhid->outlock);
@@ -915,6 +931,8 @@ static void usbhid_stop(struct hid_devic
del_timer_sync(&usbhid->io_retry);
cancel_work_sync(&usbhid->reset_work);
+ del_timer_sync(&usbhid->hid_out_timeout);
+ del_timer_sync(&usbhid->hid_ctrl_timeout);
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_disconnect(hid);
Index: linux-2629-pidff/drivers/hid/usbhid/usbhid.h
===================================================================
--- linux-2629-pidff.orig/drivers/hid/usbhid/usbhid.h 2009-05-08 01:53:33.000000000 +0300
+++ linux-2629-pidff/drivers/hid/usbhid/usbhid.h 2009-05-08 01:54:02.000000000 +0300
@@ -85,6 +85,8 @@ struct usbhid_device {
spinlock_t outlock; /* Output fifo spinlock */
unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
+ struct timer_list urb_out_timeout; /* Timeout for out urb */
+ struct timer_list urb_ctrl_timeout; /* Timeout for ctrl urb */
struct timer_list io_retry; /* Retry timer */
unsigned long stop_retry; /* Time to give up, in jiffies */
unsigned int retry_delay; /* Delay length in ms */
next prev parent reply other threads:[~2009-05-07 23:57 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-30 19:45 hid-pidff bug: fails to find all required reports of saitek gamepad Dmitriy Geels
2009-02-02 15:50 ` Anssi Hannula
2009-02-02 18:29 ` Dmitriy Geels
2009-02-02 18:48 ` Dmitriy Geels
2009-02-07 12:28 ` Anssi Hannula
[not found] ` <78f5d6bf0902092146x2abaf45an79e4546e75a80356@mail.gmail.com>
2009-02-10 7:49 ` Dmitriy Geels
2009-02-10 7:49 ` Fwd: " Dmitriy Geels
2009-02-10 16:06 ` Anssi Hannula
2009-02-11 9:12 ` Dmitriy Geels
2009-02-11 16:27 ` Anssi Hannula
2009-02-12 18:06 ` Dmitriy Geels
2009-02-12 18:42 ` Anssi Hannula
2009-02-13 8:33 ` Dmitriy Geels
2009-02-13 19:43 ` Anssi Hannula
[not found] ` <78f5d6bf0902141125m1bf9ac00xb2b414e81d81b869@mail.gmail.com>
[not found] ` <49972478.3060207@gmail.com>
2009-02-14 22:33 ` Dmitriy Geels
2009-02-17 12:16 ` Dmitriy Geels
2009-02-18 15:45 ` Anssi Hannula
2009-02-19 6:56 ` Dmitriy Geels
[not found] ` <78f5d6bf0902182254v191cc485x62eb211baaddd36@mail.gmail.com>
[not found] ` <499D7C66.6090000@gmail.com>
2009-02-26 21:21 ` Dmitriy Geels
2009-02-27 16:24 ` Anssi Hannula
2009-03-02 18:41 ` Dmitriy Geels
2009-03-02 20:35 ` Anssi Hannula
2009-03-03 6:28 ` Dmitriy Geels
2009-03-03 18:35 ` Dmitriy Geels
2009-03-07 14:38 ` Anssi Hannula
2009-03-08 5:18 ` Dmitriy Geels
2009-03-08 10:16 ` Anssi Hannula
2009-03-09 19:08 ` Dmitriy Geels
2009-05-07 23:45 ` Anssi Hannula
2009-05-07 23:57 ` Anssi Hannula [this message]
[not found] ` <78f5d6bf0906041227w3a58bde0u554a3d3336e17fa6@mail.gmail.com>
2009-06-06 12:14 ` Anssi Hannula
2009-06-09 5:02 ` Dmitriy Geels
2009-06-09 6:09 ` Alek Du
2009-06-09 7:37 ` Dmitriy Geels
2009-06-11 9:38 ` Dmitriy Geels
2009-06-11 20:11 ` Dmitriy Geels
2009-07-09 17:41 ` Dmitriy Geels
2009-07-09 17:58 ` Anssi Hannula
2009-11-06 9:06 ` Dmitriy Geels
2009-11-09 12:00 ` Dmitriy Geels
2009-11-20 14:17 ` Dmitriy Geels
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A03756C.6020703@gmail.com \
--to=anssi.hannula@gmail.com \
--cc=dmitriy.geels@gmail.com \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).