hid-uclogic-rdesc.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * HID driver for UC-Logic devices not fully compliant with HID standard
  4. * - original and fixed report descriptors
  5. *
  6. * Copyright (c) 2010-2018 Nikolai Kondrashov
  7. * Copyright (c) 2013 Martin Rusko
  8. */
  9. /*
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. */
  15. #ifndef _HID_UCLOGIC_RDESC_H
  16. #define _HID_UCLOGIC_RDESC_H
  17. #include <linux/usb.h>
  18. /* Size of the original descriptor of WPXXXXU tablets */
  19. #define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212
  20. /* Fixed WP4030U report descriptor */
  21. extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
  22. extern const size_t uclogic_rdesc_wp4030u_fixed_size;
  23. /* Fixed WP5540U report descriptor */
  24. extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
  25. extern const size_t uclogic_rdesc_wp5540u_fixed_size;
  26. /* Fixed WP8060U report descriptor */
  27. extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
  28. extern const size_t uclogic_rdesc_wp8060u_fixed_size;
  29. /* Size of the original descriptor of the new WP5540U tablet */
  30. #define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE 232
  31. /* Size of the original descriptor of WP1062 tablet */
  32. #define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254
  33. /* Fixed WP1062 report descriptor */
  34. extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
  35. extern const size_t uclogic_rdesc_wp1062_fixed_size;
  36. /* Size of the original descriptor of PF1209 tablet */
  37. #define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234
  38. /* Fixed PF1209 report descriptor */
  39. extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
  40. extern const size_t uclogic_rdesc_pf1209_fixed_size;
  41. /* Size of the original descriptors of TWHL850 tablet */
  42. #define UCLOGIC_RDESC_TWHL850_ORIG0_SIZE 182
  43. #define UCLOGIC_RDESC_TWHL850_ORIG1_SIZE 161
  44. #define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92
  45. /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
  46. extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
  47. extern const size_t uclogic_rdesc_twhl850_fixed0_size;
  48. /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
  49. extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
  50. extern const size_t uclogic_rdesc_twhl850_fixed1_size;
  51. /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
  52. extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
  53. extern const size_t uclogic_rdesc_twhl850_fixed2_size;
  54. /* Size of the original descriptors of TWHA60 tablet */
  55. #define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE 254
  56. #define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139
  57. /* Fixed TWHA60 report descriptor, interface 0 (stylus) */
  58. extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
  59. extern const size_t uclogic_rdesc_twha60_fixed0_size;
  60. /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
  61. extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
  62. extern const size_t uclogic_rdesc_twha60_fixed1_size;
  63. /* Report descriptor template placeholder head */
  64. #define UCLOGIC_RDESC_PEN_PH_HEAD 0xFE, 0xED, 0x1D
  65. #define UCLOGIC_RDESC_FRAME_PH_BTN_HEAD 0xFE, 0xED
  66. /* Apply report descriptor parameters to a report descriptor template */
  67. extern __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
  68. size_t template_size,
  69. const s32 *param_list,
  70. size_t param_num);
  71. /* Report descriptor template placeholder IDs */
  72. enum uclogic_rdesc_ph_id {
  73. UCLOGIC_RDESC_PEN_PH_ID_X_LM,
  74. UCLOGIC_RDESC_PEN_PH_ID_X_PM,
  75. UCLOGIC_RDESC_PEN_PH_ID_Y_LM,
  76. UCLOGIC_RDESC_PEN_PH_ID_Y_PM,
  77. UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM,
  78. UCLOGIC_RDESC_FRAME_PH_ID_UM,
  79. UCLOGIC_RDESC_PH_ID_NUM
  80. };
  81. /* Report descriptor pen template placeholder */
  82. #define UCLOGIC_RDESC_PEN_PH(_ID) \
  83. UCLOGIC_RDESC_PEN_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
  84. /* Report descriptor frame buttons template placeholder */
  85. #define UCLOGIC_RDESC_FRAME_PH_BTN \
  86. UCLOGIC_RDESC_FRAME_PH_BTN_HEAD, UCLOGIC_RDESC_FRAME_PH_ID_UM
  87. /* Report ID for v1 pen reports */
  88. #define UCLOGIC_RDESC_V1_PEN_ID 0x07
  89. /* Fixed report descriptor template for (tweaked) v1 pen reports */
  90. extern const __u8 uclogic_rdesc_v1_pen_template_arr[];
  91. extern const size_t uclogic_rdesc_v1_pen_template_size;
  92. /* Report ID for v2 pen reports */
  93. #define UCLOGIC_RDESC_V2_PEN_ID 0x08
  94. /* Fixed report descriptor template for (tweaked) v2 pen reports */
  95. extern const __u8 uclogic_rdesc_v2_pen_template_arr[];
  96. extern const size_t uclogic_rdesc_v2_pen_template_size;
  97. /* Report ID for tweaked v1 frame reports */
  98. #define UCLOGIC_RDESC_V1_FRAME_ID 0xf7
  99. /* Fixed report descriptor for (tweaked) v1 frame reports */
  100. extern const __u8 uclogic_rdesc_v1_frame_arr[];
  101. extern const size_t uclogic_rdesc_v1_frame_size;
  102. /* Report ID for tweaked v2 frame button reports */
  103. #define UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID 0xf7
  104. /* Fixed report descriptor for (tweaked) v2 frame button reports */
  105. extern const __u8 uclogic_rdesc_v2_frame_buttons_arr[];
  106. extern const size_t uclogic_rdesc_v2_frame_buttons_size;
  107. /* Report ID for tweaked v2 frame touch ring/strip reports */
  108. #define UCLOGIC_RDESC_V2_FRAME_TOUCH_ID 0xf8
  109. /* Fixed report descriptor for (tweaked) v2 frame touch ring reports */
  110. extern const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[];
  111. extern const size_t uclogic_rdesc_v2_frame_touch_ring_size;
  112. /* Fixed report descriptor for (tweaked) v2 frame touch strip reports */
  113. extern const __u8 uclogic_rdesc_v2_frame_touch_strip_arr[];
  114. extern const size_t uclogic_rdesc_v2_frame_touch_strip_size;
  115. /* Device ID byte offset in v2 frame touch ring/strip reports */
  116. #define UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE 0x4
  117. /* Report ID for tweaked v2 frame dial reports */
  118. #define UCLOGIC_RDESC_V2_FRAME_DIAL_ID 0xf9
  119. /* Fixed report descriptor for (tweaked) v2 frame dial reports */
  120. extern const __u8 uclogic_rdesc_v2_frame_dial_arr[];
  121. extern const size_t uclogic_rdesc_v2_frame_dial_size;
  122. /* Device ID byte offset in v2 frame dial reports */
  123. #define UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE 0x4
  124. /* Report ID for tweaked UGEE v2 battery reports */
  125. #define UCLOGIC_RDESC_UGEE_V2_BATTERY_ID 0xba
  126. /* Fixed report descriptor template for UGEE v2 pen reports */
  127. extern const __u8 uclogic_rdesc_ugee_v2_pen_template_arr[];
  128. extern const size_t uclogic_rdesc_ugee_v2_pen_template_size;
  129. /* Fixed report descriptor template for UGEE v2 frame reports (buttons only) */
  130. extern const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[];
  131. extern const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size;
  132. /* Fixed report descriptor template for UGEE v2 frame reports (dial) */
  133. extern const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[];
  134. extern const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size;
  135. /* Fixed report descriptor template for UGEE v2 frame reports (mouse) */
  136. extern const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[];
  137. extern const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size;
  138. /* Fixed report descriptor template for UGEE v2 battery reports */
  139. extern const __u8 uclogic_rdesc_ugee_v2_battery_template_arr[];
  140. extern const size_t uclogic_rdesc_ugee_v2_battery_template_size;
  141. /* Fixed report descriptor for Ugee EX07 frame */
  142. extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[];
  143. extern const size_t uclogic_rdesc_ugee_ex07_frame_size;
  144. /* Fixed report descriptor for XP-Pen Deco 01 frame controls */
  145. extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[];
  146. extern const size_t uclogic_rdesc_xppen_deco01_frame_size;
  147. /* Fixed report descriptor for Ugee G5 frame controls */
  148. extern const __u8 uclogic_rdesc_ugee_g5_frame_arr[];
  149. extern const size_t uclogic_rdesc_ugee_g5_frame_size;
  150. /* Report ID of Ugee G5 frame control reports */
  151. #define UCLOGIC_RDESC_UGEE_G5_FRAME_ID 0x06
  152. /* Device ID byte offset in Ugee G5 frame report */
  153. #define UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE 0x2
  154. /* Least-significant bit of Ugee G5 frame rotary encoder state */
  155. #define UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB 38
  156. #endif /* _HID_UCLOGIC_RDESC_H */