HID: logitech-dj: add support for 27 MHz mouse-only receivers
authorHans de Goede <hdegoede@redhat.com>
Sat, 20 Apr 2019 11:21:57 +0000 (13:21 +0200)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 23 Apr 2019 16:01:33 +0000 (18:01 +0200)
27 MHz mouse-only receivers send an unnumbered input report with the mouse
data, add special handling for this and add the c51b product-id to the
logi_dj_receivers table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/hid-ids.h
drivers/hid/hid-logitech-dj.c

index bd2dcd7574849169249d7d3217df3f21f913bd75..621384f8b9ee5ee03563186bc4147ffeeae38028 100644 (file)
 #define USB_DEVICE_ID_S510_RECEIVER_2  0xc517
 #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500  0xc512
 #define USB_DEVICE_ID_MX3000_RECEIVER  0xc513
+#define USB_DEVICE_ID_LOGITECH_27MHZ_MOUSE_RECEIVER    0xc51b
 #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER       0xc52b
 #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER           0xc52f
 #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2     0xc532
index 3004ca91b76b3696dde68f72fb6ec36f8ea3c413..08662b97b2cb05be1ce4d1db74275363bf68822b 100644 (file)
@@ -1483,6 +1483,16 @@ static int logi_dj_raw_event(struct hid_device *hdev,
                        data[0] = data[1];
                        data[1] = 0;
                }
+               /* The 27 MHz mouse-only receiver sends unnumbered mouse data */
+               if (djrcv_dev->unnumbered_application == HID_GD_MOUSE &&
+                   size == 6) {
+                       u8 mouse_report[7];
+
+                       /* Prepend report id */
+                       mouse_report[0] = REPORT_TYPE_MOUSE;
+                       memcpy(mouse_report + 1, data, 6);
+                       logi_dj_recv_forward_input_report(hdev, mouse_report, 7);
+               }
 
                return false;
        }
@@ -1720,6 +1730,10 @@ static const struct hid_device_id logi_dj_receivers[] = {
          HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
                USB_DEVICE_ID_S510_RECEIVER_2),
         .driver_data = recvr_type_27mhz},
+       { /* Logitech 27 MHz HID++ 1.0 mouse-only receiver (0xc51b) */
+         HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
+               USB_DEVICE_ID_LOGITECH_27MHZ_MOUSE_RECEIVER),
+        .driver_data = recvr_type_27mhz},
        {}
 };