From patchwork Sat Feb 10 17:12:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guus Sliepen X-Patchwork-Id: 10210545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FFAF60247 for ; Sat, 10 Feb 2018 17:19:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 303CE28852 for ; Sat, 10 Feb 2018 17:19:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FCD6296F9; Sat, 10 Feb 2018 17:19:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 029E328852 for ; Sat, 10 Feb 2018 17:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750909AbeBJRTR (ORCPT ); Sat, 10 Feb 2018 12:19:17 -0500 Received: from arianus.sliepen.org ([92.243.30.131]:38096 "EHLO arianus.sliepen.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750857AbeBJRTQ (ORCPT ); Sat, 10 Feb 2018 12:19:16 -0500 X-Greylist: delayed 385 seconds by postgrey-1.27 at vger.kernel.org; Sat, 10 Feb 2018 12:19:15 EST Received: from sliepen.org (unknown [IPv6:fec0::1:204:76ff:fe14:6e86]) by arianus.sliepen.org (Postfix) with ESMTP id 33CC641863; Sat, 10 Feb 2018 18:12:49 +0100 (CET) Received: by sliepen.org (Postfix, from userid 1000) id F0D6E220509; Sat, 10 Feb 2018 18:12:48 +0100 (CET) From: Guus Sliepen To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, jikos@kernel.org Cc: Guus Sliepen Subject: [PATCH] HID: corsair: Add support for the GLAIVE RGB gaming mouse Date: Sat, 10 Feb 2018 18:12:12 +0100 Message-Id: <20180210171212.7988-1-guus@sliepen.org> X-Mailer: git-send-email 2.11.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This mouse sold by Corsair as the GLAIVE RGB gaming mouse has the same problem with its HID reports as the Scimitar PRO RGB, so reuse the same fix for the GLAIVE RGB. Signed-off-by: Guus Sliepen --- drivers/hid/hid-corsair.c | 16 ++++++++++------ drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c index 9ba5d98a1..6c9c8fe1b 100644 --- a/drivers/hid/hid-corsair.c +++ b/drivers/hid/hid-corsair.c @@ -673,7 +673,7 @@ static int corsair_input_mapping(struct hid_device *dev, } /* - * The report descriptor of Corsair Scimitar RGB Pro gaming mouse is + * The report descriptor of some of the Corsair gaming mice is * non parseable as they define two consecutive Logical Minimum for * the Usage Page (Consumer) in rdescs bytes 75 and 77 being 77 0x16 * that should be obviousy 0x26 for Logical Magimum of 16 bits. This @@ -681,7 +681,8 @@ static int corsair_input_mapping(struct hid_device *dev, * Minimum being larger than Logical Maximum. * * This driver fixes the report descriptor for: - * - USB ID b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse + * - USB ID 1b1c:1b34, sold as GLAIVE RGB Gaming mouse + * - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse */ static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, @@ -691,13 +692,14 @@ static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { /* - * Corsair Scimitar RGB Pro report descriptor is broken and - * defines two different Logical Minimum for the Consumer - * Application. The byte 77 should be a 0x26 defining a 16 - * bits integer for the Logical Maximum but it is a 0x16 + * Corsair GLAIVE RGB and Scimitar RGB Pro report descriptor is + * broken and defines two different Logical Minimum for the + * Consumer Application. The byte 77 should be a 0x26 defining + * a 16 bits integer for the Logical Maximum but it is a 0x16 * instead (Logical Minimum) */ switch (hdev->product) { + case USB_DEVICE_ID_CORSAIR_GLAIVE_RGB: case USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB: if (*rsize >= 172 && rdesc[75] == 0x15 && rdesc[77] == 0x16 && rdesc[78] == 0xff && rdesc[79] == 0x0f) { @@ -715,6 +717,8 @@ static const struct hid_device_id corsair_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90), .driver_data = CORSAIR_USE_K90_MACRO | CORSAIR_USE_K90_BACKLIGHT }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, + USB_DEVICE_ID_CORSAIR_GLAIVE_RGB) }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, {} diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 43ddcdfbd..a099e5194 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -291,6 +291,7 @@ #define USB_DEVICE_ID_CORSAIR_K70RGB 0x1b13 #define USB_DEVICE_ID_CORSAIR_STRAFE 0x1b15 #define USB_DEVICE_ID_CORSAIR_K65RGB 0x1b17 +#define USB_DEVICE_ID_CORSAIR_GLAIVE_RGB 0x1b34 #define USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE 0x1b38 #define USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE 0x1b39 #define USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB 0x1b3e diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 5f6035a5c..7203eba3c 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -62,6 +62,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70R), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K95RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_M65RGB), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_GLAIVE_RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_STRAFE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51), HID_QUIRK_NOGET }, @@ -317,6 +318,7 @@ static const struct hid_device_id hid_have_special_driver[] = { #endif #if IS_ENABLED(CONFIG_HID_CORSAIR) { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_GLAIVE_RGB) }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, #endif #if IS_ENABLED(CONFIG_HID_CP2112)