HID: uclogic: Add support for Ugee EX07S frame controls
authorNikolai Kondrashov <spbnick@gmail.com>
Sun, 10 Feb 2019 10:13:59 +0000 (12:13 +0200)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 21 Feb 2019 11:00:54 +0000 (12:00 +0100)
Add proper support for Ugee EX07(S) frame controls to hid-uclogic.

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

index 72a073a..b22815c 100644 (file)
@@ -997,8 +997,6 @@ int uclogic_params_init(struct uclogic_params *params,
                break;
        case VID_PID(USB_VENDOR_ID_UGTIZER,
                     USB_DEVICE_ID_UGTIZER_TABLET_GP0610):
-       case VID_PID(USB_VENDOR_ID_UGEE,
-                    USB_DEVICE_ID_UGEE_TABLET_EX07S):
                /* If this is the pen interface */
                if (bInterfaceNumber == 1) {
                        /* Probe v1 pen parameters */
@@ -1016,6 +1014,36 @@ int uclogic_params_init(struct uclogic_params *params,
                        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) {
+                       uclogic_params_init_invalid(&p);
+                       break;
+               }
+
+               rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev);
+               if (rc != 0) {
+                       hid_err(hdev, "pen probing failed: %d\n", rc);
+                       goto cleanup;
+               } else if (found) {
+                       rc = uclogic_params_frame_init_with_desc(
+                               &p.frame,
+                               uclogic_rdesc_ugee_ex07_buttonpad_arr,
+                               uclogic_rdesc_ugee_ex07_buttonpad_size,
+                               0);
+                       if (rc != 0) {
+                               hid_err(hdev,
+                                       "failed creating buttonpad parameters: %d\n",
+                                       rc);
+                               goto cleanup;
+                       }
+               } else {
+                       hid_warn(hdev, "pen parameters not found");
+                       uclogic_params_init_invalid(&p);
+               }
+
+               break;
        }
 
 #undef VID_PID
index ef1d3cf..2ab8747 100644 (file)
@@ -701,6 +701,33 @@ const __u8 uclogic_rdesc_buttonpad_v2_arr[] = {
 const size_t uclogic_rdesc_buttonpad_v2_size =
                        sizeof(uclogic_rdesc_buttonpad_v2_arr);
 
+/* Fixed report descriptor for Ugee EX07 buttonpad */
+const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = {
+       0x05, 0x01,             /*  Usage Page (Desktop),                   */
+       0x09, 0x07,             /*  Usage (Keypad),                         */
+       0xA1, 0x01,             /*  Collection (Application),               */
+       0x85, 0x06,             /*      Report ID (6),                      */
+       0x05, 0x0D,             /*      Usage Page (Digitizer),             */
+       0x09, 0x39,             /*      Usage (Tablet Function Keys),       */
+       0xA0,                   /*      Collection (Physical),              */
+       0x05, 0x09,             /*          Usage Page (Button),            */
+       0x75, 0x01,             /*          Report Size (1),                */
+       0x19, 0x03,             /*          Usage Minimum (03h),            */
+       0x29, 0x06,             /*          Usage Maximum (06h),            */
+       0x95, 0x04,             /*          Report Count (4),               */
+       0x81, 0x02,             /*          Input (Variable),               */
+       0x95, 0x1A,             /*          Report Count (26),              */
+       0x81, 0x03,             /*          Input (Constant, Variable),     */
+       0x19, 0x01,             /*          Usage Minimum (01h),            */
+       0x29, 0x02,             /*          Usage Maximum (02h),            */
+       0x95, 0x02,             /*          Report Count (2),               */
+       0x81, 0x02,             /*          Input (Variable),               */
+       0xC0,                   /*      End Collection,                     */
+       0xC0                    /*  End Collection                          */
+};
+const size_t uclogic_rdesc_ugee_ex07_buttonpad_size =
+                       sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr);
+
 /**
  * uclogic_rdesc_template_apply() - apply report descriptor parameters to a
  * report descriptor template, creating a report descriptor. Copies the
index cc5f3dd..3cb6e17 100644 (file)
@@ -131,4 +131,8 @@ extern const size_t uclogic_rdesc_buttonpad_v2_size;
 /* Report ID for tweaked v2 buttonpad reports */
 #define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7
 
+/* Fixed report descriptor for Ugee EX07 buttonpad */
+extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[];
+extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size;
+
 #endif /* _HID_UCLOGIC_RDESC_H */