Skip to content

Commit bbca80b

Browse files
Guus SliepenJiri Kosina
authored andcommitted
HID: corsair: Add support for the GLAIVE RGB gaming mouse
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 183b636 commit bbca80b

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

drivers/hid/hid-corsair.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,15 +673,16 @@ static int corsair_input_mapping(struct hid_device *dev,
673673
}
674674

675675
/*
676-
* The report descriptor of Corsair Scimitar RGB Pro gaming mouse is
676+
* The report descriptor of some of the Corsair gaming mice is
677677
* non parseable as they define two consecutive Logical Minimum for
678678
* the Usage Page (Consumer) in rdescs bytes 75 and 77 being 77 0x16
679679
* that should be obviousy 0x26 for Logical Magimum of 16 bits. This
680680
* prevents poper parsing of the report descriptor due Logical
681681
* Minimum being larger than Logical Maximum.
682682
*
683683
* This driver fixes the report descriptor for:
684-
* - USB ID b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
684+
* - USB ID 1b1c:1b34, sold as GLAIVE RGB Gaming mouse
685+
* - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
685686
*/
686687

687688
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,
691692

692693
if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
693694
/*
694-
* Corsair Scimitar RGB Pro report descriptor is broken and
695-
* defines two different Logical Minimum for the Consumer
696-
* Application. The byte 77 should be a 0x26 defining a 16
697-
* bits integer for the Logical Maximum but it is a 0x16
695+
* Corsair GLAIVE RGB and Scimitar RGB Pro report descriptor is
696+
* broken and defines two different Logical Minimum for the
697+
* Consumer Application. The byte 77 should be a 0x26 defining
698+
* a 16 bits integer for the Logical Maximum but it is a 0x16
698699
* instead (Logical Minimum)
699700
*/
700701
switch (hdev->product) {
702+
case USB_DEVICE_ID_CORSAIR_GLAIVE_RGB:
701703
case USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB:
702704
if (*rsize >= 172 && rdesc[75] == 0x15 && rdesc[77] == 0x16
703705
&& rdesc[78] == 0xff && rdesc[79] == 0x0f) {
@@ -715,6 +717,8 @@ static const struct hid_device_id corsair_devices[] = {
715717
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90),
716718
.driver_data = CORSAIR_USE_K90_MACRO |
717719
CORSAIR_USE_K90_BACKLIGHT },
720+
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
721+
USB_DEVICE_ID_CORSAIR_GLAIVE_RGB) },
718722
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
719723
USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
720724
{}

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@
291291
#define USB_DEVICE_ID_CORSAIR_K70RGB 0x1b13
292292
#define USB_DEVICE_ID_CORSAIR_STRAFE 0x1b15
293293
#define USB_DEVICE_ID_CORSAIR_K65RGB 0x1b17
294+
#define USB_DEVICE_ID_CORSAIR_GLAIVE_RGB 0x1b34
294295
#define USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE 0x1b38
295296
#define USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE 0x1b39
296297
#define USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB 0x1b3e

drivers/hid/hid-quirks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static const struct hid_device_id hid_quirks[] = {
6262
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70R), HID_QUIRK_NO_INIT_REPORTS },
6363
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K95RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
6464
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_M65RGB), HID_QUIRK_NO_INIT_REPORTS },
65+
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_GLAIVE_RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
6566
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
6667
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_STRAFE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
6768
{ 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[] = {
317318
#endif
318319
#if IS_ENABLED(CONFIG_HID_CORSAIR)
319320
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) },
321+
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_GLAIVE_RGB) },
320322
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
321323
#endif
322324
#if IS_ENABLED(CONFIG_HID_CP2112)

0 commit comments

Comments
 (0)