litest-device-wacom-cintiq-24hdt-pad.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright © 2016 Red Hat, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. */
  23. #include "config.h"
  24. #include <errno.h>
  25. #include <fcntl.h>
  26. #include <sys/stat.h>
  27. #include <unistd.h>
  28. #include "litest-int.h"
  29. #include "litest.h"
  30. static void
  31. litest_wacom_cintiq_pad_teardown(void)
  32. {
  33. litest_generic_device_teardown();
  34. }
  35. static struct input_event down[] = {
  36. { .type = -1, .code = -1 },
  37. };
  38. static struct input_event move[] = {
  39. { .type = -1, .code = -1 },
  40. };
  41. static struct input_event ring_start[] = {
  42. { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
  43. { .type = EV_ABS, .code = ABS_MISC, .value = 15 },
  44. { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
  45. { .type = -1, .code = -1 },
  46. };
  47. static struct input_event ring_change[] = {
  48. { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
  49. { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
  50. { .type = -1, .code = -1 },
  51. };
  52. static struct input_event ring_end[] = {
  53. { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
  54. { .type = EV_ABS, .code = ABS_MISC, .value = 0 },
  55. { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
  56. { .type = -1, .code = -1 },
  57. };
  58. static struct litest_device_interface interface = {
  59. .touch_down_events = down,
  60. .touch_move_events = move,
  61. .pad_ring_start_events = ring_start,
  62. .pad_ring_change_events = ring_change,
  63. .pad_ring_end_events = ring_end,
  64. };
  65. /* clang-format off */
  66. /* clang-format off */
  67. static struct input_absinfo absinfo[] = {
  68. { ABS_X, 0, 1, 0, 0, 0 },
  69. { ABS_Y, 0, 1, 0, 0, 0 },
  70. { ABS_WHEEL, 0, 71, 0, 0, 0 },
  71. { ABS_THROTTLE, 0, 71, 0, 0, 0 },
  72. { ABS_MISC, 0, 0, 0, 0, 0 },
  73. { .value = -1 },
  74. };
  75. /* clang-format on */
  76. /* clang-format on */
  77. static struct input_id input_id = {
  78. .bustype = 0x3,
  79. .vendor = 0x56a,
  80. .product = 0xf8,
  81. .version = 0x110,
  82. };
  83. /* clang-format off */
  84. static int events[] = {
  85. EV_KEY, KEY_PROG1,
  86. EV_KEY, KEY_PROG2,
  87. EV_KEY, KEY_PROG3,
  88. EV_KEY, BTN_0,
  89. EV_KEY, BTN_1,
  90. EV_KEY, BTN_2,
  91. EV_KEY, BTN_3,
  92. EV_KEY, BTN_4,
  93. EV_KEY, BTN_5,
  94. EV_KEY, BTN_6,
  95. EV_KEY, BTN_7,
  96. EV_KEY, BTN_8,
  97. EV_KEY, BTN_9,
  98. EV_KEY, BTN_SOUTH,
  99. EV_KEY, BTN_EAST,
  100. EV_KEY, BTN_C,
  101. EV_KEY, BTN_NORTH,
  102. EV_KEY, BTN_WEST,
  103. EV_KEY, BTN_Z,
  104. EV_KEY, BTN_STYLUS,
  105. -1, -1,
  106. };
  107. /* clang-format on */
  108. TEST_DEVICE(LITEST_WACOM_CINTIQ_24HDT_PAD,
  109. .features = LITEST_TABLET_PAD | LITEST_RING,
  110. .teardown = litest_wacom_cintiq_pad_teardown,
  111. .interface = &interface,
  112. .name = "Wacom Cintiq 24 HD touch Pad",
  113. .id = &input_id,
  114. .events = events,
  115. .absinfo = absinfo,
  116. .udev_properties = {
  117. { "ID_INPUT_TABLET_PAD", "1" },
  118. { "LIBINPUT_DEVICE_GROUP", "wacom-24hdt-group" },
  119. { "ID_INTEGRATION", "external" },
  120. { NULL },
  121. }, )