Re: hid-pidff bug: fails to find all required reports of saitek gamepad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitriy Geels wrote:
> 2009/3/7 Anssi Hannula <anssi.hannula@xxxxxxxxx>:
>> 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
--- 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;
 	}
 

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux