HID: uclogic: Add support for XP-Pen Deco 01
authorNikolai Kondrashov <spbnick@gmail.com>
Sun, 10 Feb 2019 10:14:02 +0000 (12:14 +0200)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 21 Feb 2019 11:00:54 +0000 (12:00 +0100)
Add support for XP-Pen Deco 01 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/hid-ids.h
drivers/hid/hid-uclogic-core.c
drivers/hid/hid-uclogic-params.c
drivers/hid/hid-uclogic-rdesc.c
drivers/hid/hid-uclogic-rdesc.h

index cadc8d4..b38be58 100644 (file)
 #define USB_VENDOR_ID_UGEE             0x28bd
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540   0x0075
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640   0x0094
+#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01 0x0042
 #define USB_DEVICE_ID_UGEE_TABLET_EX07S                0x0071
 
 #define USB_VENDOR_ID_UNITEC   0x227d
index 5fdd891..e4324ad 100644 (file)
@@ -350,6 +350,8 @@ static const struct hid_device_id uclogic_devices[] = {
                                USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540) },
        { HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
                                USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
+                               USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, uclogic_devices);
index 709eeb1..9b0fc4d 100644 (file)
@@ -1019,6 +1019,29 @@ int uclogic_params_init(struct uclogic_params *params,
                }
                break;
        case VID_PID(USB_VENDOR_ID_UGEE,
+                    USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01):
+               /* If this is the pen and frame interface */
+               if (bInterfaceNumber == 1) {
+                       /* Probe v1 pen parameters */
+                       rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev);
+                       if (rc != 0) {
+                               hid_err(hdev, "pen probing failed: %d\n", rc);
+                               goto cleanup;
+                       }
+                       /* Initialize frame parameters */
+                       rc = uclogic_params_frame_init_with_desc(
+                               &p.frame,
+                               uclogic_rdesc_xppen_deco01_frame_arr,
+                               uclogic_rdesc_xppen_deco01_frame_size,
+                               0);
+                       if (rc != 0)
+                               goto cleanup;
+               } else {
+                       /* TODO: Consider marking the interface invalid */
+                       uclogic_params_init_with_pen_unused(&p);
+               }
+               break;
+       case VID_PID(USB_VENDOR_ID_UGEE,
                     USB_DEVICE_ID_UGEE_TABLET_EX07S):
                /* Ignore non-pen interfaces */
                if (bInterfaceNumber != 1) {
index 2ab8747..7399658 100644 (file)
@@ -728,6 +728,41 @@ const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = {
 const size_t uclogic_rdesc_ugee_ex07_buttonpad_size =
                        sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr);
 
+/* Fixed report descriptor for XP-Pen Deco 01 frame controls */
+const __u8 uclogic_rdesc_xppen_deco01_frame_arr[] = {
+       0x05, 0x01, /*  Usage Page (Desktop),               */
+       0x09, 0x07, /*  Usage (Keypad),                     */
+       0xA1, 0x01, /*  Collection (Application),           */
+       0x85, 0x06, /*      Report ID (6),                  */
+       0x14,       /*      Logical Minimum (0),            */
+       0x25, 0x01, /*      Logical Maximum (1),            */
+       0x75, 0x01, /*      Report Size (1),                */
+       0x05, 0x0D, /*      Usage Page (Digitizer),         */
+       0x09, 0x39, /*      Usage (Tablet Function Keys),   */
+       0xA0,       /*      Collection (Physical),          */
+       0x05, 0x09, /*          Usage Page (Button),        */
+       0x19, 0x01, /*          Usage Minimum (01h),        */
+       0x29, 0x08, /*          Usage Maximum (08h),        */
+       0x95, 0x08, /*          Report Count (8),           */
+       0x81, 0x02, /*          Input (Variable),           */
+       0x05, 0x0D, /*          Usage Page (Digitizer),     */
+       0x09, 0x44, /*          Usage (Barrel Switch),      */
+       0x95, 0x01, /*          Report Count (1),           */
+       0x81, 0x02, /*          Input (Variable),           */
+       0x05, 0x01, /*          Usage Page (Desktop),       */
+       0x09, 0x30, /*          Usage (X),                  */
+       0x09, 0x31, /*          Usage (Y),                  */
+       0x95, 0x02, /*          Report Count (2),           */
+       0x81, 0x02, /*          Input (Variable),           */
+       0x95, 0x15, /*          Report Count (21),          */
+       0x81, 0x01, /*          Input (Constant),           */
+       0xC0,       /*      End Collection,                 */
+       0xC0        /*  End Collection                      */
+};
+
+const size_t uclogic_rdesc_xppen_deco01_frame_size =
+                       sizeof(uclogic_rdesc_xppen_deco01_frame_arr);
+
 /**
  * uclogic_rdesc_template_apply() - apply report descriptor parameters to a
  * report descriptor template, creating a report descriptor. Copies the
index 3cb6e17..0c5bd02 100644 (file)
@@ -135,4 +135,8 @@ extern const size_t uclogic_rdesc_buttonpad_v2_size;
 extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[];
 extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size;
 
+/* Fixed report descriptor for XP-Pen Deco 01 frame controls */
+extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[];
+extern const size_t uclogic_rdesc_xppen_deco01_frame_size;
+
 #endif /* _HID_UCLOGIC_RDESC_H */