]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
HID: waltop: Add support for Waltop Q Pad
authorNikolai Kondrashov <spbnick@gmail.com>
Mon, 6 Feb 2012 20:54:20 +0000 (22:54 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 7 Feb 2012 12:51:53 +0000 (13:51 +0100)
Add support for Waltop Q Pad by fixing its report descriptor.

This tablet is also sold as Aiptek HyperPen Mini. Other possible names
include: NGS Flexi Style, VisTablet PenPad, iVistaTablet Q Flex Pad, Bravod
Q-PD65-S.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-waltop.c

index 23fa03176ace8f8d09918acb8064cc0931d1624b..162be0955df07f2b25932cc788a597de177d5b2d 100644 (file)
@@ -1558,6 +1558,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) },
index 5f63e361be136843e16c3e560f0beb2e22d968a4..1a002201516e1155bcfef1c34d6104462047aa3a 100644 (file)
 #define USB_VENDOR_ID_WALTOP                           0x172f
 #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH      0x0032
 #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH     0x0034
+#define USB_DEVICE_ID_WALTOP_Q_PAD                     0x0037
 #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH    0x0501
 #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH    0x0500
 
index b3a4163f2e67c1211a5b8cf7f6221cbad425493a..0ec169646ec7f75f049f891b1e8244cddb1f62a7 100644 (file)
@@ -423,6 +423,190 @@ static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
        0xC0                /*  End Collection                      */
 };
 
+/*
+ * Original Q Pad report descriptor.
+ *
+ * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the
+ * addition of consumer AC Pan field to the report ID 1, which seems to be
+ * unused in the default mode. However, this tablet has resolution of 2048 LPI.
+ *
+ *  Usage Page (Desktop),           ; Generic desktop controls (01h)
+ *  Usage (Mouse),                  ; Mouse (02h, application collection)
+ *  Collection (Application),
+ *    Report ID (1),
+ *    Usage (Pointer),              ; Pointer (01h, physical collection)
+ *    Collection (Physical),
+ *      Usage Page (Button),        ; Button (09h)
+ *      Usage Minimum (01h),
+ *      Usage Maximum (05h),
+ *      Logical Minimum (0),
+ *      Logical Maximum (1),
+ *      Report Size (1),
+ *      Report Count (5),
+ *      Input (Variable),
+ *      Report Size (3),
+ *      Report Count (1),
+ *      Input (Constant, Variable),
+ *      Usage Page (Desktop),       ; Generic desktop controls (01h)
+ *      Usage (X),                  ; X (30h, dynamic value)
+ *      Usage (Y),                  ; Y (31h, dynamic value)
+ *      Usage (Wheel),              ; Wheel (38h, dynamic value)
+ *      Logical Minimum (-127),
+ *      Logical Maximum (127),
+ *      Report Size (8),
+ *      Report Count (3),
+ *      Input (Variable, Relative),
+ *      Usage Page (Consumer),      ; Consumer (0Ch)
+ *      Logical Minimum (-127),
+ *      Logical Maximum (127),
+ *      Report Size (8),
+ *      Report Count (1),
+ *      Usage (AC Pan),             ; AC pan (0238h, linear control)
+ *      Input (Variable, Relative),
+ *    End Collection,
+ *  End Collection,
+ *  Usage Page (Digitizer),         ; Digitizer (0Dh)
+ *  Usage (Pen),                    ; Pen (02h, application collection)
+ *  Collection (Application),
+ *    Report ID (2),
+ *    Usage (Stylus),               ; Stylus (20h, logical collection)
+ *    Collection (Physical),
+ *      Usage (00h),
+ *      Logical Minimum (0),
+ *      Logical Maximum (255),
+ *      Report Size (8),
+ *      Report Count (7),
+ *      Input (Variable),
+ *      Usage (Azimuth),            ; Azimuth (3Fh, dynamic value)
+ *      Usage (Altitude),           ; Altitude (40h, dynamic value)
+ *      Logical Minimum (0),
+ *      Logical Maximum (255),
+ *      Report Size (8),
+ *      Report Count (2),
+ *      Feature (Variable),
+ *    End Collection,
+ *    Report ID (5),
+ *    Usage Page (Digitizer),       ; Digitizer (0Dh)
+ *    Usage (Stylus),               ; Stylus (20h, logical collection)
+ *    Collection (Physical),
+ *      Usage (00h),
+ *      Logical Minimum (0),
+ *      Logical Maximum (255),
+ *      Report Size (8),
+ *      Report Count (7),
+ *      Input (Variable),
+ *    End Collection,
+ *    Report ID (10),
+ *    Usage Page (Digitizer),       ; Digitizer (0Dh)
+ *    Usage (Stylus),               ; Stylus (20h, logical collection)
+ *    Collection (Physical),
+ *      Usage (00h),
+ *      Logical Minimum (0),
+ *      Logical Maximum (255),
+ *      Report Size (8),
+ *      Report Count (7),
+ *      Input (Variable),
+ *    End Collection,
+ *    Report ID (16),
+ *    Usage (Stylus),               ; Stylus (20h, logical collection)
+ *    Collection (Physical),
+ *      Usage (Tip Switch),         ; Tip switch (42h, momentary control)
+ *      Usage (Barrel Switch),      ; Barrel switch (44h, momentary control)
+ *      Usage (Invert),             ; Invert (3Ch, momentary control)
+ *      Usage (Eraser),             ; Eraser (45h, momentary control)
+ *      Usage (In Range),           ; In range (32h, momentary control)
+ *      Logical Minimum (0),
+ *      Logical Maximum (1),
+ *      Report Size (1),
+ *      Report Count (5),
+ *      Input (Variable),
+ *      Report Count (3),
+ *      Input (Constant, Variable),
+ *      Usage Page (Desktop),       ; Generic desktop controls (01h)
+ *      Usage (X),                  ; X (30h, dynamic value)
+ *      Report Size (16),
+ *      Report Count (1),
+ *      Push,
+ *      Unit Exponent (13),
+ *      Unit (Inch^3),
+ *      Logical Minimum (0),
+ *      Logical Maximum (12288),
+ *      Physical Minimum (0),
+ *      Physical Maximum (12288),
+ *      Input (Variable),
+ *      Usage (Y),                  ; Y (31h, dynamic value)
+ *      Logical Minimum (0),
+ *      Logical Maximum (9216),
+ *      Physical Minimum (0),
+ *      Physical Maximum (9216),
+ *      Input (Variable),
+ *      Usage Page (Digitizer),     ; Digitizer (0Dh)
+ *      Usage (Tip Pressure),       ; Tip pressure (30h, dynamic value)
+ *      Logical Minimum (0),
+ *      Logical Maximum (1023),
+ *      Physical Minimum (0),
+ *      Physical Maximum (1023),
+ *      Input (Variable),
+ *    End Collection,
+ *  End Collection
+ */
+
+/* Size of the original report descriptor of Q Pad */
+#define Q_PAD_RDESC_ORIG_SIZE  241
+
+/*
+ * Fixed Q Pad descriptor.
+ *
+ * All the reports except the stylus report (ID 16) were removed as unused.
+ * The stylus buttons description was fixed.
+ */
+static __u8 q_pad_rdesc_fixed[] = {
+       0x05, 0x0D,         /*  Usage Page (Digitizer),             */
+       0x09, 0x02,         /*  Usage (Pen),                        */
+       0xA1, 0x01,         /*  Collection (Application),           */
+       0x85, 0x10,         /*      Report ID (16),                 */
+       0x09, 0x20,         /*      Usage (Stylus),                 */
+       0xA0,               /*      Collection (Physical),          */
+       0x09, 0x42,         /*          Usage (Tip Switch),         */
+       0x09, 0x44,         /*          Usage (Barrel Switch),      */
+       0x09, 0x46,         /*          Usage (Tablet Pick),        */
+       0x15, 0x01,         /*          Logical Minimum (1),        */
+       0x25, 0x03,         /*          Logical Maximum (3),        */
+       0x75, 0x04,         /*          Report Size (4),            */
+       0x95, 0x01,         /*          Report Count (1),           */
+       0x80,               /*          Input,                      */
+       0x09, 0x32,         /*          Usage (In Range),           */
+       0x14,               /*          Logical Minimum (0),        */
+       0x25, 0x01,         /*          Logical Maximum (1),        */
+       0x75, 0x01,         /*          Report Size (1),            */
+       0x95, 0x01,         /*          Report Count (1),           */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0x95, 0x03,         /*          Report Count (3),           */
+       0x81, 0x03,         /*          Input (Constant, Variable), */
+       0x75, 0x10,         /*          Report Size (16),           */
+       0x95, 0x01,         /*          Report Count (1),           */
+       0x14,               /*          Logical Minimum (0),        */
+       0xA4,               /*          Push,                       */
+       0x05, 0x01,         /*          Usage Page (Desktop),       */
+       0x65, 0x13,         /*          Unit (Inch),                */
+       0x55, 0xFD,         /*          Unit Exponent (-3),         */
+       0x34,               /*          Physical Minimum (0),       */
+       0x09, 0x30,         /*          Usage (X),                  */
+       0x46, 0x70, 0x17,   /*          Physical Maximum (6000),    */
+       0x26, 0x00, 0x30,   /*          Logical Maximum (12288),    */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0x09, 0x31,         /*          Usage (Y),                  */
+       0x46, 0x94, 0x11,   /*          Physical Maximum (4500),    */
+       0x26, 0x00, 0x24,   /*          Logical Maximum (9216),     */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0xB4,               /*          Pop,                        */
+       0x09, 0x30,         /*          Usage (Tip Pressure),       */
+       0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0xC0,               /*      End Collection,                 */
+       0xC0                /*  End Collection                      */
+};
+
 /*
  * Original Media Tablet 10.6 inch report descriptor.
  *
@@ -1049,6 +1233,12 @@ static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                        *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
                }
                break;
+       case USB_DEVICE_ID_WALTOP_Q_PAD:
+               if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
+                       rdesc = q_pad_rdesc_fixed;
+                       *rsize = sizeof(q_pad_rdesc_fixed);
+               }
+               break;
        case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
                if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
                        rdesc = media_tablet_10_6_inch_rdesc_fixed;
@@ -1070,6 +1260,8 @@ static const struct hid_device_id waltop_devices[] = {
                                USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
                                USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
+                               USB_DEVICE_ID_WALTOP_Q_PAD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
                                USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,