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 bd2dcd7..621384f 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 3004ca9..08662b9 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},
        {}
 };