public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anssi Hannula <anssi.hannula@gmail.com>
To: Vojtech Pavlik <vojtech@suse.cz>, Greg KH <greg@kroah.com>
Cc: linux-usb-devel@lists.sourceforge.net,
	linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org,
	Anssi Hannula <anssi.hannula@gmail.com>
Subject: [patch 2/3] hid: quirk for multi-input devices with unneeded output reports
Date: Thu, 11 Jan 2007 16:51:17 +0200	[thread overview]
Message-ID: <20070111145422.383583876@delta.onse.fi> (raw)
In-Reply-To: 20070111145115.405679742@delta.onse.fi

[-- Attachment #1: input-hid-multi-input-skip-output-report.diff --]
[-- Type: text/plain, Size: 3390 bytes --]

Add new quirk HID_QUIRK_SKIP_OUTPUT_REPORTS to skip output reports
when enumerating reports on a hid-input device. Add this quirk and
HID_QUIRK_MULTI_INPUT to 0810:0001.

PantherLord Twin USB Joystick, 0810:0001 has separate input reports
for 2 distinct game controllers in the same interface, so it needs
HID_QUIRK_MULTI_INPUT. However, the device also contains one output
report per controller which is used to control the force feedback
function, and we do not want those to appear as separate input
devices as well. The simplest approach seems to be to add a quirk to
skip output reports on 0810:0001, and allow the force feedback
driver to handle those.

Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>

---
 drivers/hid/hid-input.c      |    6 +++++-
 drivers/usb/input/hid-core.c |    5 +++++
 include/linux/hid.h          |    1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

Index: linux-2.6.20-rc3-ptr/drivers/hid/hid-input.c
===================================================================
--- linux-2.6.20-rc3-ptr.orig/drivers/hid/hid-input.c	2007-01-06 00:38:33.000000000 +0200
+++ linux-2.6.20-rc3-ptr/drivers/hid/hid-input.c	2007-01-07 21:07:34.000000000 +0200
@@ -796,6 +796,7 @@ int hidinput_connect(struct hid_device *
 	struct hid_input *hidinput = NULL;
 	struct input_dev *input_dev;
 	int i, j, k;
+	int max_report_type = HID_OUTPUT_REPORT;
 
 	INIT_LIST_HEAD(&hid->inputs);
 
@@ -808,7 +809,10 @@ int hidinput_connect(struct hid_device *
 	if (i == hid->maxcollection)
 		return -1;
 
-	for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++)
+	if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
+		max_report_type = HID_INPUT_REPORT;
+
+	for (k = HID_INPUT_REPORT; k <= max_report_type; k++)
 		list_for_each_entry(report, &hid->report_enum[k].report_list, list) {
 
 			if (!report->maxfield)
Index: linux-2.6.20-rc3-ptr/drivers/usb/input/hid-core.c
===================================================================
--- linux-2.6.20-rc3-ptr.orig/drivers/usb/input/hid-core.c	2007-01-07 20:53:21.000000000 +0200
+++ linux-2.6.20-rc3-ptr/drivers/usb/input/hid-core.c	2007-01-07 21:02:39.000000000 +0200
@@ -791,6 +791,9 @@ void usbhid_init_reports(struct hid_devi
 #define USB_VENDOR_ID_LOGITECH		0x046d
 #define USB_DEVICE_ID_LOGITECH_USB_RECEIVER	0xc101
 
+#define USB_VENDOR_ID_PANTHERLORD	0x0810
+#define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK	0x0001
+
 /*
  * Alphabetically sorted blacklist by quirk type.
  */
@@ -965,6 +968,8 @@ static const struct hid_blacklist {
 
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS },
 
+	{ USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
+
 	{ 0, 0 }
 };
 
Index: linux-2.6.20-rc3-ptr/include/linux/hid.h
===================================================================
--- linux-2.6.20-rc3-ptr.orig/include/linux/hid.h	2007-01-07 20:53:42.000000000 +0200
+++ linux-2.6.20-rc3-ptr/include/linux/hid.h	2007-01-07 20:56:10.000000000 +0200
@@ -264,6 +264,7 @@ struct hid_item {
 #define HID_QUIRK_INVERT_HWHEEL			0x00004000
 #define HID_QUIRK_POWERBOOK_ISO_KEYBOARD        0x00008000
 #define HID_QUIRK_BAD_RELATIVE_KEYS		0x00010000
+#define HID_QUIRK_SKIP_OUTPUT_REPORTS		0x00020000
 
 /*
  * This is the global environment of the parser. This information is

--
Anssi Hannula

  parent reply	other threads:[~2007-01-11 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-11 14:51 [patch 0/3] hid: series of patches for PantherLord USB/PS2 2in1 Adapter support Anssi Hannula
2007-01-11 14:51 ` [patch 1/3] hid: allow force feedback for multi-input devices Anssi Hannula
2007-01-11 14:51 ` Anssi Hannula [this message]
2007-01-11 14:51 ` [patch 3/3] hid: force feedback driver for PantherLord USB/PS2 2in1 Adapter Anssi Hannula
2007-01-11 16:51 ` [patch 0/3] hid: series of patches for PantherLord USB/PS2 2in1 Adapter support Greg KH
2007-01-11 18:56 ` Jiri Kosina

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=20070111145422.383583876@delta.onse.fi \
    --to=anssi.hannula@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=vojtech@suse.cz \
    /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