HID: elecom: add support for EX-G M-XGL20DLBK wireless mouse
authorYOSHIOKA Takuma <lo48576@hard-wi.red>
Sat, 21 Nov 2020 20:54:38 +0000 (05:54 +0900)
committerJiri Kosina <jkosina@suse.cz>
Wed, 25 Nov 2020 13:27:45 +0000 (14:27 +0100)
Enables three buttons (Fn1, Fn2, and Fn3) on the ELECOM M-XGL20DLBK
wireless mouse.

While this mouse is EX-G brand, report descriptor is a bit different
from EX-G trackball mouse. To enable extra buttons, report should be
rewritten in a similar way to trackballs, but with different position
parameters.

Signed-off-by: YOSHIOKA Takuma <lo48576@hard-wi.red>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-elecom.c
drivers/hid/hid-ids.h
drivers/hid/hid-quirks.c

index 23318810088423a5c2fe0cd12027d1328c7b90a1..3bd7207de2e8501447ca47bd8a71de41b03ec8e4 100644 (file)
@@ -64,6 +64,16 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                        rdesc[47] = 0x00;
                }
                break;
+       case USB_DEVICE_ID_ELECOM_M_XGL20DLBK:
+               /*
+                * Report descriptor format:
+                * 20: button bit count
+                * 28: padding bit count
+                * 22: button report size
+                * 14: button usage maximum
+                */
+               mouse_button_fixup(hdev, rdesc, *rsize, 20, 28, 22, 14, 8);
+               break;
        case USB_DEVICE_ID_ELECOM_M_XT3URBK:
        case USB_DEVICE_ID_ELECOM_M_XT3DRBK:
        case USB_DEVICE_ID_ELECOM_M_XT4DRBK:
@@ -96,6 +106,7 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 
 static const struct hid_device_id elecom_devices[] = {
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) },
index f170feaac40baea80173f96c939f13a75843d78e..7fcbd3c02458be421bbff934d7bb86a6a2c61f21 100644 (file)
 
 #define USB_VENDOR_ID_ELECOM           0x056e
 #define USB_DEVICE_ID_ELECOM_BM084     0x0061
+#define USB_DEVICE_ID_ELECOM_M_XGL20DLBK       0x00e6
 #define USB_DEVICE_ID_ELECOM_M_XT3URBK 0x00fb
 #define USB_DEVICE_ID_ELECOM_M_XT3DRBK 0x00fc
 #define USB_DEVICE_ID_ELECOM_M_XT4DRBK 0x00fd
index bf7ecab5d9e5ed2db8488cf2329456eaed46b0c7..c94e44d6e652f3655049825856edc4d8c8c0c60b 100644 (file)
@@ -366,6 +366,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 #endif
 #if IS_ENABLED(CONFIG_HID_ELECOM)
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) },