hid: quirk for multi-input devices with unneeded output reports
authorAnssi Hannula <anssi.hannula@gmail.com>
Thu, 11 Jan 2007 14:51:17 +0000 (16:51 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 5 Feb 2007 09:00:04 +0000 (10:00 +0100)
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-input.c
drivers/usb/input/hid-core.c
include/linux/hid.h

index c7a6833f68210ae90aa3c2c1902624304032b312..33b1126f5e5d263a0d6f96b34aa827035e65045e 100644 (file)
@@ -816,6 +816,7 @@ int hidinput_connect(struct hid_device *hid)
        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);
 
@@ -828,7 +829,10 @@ int hidinput_connect(struct hid_device *hid)
        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 2971182bbdf6d396e799f92f4565c776206fe26f..1fa42f400176dceb16d64921ef3f26a8d2fc2b44 100644 (file)
@@ -792,6 +792,9 @@ void usbhid_init_reports(struct hid_device *hid)
 #define USB_VENDOR_ID_IMATION          0x0718
 #define USB_DEVICE_ID_DISC_STAKKA      0xd000
 
+#define USB_VENDOR_ID_PANTHERLORD      0x0810
+#define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK    0x0001
+
 /*
  * Alphabetically sorted blacklist by quirk type.
  */
@@ -969,6 +972,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 342b4e639acb7a1014e375186345d303458114a5..523b8341e7916a7f242c6723b152023284286611 100644 (file)
@@ -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