test: add test devices for the Cintiq Pro 16
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 4 Jan 2019 02:35:22 +0000 (12:35 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 4 Jan 2019 03:53:37 +0000 (03:53 +0000)
Reconstructed from the HID descriptors here:
https://github.com/linuxwacom/wacom-hid-descriptors/tree/master/Wacom Cintiq Pro 16/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
meson.build
test/litest-device-wacom-cintiq-pro-16-finger.c [new file with mode: 0644]
test/litest-device-wacom-cintiq-pro-16-pad.c [new file with mode: 0644]
test/litest-device-wacom-cintiq-pro-16-pen.c [new file with mode: 0644]
test/litest.h
test/test-pad.c
test/test-tablet.c

index 9d918b82b19af2d33ddbc73f85a5c186e8df5185..4aad0ad967f779d9a4042b90d5db78fc1601d730 100644 (file)
@@ -740,6 +740,9 @@ if get_option('tests')
                'test/litest-device-wacom-cintiq-13hdt-pen.c',
                'test/litest-device-wacom-cintiq-24hd-pen.c',
                'test/litest-device-wacom-cintiq-24hdt-pad.c',
+               'test/litest-device-wacom-cintiq-pro-16-finger.c',
+               'test/litest-device-wacom-cintiq-pro-16-pad.c',
+               'test/litest-device-wacom-cintiq-pro-16-pen.c',
                'test/litest-device-wacom-ekr.c',
                'test/litest-device-wacom-hid4800-pen.c',
                'test/litest-device-wacom-intuos3-pad.c',
diff --git a/test/litest-device-wacom-cintiq-pro-16-finger.c b/test/litest-device-wacom-cintiq-pro-16-finger.c
new file mode 100644 (file)
index 0000000..e41a511
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "litest.h"
+#include "litest-int.h"
+
+static struct input_event down[] = {
+       { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 },
+       { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+       { .type = -1, .code = -1 },
+};
+
+static struct input_event move[] = {
+       { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+       { .type = -1, .code = -1 },
+};
+
+static struct litest_device_interface interface = {
+       .touch_down_events = down,
+       .touch_move_events = move,
+};
+
+static struct input_absinfo absinfo[] = {
+       { ABS_X, 0, 13824, 0, 0, 40 },
+       { ABS_Y, 0, 7776, 0, 0, 40 },
+       { ABS_MT_SLOT, 0, 15, 0, 0, 0 },
+       { ABS_MT_TOUCH_MAJOR, 0, 40, 0, 0, 0 },
+       { ABS_MT_TOUCH_MINOR, 0, 40, 0, 0, 0 },
+       { ABS_MT_ORIENTATION, 0, 1, 0, 0, 0 },
+       { ABS_MT_POSITION_X, 0, 13824, 0, 0, 40 },
+       { ABS_MT_POSITION_Y, 0, 7776, 0, 0, 40 },
+       { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
+       { ABS_MISC, 0, 0, 0, 0, 0 },
+       { .value = -1 },
+};
+
+static struct input_id input_id = {
+       .bustype = 0x3,
+       .vendor = 0x56a,
+       .product = 0x354,
+       .version = 0xb,
+};
+
+static int events[] = {
+       EV_KEY, BTN_TOUCH,
+       INPUT_PROP_MAX, INPUT_PROP_DIRECT,
+       -1, -1,
+};
+
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"rule_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"rule_end\"\n"
+"\n"
+"ATTRS{name}==\"litest Wacom Cintiq Pro 16 Finger*\",\\\n"
+"    ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-pro16-group\"\n"
+"\n"
+"LABEL=\"rule_end\"";
+
+TEST_DEVICE("wacom-cintiq-pro16-finger",
+       .type = LITEST_WACOM_CINTIQ_PRO16_FINGER,
+       .features = LITEST_TOUCH,
+       .interface = &interface,
+
+       .name = "Wacom Cintiq Pro 16 Finger",
+       .id = &input_id,
+       .events = events,
+       .absinfo = absinfo,
+       .udev_rule = udev_rule,
+)
diff --git a/test/litest-device-wacom-cintiq-pro-16-pad.c b/test/litest-device-wacom-cintiq-pro-16-pad.c
new file mode 100644 (file)
index 0000000..c2283fb
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "litest.h"
+#include "litest-int.h"
+
+static struct input_event down[] = {
+       { .type = -1, .code = -1 },
+};
+
+static struct input_event move[] = {
+       { .type = -1, .code = -1 },
+};
+
+static struct litest_device_interface interface = {
+       .touch_down_events = down,
+       .touch_move_events = move,
+};
+static struct input_absinfo absinfo[] = {
+       { ABS_X, 0, 1, 0, 0, 0 },
+       { ABS_Y, 0, 1, 0, 0, 0 },
+       { ABS_MISC, 0, 0, 0, 0, 0 },
+       { .value = -1 },
+};
+
+static struct input_id input_id = {
+       .bustype = 0x3,
+       .vendor = 0x56a,
+       .product = 0x350,
+       .version = 0xb,
+};
+
+static int events[] = {
+       EV_KEY, BTN_STYLUS,
+       EV_KEY, KEY_BUTTONCONFIG,
+       EV_KEY, KEY_CONTROLPANEL,
+       EV_KEY, KEY_ONSCREEN_KEYBOARD,
+       -1, -1,
+};
+
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"pad_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"pad_end\"\n"
+"\n"
+"ATTRS{name}==\"litest Wacom Cintiq Pro 16 Pad*\",\\\n"
+"    ENV{ID_INPUT_TABLET_PAD}=\"1\",\\\n"
+"    ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-pro16-group\"\n"
+"\n"
+"LABEL=\"pad_end\"";
+
+TEST_DEVICE("wacom-cintiq-pro16-pad",
+       .type = LITEST_WACOM_CINTIQ_PRO16_PAD,
+       .features = LITEST_TABLET_PAD,
+       .interface = &interface,
+
+       .name = "Wacom Cintiq Pro 16 Pad",
+       .id = &input_id,
+       .events = events,
+       .absinfo = absinfo,
+       .udev_rule = udev_rule,
+)
diff --git a/test/litest-device-wacom-cintiq-pro-16-pen.c b/test/litest-device-wacom-cintiq-pro-16-pen.c
new file mode 100644 (file)
index 0000000..a78a35e
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "litest.h"
+#include "litest-int.h"
+
+static struct input_event proximity_in[] = {
+       { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Z, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
+       { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_MISC, .value = 2083 },
+       { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+       { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 },
+       { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+       { .type = -1, .code = -1 },
+};
+
+static struct input_event proximity_out[] = {
+       { .type = EV_ABS, .code = ABS_X, .value = 0 },
+       { .type = EV_ABS, .code = ABS_Y, .value = 0 },
+       { .type = EV_ABS, .code = ABS_Z, .value = 0 },
+       { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
+       { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 },
+       { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 },
+       { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 },
+       { .type = EV_ABS, .code = ABS_MISC, .value = 0 },
+       { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+       { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 },
+       { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+       { .type = -1, .code = -1 },
+};
+
+static struct input_event motion[] = {
+       { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_Z, .value = 0 },
+       { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
+       { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN },
+       { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+       { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+       { .type = -1, .code = -1 },
+};
+
+static int
+get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
+{
+       switch (evcode) {
+       case ABS_TILT_X:
+       case ABS_TILT_Y:
+               *value = 0;
+               return 0;
+       case ABS_PRESSURE:
+               *value = 100;
+               return 0;
+       case ABS_DISTANCE:
+               *value = 0;
+               return 0;
+       }
+       return 1;
+}
+
+static struct litest_device_interface interface = {
+       .tablet_proximity_in_events = proximity_in,
+       .tablet_proximity_out_events = proximity_out,
+       .tablet_motion_events = motion,
+
+       .get_axis_default = get_axis_default,
+};
+
+static struct input_absinfo absinfo[] = {
+       { ABS_X, 0, 69920, 0, 0, 200 },
+       { ABS_Y, 0, 39980, 0, 0, 200 },
+       { ABS_Z, -900, 899, 0, 0, 287 },
+       { ABS_WHEEL, 0, 2047, 0, 0, 0 },
+       { ABS_PRESSURE, 0, 8191, 0, 0, 0 },
+       { ABS_DISTANCE, 0, 63, 1, 0, 0 },
+       { ABS_TILT_X, -64, 63, 1, 0, 57 },
+       { ABS_TILT_Y, -64, 63, 1, 0, 57 },
+       { ABS_MISC, 0, 0, 0, 0, 0 },
+       { .value = -1 },
+};
+
+static struct input_id input_id = {
+       .bustype = 0x3,
+       .vendor = 0x56a,
+       .product = 0x350,
+       .version = 0xb,
+};
+
+static int events[] = {
+       EV_KEY, BTN_TOOL_PEN,
+       EV_KEY, BTN_TOOL_RUBBER,
+       EV_KEY, BTN_TOOL_BRUSH,
+       EV_KEY, BTN_TOOL_PENCIL,
+       EV_KEY, BTN_TOOL_AIRBRUSH,
+       EV_KEY, BTN_TOUCH,
+       EV_KEY, BTN_STYLUS,
+       EV_KEY, BTN_STYLUS2,
+       EV_KEY, BTN_STYLUS3,
+       EV_MSC, MSC_SERIAL,
+       INPUT_PROP_MAX, INPUT_PROP_DIRECT,
+       -1, -1,
+};
+
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"rule_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"rule_end\"\n"
+"\n"
+"ATTRS{name}==\"litest Wacom Cintiq Pro 16 Pen*\",\\\n"
+"    ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-pro16-group\"\n"
+"\n"
+"LABEL=\"rule_end\"";
+
+TEST_DEVICE("wacom-cintiq-pro16-pen",
+       .type = LITEST_WACOM_CINTIQ_PRO16_PEN,
+       .features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT,
+       .interface = &interface,
+
+       .name = "Wacom Cintiq Pro 16 Pen",
+       .id = &input_id,
+       .events = events,
+       .absinfo = absinfo,
+       .udev_rule = udev_rule,
+)
index e204e75a1da412fe08e959571a3248955dd9c0a1..88d8d88f1c605b38c78586579c17edd0defe7fc2 100644 (file)
@@ -264,6 +264,9 @@ enum litest_device_type {
        LITEST_WACOM_CINTIQ_13HDT_PEN,
        LITEST_WACOM_CINTIQ_13HDT_PAD,
        LITEST_WACOM_CINTIQ_13HDT_FINGER,
+       LITEST_WACOM_CINTIQ_PRO16_PAD,
+       LITEST_WACOM_CINTIQ_PRO16_PEN,
+       LITEST_WACOM_CINTIQ_PRO16_FINGER,
        LITEST_WACOM_HID4800_PEN,
        LITEST_MOUSE_WHEEL_CLICK_COUNT,
        LITEST_CALIBRATED_TOUCHSCREEN,
index 04b00746d5307caf90a27dd812cb409a0706aafa..2965436ce901912719bcdc81471919d09817ffec 100644 (file)
@@ -66,13 +66,16 @@ START_TEST(pad_time)
        struct libinput_event_tablet_pad *pev;
        unsigned int code;
        uint64_t time, time_usec, oldtime;
+       bool has_buttons = false;
 
        litest_drain_events(li);
 
-       for (code = BTN_0; code < KEY_MAX; code++) {
+       for (code = BTN_0; code < BTN_DIGI; code++) {
                if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
                        continue;
 
+               has_buttons = true;
+
                litest_button_click(dev, code, 1);
                litest_button_click(dev, code, 0);
                libinput_dispatch(li);
@@ -88,7 +91,11 @@ START_TEST(pad_time)
                break;
        }
 
+       if (!has_buttons)
+               return;
+
        ev = libinput_get_event(li);
+       ck_assert_notnull(ev);
        ck_assert_int_eq(libinput_event_get_type(ev),
                         LIBINPUT_EVENT_TABLET_PAD_BUTTON);
        pev = libinput_event_get_tablet_pad_event(ev);
@@ -160,7 +167,7 @@ START_TEST(pad_num_buttons)
        unsigned int code;
        unsigned int nbuttons = 0;
 
-       for (code = BTN_0; code < KEY_MAX; code++) {
+       for (code = BTN_0; code < KEY_OK; code++) {
                /* BTN_STYLUS is set for compatibility reasons but not
                 * actually hooked up */
                if (code == BTN_STYLUS)
@@ -338,7 +345,7 @@ START_TEST(pad_button_mode_groups)
 
        litest_drain_events(li);
 
-       for (code = BTN_0; code < KEY_MAX; code++) {
+       for (code = BTN_0; code < KEY_OK; code++) {
                unsigned int mode, index;
                struct libinput_tablet_pad_mode_group *group;
 
index aa93ec245ced51efcdb0dc09fa2fd4b3a9ae41a9..3b09ca511466fe24e90e80b52d969eaf768ee260 100644 (file)
@@ -2131,6 +2131,7 @@ START_TEST(tool_id)
        case 0xc6: /* Cintiq 12WX */
        case 0xf4: /* Cintiq 24HD */
        case 0x333: /* Cintiq 13HD */
+       case 0x350: /* Cintiq Pro 16 */
                tool_id = 2083;
                break;
        default: