From 21589ebda68172baeb03f35533ee2ec34543bf55 Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Sat, 27 Jun 2015 17:02:23 +0200 Subject: HID: sensor-hub: Add in quirk for Lenovo Yogas with ITE Like yogas with TEXAS_INSTRUMENTS, yogas with ITE chips needs to be initialized with enumeration quirks. Signed-off-by: Jiri Kosina --- drivers/hid/hid-ids.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..9a59810a0b21 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -497,6 +497,9 @@ #define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615 #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070 +#define USB_VENDOR_ID_ITE 0x048d +#define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386 + #define USB_VENDOR_ID_JABRA 0x0b0e #define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412 #define USB_DEVICE_ID_JABRA_SPEAK_510 0x0420 -- cgit v1.2.3-58-ga151 From 0439de75d32c249bd9f5824ffd5e40c4c2109d77 Mon Sep 17 00:00:00 2001 From: Stephen Just Date: Wed, 22 Jul 2015 20:11:40 -0700 Subject: HID: microsoft: Add Surface 3 type cover Adding support for the Microsoft Surface 3 (non-pro) Type Cover. The existing definitions and quirks are actually for the Surface Pro 3 type covers. I've renamed the old constants to reflect that they belong to the Surface Pro 3, and added a new constant and matching code for the Surface 3. Signed-off-by: Stephen Just Signed-off-by: Jiri Kosina --- drivers/hid/hid-core.c | 8 +++++--- drivers/hid/hid-ids.h | 5 +++-- drivers/hid/hid-microsoft.c | 6 ++++-- drivers/hid/usbhid/hid-quirks.c | 3 ++- 4 files changed, 14 insertions(+), 8 deletions(-) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 157c62775053..d9c7cd971a52 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -705,8 +705,9 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type) hid->group = HID_GROUP_SENSOR_HUB; if (hid->vendor == USB_VENDOR_ID_MICROSOFT && - (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || - hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP || + (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 || + hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP || + hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || hid->product == USB_DEVICE_ID_MS_POWER_COVER) && hid->group == HID_GROUP_MULTITOUCH) hid->group = HID_GROUP_GENERIC; @@ -1902,8 +1903,9 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..8dab4b2e9dfe 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -663,8 +663,9 @@ #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 -#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc -#define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd +#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 0x07dc +#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd +#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07de #define USB_DEVICE_ID_MS_POWER_COVER 0x07da #define USB_VENDOR_ID_MOJO 0x8282 diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 32a596f554af..9aa3515090a7 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c @@ -276,9 +276,11 @@ static const struct hid_device_id ms_devices[] = { .driver_data = MS_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), .driver_data = MS_DUPLICATE_USAGES }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3), + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3), + .driver_data = MS_HIDINPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP), .driver_data = MS_HIDINPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP), + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3), .driver_data = MS_HIDINPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), .driver_data = MS_HIDINPUT }, diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 53e7de7cb9e2..198e2665de44 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -87,8 +87,9 @@ static const struct hid_blacklist { { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, HID_QUIRK_NO_INIT_REPORTS }, + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, -- cgit v1.2.3-58-ga151 From 070f63b46ac893a5debf68c5751101b6f5f77230 Mon Sep 17 00:00:00 2001 From: Yang Bo Date: Mon, 20 Jul 2015 09:40:28 -0700 Subject: HID: multitouch: Add support for CJTouch MultiTouch Add device IDs for CJTouch 0020 and 0040 panels. Signed-off-by: Yang Bo Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 1 + drivers/hid/hid-ids.h | 4 ++++ drivers/hid/hid-multitouch.c | 8 ++++++++ 3 files changed, 13 insertions(+) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index cc4c6649d195..57c94d7d5834 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -480,6 +480,7 @@ config HID_MULTITOUCH - Atmel panels - Cando dual touch panels - Chunghwa panels + - CJTouch panels - CVTouch panels - Cypress TrueTouch panels - Elan Microelectronics touch panels diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..591b7d06f54d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -236,6 +236,10 @@ #define USB_VENDOR_ID_CIDC 0x1677 +#define USB_VENDOR_ID_CJTOUCH 0x24b8 +#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020 +#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040 0x0040 + #define USB_VENDOR_ID_CMEDIA 0x0d8c #define USB_DEVICE_ID_CM109 0x000e diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6a9b05b328a9..ab0434f86f49 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1138,6 +1138,14 @@ static const struct hid_device_id mt_devices[] = { MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, + /* CJTouch panels */ + { .driver_data = MT_CLS_NSMU, + MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, + USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020) }, + { .driver_data = MT_CLS_NSMU, + MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, + USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040) }, + /* CVTouch panels */ { .driver_data = MT_CLS_NSMU, MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, -- cgit v1.2.3-58-ga151 From c873d9aba7c9782b4dc74488ab964ed6cf54678f Mon Sep 17 00:00:00 2001 From: Simon Wood Date: Thu, 23 Jul 2015 19:10:03 -0600 Subject: HID: hid-lg: Add USBID for Logitech G29 Wheel Since this wheel is now available, and the USBID is listed on their website, this patch adds it to allow the hid-lg4ff force feedback driver to find it. I do not have this wheel to test with, but this should at least get it working in emulation mode. Note: There is probably more work required for adjust HID descriptor and handle switching between emulation and native modes. Signed-off-by: Simon Wood Signed-off-by: Jiri Kosina --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-lg.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..653bfd4b9490 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -599,6 +599,7 @@ #define USB_DEVICE_ID_LOGITECH_DUAL_ACTION 0xc216 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 +#define USB_DEVICE_ID_LOGITECH_G29_WHEEL 0xc24f #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287 diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 429340d809b5..5332fb7d072a 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c @@ -776,6 +776,8 @@ static const struct hid_device_id lg_devices[] = { .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), .driver_data = LG_FF }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL), + .driver_data = LG_FF4 }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D), .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO), -- cgit v1.2.3-58-ga151 From 9a1d78a3780e0e37eeff11b377fc5fbb01446a36 Mon Sep 17 00:00:00 2001 From: Николай Кудрявцев Date: Tue, 21 Jul 2015 13:31:52 +0300 Subject: HID: chicony: Add support for Acer Aspire Switch 12 Acer Aspire Switch 12 keyboard Chicony's controller reports too big usage index on the 1st interface. The patch fixes the report. The work based on solution from drivers/hid/hid-holtek-mouse.c Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=101721 Signed-off-by: Nicholas Kudriavtsev Signed-off-by: Jiri Kosina --- drivers/hid/hid-chicony.c | 26 ++++++++++++++++++++++++++ drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + 3 files changed, 28 insertions(+) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c index b613d5a79684..bc3cec199fee 100644 --- a/drivers/hid/hid-chicony.c +++ b/drivers/hid/hid-chicony.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "hid-ids.h" @@ -57,10 +58,34 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, return 1; } +static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { + /* Change usage maximum and logical maximum from 0x7fff to + * 0x2fff, so they don't exceed HID_MAX_USAGES */ + switch (hdev->product) { + case USB_DEVICE_ID_CHICONY_ACER_SWITCH12: + if (*rsize >= 128 && rdesc[64] == 0xff && rdesc[65] == 0x7f + && rdesc[69] == 0xff && rdesc[70] == 0x7f) { + hid_info(hdev, "Fixing up report descriptor\n"); + rdesc[65] = rdesc[70] = 0x2f; + } + break; + } + + } + return rdesc; +} + + static const struct hid_device_id ch_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, { } }; MODULE_DEVICE_TABLE(hid, ch_devices); @@ -68,6 +93,7 @@ MODULE_DEVICE_TABLE(hid, ch_devices); static struct hid_driver ch_driver = { .name = "chicony", .id_table = ch_devices, + .report_fixup = ch_switch12_report_fixup, .input_mapping = ch_input_mapping, }; module_hid_driver(ch_driver); diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 157c62775053..a77d30388b4d 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1804,6 +1804,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..7c712dff2ca1 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -230,6 +230,7 @@ #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053 #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 #define USB_DEVICE_ID_CHICONY_AK1D 0x1125 +#define USB_DEVICE_ID_CHICONY_ACER_SWITCH12 0x1421 #define USB_VENDOR_ID_CHUNGHWAT 0x2247 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 -- cgit v1.2.3-58-ga151 From 931830aa5c251e0803523213428f777a48bde254 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 13 Aug 2015 11:11:27 -0400 Subject: HID: gembird: add new driver to fix Gembird JPD-DualForce 2 This gamepad advertise 5 absolute axis while 4 are actually used. The second Z axis shows some garbage, so it has to be ignored by HID. The first Z axis and the Rz one are actually Rx and Ry. Remap them. We could also just remap and ignore the axis in .input_mapping(). I went ahead with .report_fixup() first, so here it is. Reported-by: Orivej Desh Tested-by: Orivej Desh Signed-off-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 6 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-gembird.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 3 ++ 5 files changed, 127 insertions(+) create mode 100644 drivers/hid/hid-gembird.c (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index cc4c6649d195..e48ee2ca9d22 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -251,6 +251,12 @@ config HID_EZKEY ---help--- Support for Ezkey BTC 8193 keyboard. +config HID_GEMBIRD + tristate "Gembird Joypad" + depends on HID + ---help--- + Support for Gembird JPD-DualForce 2. + config HID_HOLTEK tristate "Holtek HID devices" depends on USB_HID diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 2f8a41dc3cc8..e6441bc7dae4 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o +obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o obj-$(CONFIG_HID_GT683R) += hid-gt683r.o obj-$(CONFIG_HID_GYRATION) += hid-gyration.o obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index e6fce23b121a..7d5ed0b5c1c1 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1823,6 +1823,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, diff --git a/drivers/hid/hid-gembird.c b/drivers/hid/hid-gembird.c new file mode 100644 index 000000000000..e55e519f311e --- /dev/null +++ b/drivers/hid/hid-gembird.c @@ -0,0 +1,116 @@ +/* + * HID driver for Gembird Joypad, "PC Game Controller" + * + * Copyright (c) 2015 Red Hat, Inc + * Copyright (c) 2015 Benjamin Tissoires + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#include +#include +#include + +#include "hid-ids.h" + +#define GEMBIRD_START_FAULTY_RDESC 8 + +static const __u8 gembird_jpd_faulty_rdesc[] = { + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x05, /* Report Count (5) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x26, 0xff, 0x00, /* Logical Maximum (255) */ + 0x35, 0x00, /* Physical Minimum (0) */ + 0x46, 0xff, 0x00, /* Physical Maximum (255) */ + 0x09, 0x30, /* Usage (X) */ + 0x09, 0x31, /* Usage (Y) */ + 0x09, 0x32, /* Usage (Z) */ + 0x09, 0x32, /* Usage (Z) */ + 0x09, 0x35, /* Usage (Rz) */ + 0x81, 0x02, /* Input (Data,Var,Abs) */ +}; + +/* + * we fix the report descriptor by: + * - marking the first Z axis as constant (so it is ignored by HID) + * - assign the original second Z to Rx + * - assign the original Rz to Ry + */ +static const __u8 gembird_jpd_fixed_rdesc[] = { + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x02, /* Report Count (2) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x26, 0xff, 0x00, /* Logical Maximum (255) */ + 0x35, 0x00, /* Physical Minimum (0) */ + 0x46, 0xff, 0x00, /* Physical Maximum (255) */ + 0x09, 0x30, /* Usage (X) */ + 0x09, 0x31, /* Usage (Y) */ + 0x81, 0x02, /* Input (Data,Var,Abs) */ + 0x95, 0x01, /* Report Count (1) */ + 0x09, 0x32, /* Usage (Z) */ + 0x81, 0x01, /* Input (Cnst,Arr,Abs) */ + 0x95, 0x02, /* Report Count (2) */ + 0x09, 0x33, /* Usage (Rx) */ + 0x09, 0x34, /* Usage (Ry) */ + 0x81, 0x02, /* Input (Data,Var,Abs) */ +}; + +static __u8 *gembird_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + __u8 *new_rdesc; + /* delta_size is > 0 */ + size_t delta_size = sizeof(gembird_jpd_fixed_rdesc) - + sizeof(gembird_jpd_faulty_rdesc); + size_t new_size = *rsize + delta_size; + + if (*rsize >= 31 && !memcmp(&rdesc[GEMBIRD_START_FAULTY_RDESC], + gembird_jpd_faulty_rdesc, + sizeof(gembird_jpd_faulty_rdesc))) { + new_rdesc = devm_kzalloc(&hdev->dev, new_size, GFP_KERNEL); + if (new_rdesc == NULL) + return rdesc; + + dev_info(&hdev->dev, + "fixing Gembird JPD-DualForce 2 report descriptor.\n"); + + /* start by copying the end of the rdesc */ + memcpy(new_rdesc + delta_size, rdesc, *rsize); + + /* add the correct beginning */ + memcpy(new_rdesc, rdesc, GEMBIRD_START_FAULTY_RDESC); + + /* replace the faulty part with the fixed one */ + memcpy(new_rdesc + GEMBIRD_START_FAULTY_RDESC, + gembird_jpd_fixed_rdesc, + sizeof(gembird_jpd_fixed_rdesc)); + + *rsize = new_size; + rdesc = new_rdesc; + } + + return rdesc; +} + +static const struct hid_device_id gembird_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, + USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, + { } +}; +MODULE_DEVICE_TABLE(hid, gembird_devices); + +static struct hid_driver gembird_driver = { + .name = "gembird", + .id_table = gembird_devices, + .report_fixup = gembird_report_fixup, +}; +module_hid_driver(gembird_driver); + +MODULE_AUTHOR("Benjamin Tissoires "); +MODULE_DESCRIPTION("HID Gembird joypad driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b3b225b75d0a..b4d7a0843675 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -358,6 +358,9 @@ #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 +#define USB_VENDOR_ID_GEMBIRD 0x11ff +#define USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2 0x3331 + #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS 0x0100 -- cgit v1.2.3-58-ga151 From c9b57724b38d4c1555ee49418be3d76801e3327c Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 21 Aug 2015 10:18:08 -0400 Subject: HID: quirks: add QUIRK_NOGET for an other TPV touchscreen Looks like 0x8882 needs the same quirk than 0x8883. Given that both devices claim they are "TPV OpticalTouchScreen" rename the 0x8883 to add its PID in the #define. Reported-by: Blaine Lee Signed-off-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- drivers/hid/hid-ids.h | 3 ++- drivers/hid/usbhid/hid-quirks.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/hid/hid-ids.h') diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..0de3284a3e24 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -922,7 +922,8 @@ #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 #define USB_VENDOR_ID_TPV 0x25aa -#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN 0x8883 +#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 +#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 #define USB_VENDOR_ID_TURBOX 0x062a #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 53e7de7cb9e2..a983418114bb 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -114,7 +114,8 @@ static const struct hid_blacklist { { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883, HID_QUIRK_NOGET }, { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, -- cgit v1.2.3-58-ga151