Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hid: quirk for multi-input devices with unneeded output reports

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>

authored by

Anssi Hannula and committed by
Jiri Kosina
5556feae c4146067

+11 -1
+5 -1
drivers/hid/hid-input.c
··· 816 816 struct hid_input *hidinput = NULL; 817 817 struct input_dev *input_dev; 818 818 int i, j, k; 819 + int max_report_type = HID_OUTPUT_REPORT; 819 820 820 821 INIT_LIST_HEAD(&hid->inputs); 821 822 ··· 829 828 if (i == hid->maxcollection) 830 829 return -1; 831 830 832 - for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) 831 + if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) 832 + max_report_type = HID_INPUT_REPORT; 833 + 834 + for (k = HID_INPUT_REPORT; k <= max_report_type; k++) 833 835 list_for_each_entry(report, &hid->report_enum[k].report_list, list) { 834 836 835 837 if (!report->maxfield)
+5
drivers/usb/input/hid-core.c
··· 792 792 #define USB_VENDOR_ID_IMATION 0x0718 793 793 #define USB_DEVICE_ID_DISC_STAKKA 0xd000 794 794 795 + #define USB_VENDOR_ID_PANTHERLORD 0x0810 796 + #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 797 + 795 798 /* 796 799 * Alphabetically sorted blacklist by quirk type. 797 800 */ ··· 971 968 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 972 969 973 970 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, 971 + 972 + { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 974 973 975 974 { 0, 0 } 976 975 };
+1
include/linux/hid.h
··· 264 264 #define HID_QUIRK_INVERT_HWHEEL 0x00004000 265 265 #define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000 266 266 #define HID_QUIRK_BAD_RELATIVE_KEYS 0x00010000 267 + #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000 267 268 268 269 /* 269 270 * This is the global environment of the parser. This information is