linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Sun, 08 Mar 2009 12:16:53 +0200	[thread overview]
Message-ID: <49B39B15.6060609@gmail.com> (raw)
In-Reply-To: <78f5d6bf0903072118i19bc91a0taa4a5bda0fb19bf6@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

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.

-- 
Anssi Hannula

[-- Attachment #2: hid-queue-debugging.diff --]
[-- Type: text/plain, Size: 4509 bytes --]

--- linux-2629-pidff/drivers/hid/usbhid/hid-core.c	2009-02-13 03:47:15.000000000 +0200
+++ linux-2629-pidff/drivers/hid/usbhid/hid-core-clear.c	2009-03-08 12:13:38.000000000 +0200
@@ -244,7 +244,7 @@ static int hid_submit_out(struct hid_dev
 	memcpy(usbhid->outbuf, raw_report, usbhid->urbout->transfer_buffer_length);
 	kfree(raw_report);
 
-	dbg_hid("submitting out urb\n");
+	dbg_hid("submitting out urb %d\n", usbhid->outtail);
 
 	if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) {
 		err_hid("usb_submit_urb(out) failed");
@@ -298,6 +298,7 @@ static int hid_submit_ctrl(struct hid_de
 		usbhid->cr->bRequest == HID_REQ_SET_REPORT ? "Set_Report" : "Get_Report",
 		usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength);
 
+	dbg_hid("queue number %d\n", usbhid->ctrltail);
 	if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) {
 		err_hid("usb_submit_urb(ctrl) failed");
 		return -1;
@@ -333,14 +334,16 @@ static void hid_irq_out(struct urb *urb)
 	}
 
 	spin_lock_irqsave(&usbhid->outlock, flags);
-
+dbg_hid("hid_irq_out callback for %d\n", usbhid->outtail);
 	if (unplug)
 		usbhid->outtail = usbhid->outhead;
 	else
 		usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
 
 	if (usbhid->outhead != usbhid->outtail) {
+		dbg_hid("sending next report, not releasing lock, next is %d\n", usbhid->outtail);
 		if (hid_submit_out(hid)) {
+			dbg_hid("HID_OUT_RUNNING released in hid_irq_out(), hid_submit_out failure\n");
 			clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
 			wake_up(&usbhid->wait);
 		}
@@ -348,6 +351,7 @@ static void hid_irq_out(struct urb *urb)
 		return;
 	}
 
+	dbg_hid("clearing HID_OUT_RUNNING in hid_irq_out(), transfers done\n");
 	clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
 	spin_unlock_irqrestore(&usbhid->outlock, flags);
 	wake_up(&usbhid->wait);
@@ -386,13 +390,16 @@ static void hid_ctrl(struct urb *urb)
 				"received\n", urb->status);
 	}
 
+	dbg_hid("hid_ctrl() for feature report %d\n", usbhid->ctrltail);
 	if (unplug)
 		usbhid->ctrltail = usbhid->ctrlhead;
 	else
 		usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
 
 	if (usbhid->ctrlhead != usbhid->ctrltail) {
+		dbg_hid("submitting next ctrl report, nr is %d\n", usbhid->ctrltail);
 		if (hid_submit_ctrl(hid)) {
+			dbg_hid("HID_CTRL_RUNNING released in hid_ctrl(), hid_submit_ctrl failure\n");
 			clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
 			wake_up(&usbhid->wait);
 		}
@@ -400,6 +407,7 @@ static void hid_ctrl(struct urb *urb)
 		return;
 	}
 
+	dbg_hid("clearing HID_CTRL_RUNNING in hid_ctrl(), transfers done\n");
 	clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
 	spin_unlock_irqrestore(&usbhid->ctrllock, flags);
 	wake_up(&usbhid->wait);
@@ -435,9 +443,14 @@ void usbhid_submit_report(struct hid_dev
 		usbhid->out[usbhid->outhead].report = report;
 		usbhid->outhead = head;
 
-		if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl))
-			if (hid_submit_out(hid))
+		dbg_hid("usbhid_submit_report() done for output report %d\n", head - 1);
+		if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) {
+			dbg_hid("locked HID_OUT_RUNNING in usbhid_submit_report()\n")
+			if (hid_submit_out(hid)) {
+				dbg_hid("cleared HID_OUT_RUNNING in usbhid_submit_report(), failure in hid_submit_out\n");
 				clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
+			}
+		}
 
 		spin_unlock_irqrestore(&usbhid->outlock, flags);
 		return;
@@ -463,10 +476,14 @@ void usbhid_submit_report(struct hid_dev
 	usbhid->ctrl[usbhid->ctrlhead].report = report;
 	usbhid->ctrl[usbhid->ctrlhead].dir = dir;
 	usbhid->ctrlhead = head;
-
-	if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl))
-		if (hid_submit_ctrl(hid))
+	dbg_hid("usbhid_submit_report() done for feature report %d\n", head - 1);
+	if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) {
+		dbg_hid("locked HID_CTRL_RUNNING in usbhid_submit_report()\n");
+		if (hid_submit_ctrl(hid)) {
+			dbg_hid("cleared HID_CTRL_RUNNING in usbhid_submit_report(), failure in hid_submit_ctrl\n");
 			clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
+		}
+	}
 
 	spin_unlock_irqrestore(&usbhid->ctrllock, flags);
 }
@@ -503,7 +520,7 @@ int usbhid_wait_io(struct hid_device *hi
 				(!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) &&
 				!test_bit(HID_OUT_RUNNING, &usbhid->iofl)),
 					10*HZ)) {
-		dbg_hid("timeout waiting for ctrl or out queue to clear\n");
+		dbg_hid("timeout waiting for ctrl or out queue to clear, %d, %d\n", test_bit(HID_CTRL_RUNNING, &usbhid->iofl), test_bit(HID_OUT_RUNNING, &usbhid->iofl));
 		return -1;
 	}
 

  reply	other threads:[~2009-03-08 10:16 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 [this message]
2009-03-09 19:08                                                       ` Dmitriy Geels
2009-05-07 23:45                                                         ` Anssi Hannula
2009-05-07 23:57                                                           ` Anssi Hannula
     [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=49B39B15.6060609@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).