wacom_wac.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /*
  2. * drivers/input/tablet/wacom_wac.h
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #ifndef WACOM_WAC_H
  10. #define WACOM_WAC_H
  11. #include <linux/types.h>
  12. #include <linux/hid.h>
  13. /* maximum packet length for USB devices */
  14. #define WACOM_PKGLEN_MAX 192
  15. #define WACOM_NAME_MAX 64
  16. #define WACOM_MAX_REMOTES 5
  17. #define WACOM_STATUS_UNKNOWN 255
  18. /* packet length for individual models */
  19. #define WACOM_PKGLEN_BBFUN 9
  20. #define WACOM_PKGLEN_TPC1FG 5
  21. #define WACOM_PKGLEN_TPC1FG_B 10
  22. #define WACOM_PKGLEN_TPC2FG 14
  23. #define WACOM_PKGLEN_BBTOUCH 20
  24. #define WACOM_PKGLEN_BBTOUCH3 64
  25. #define WACOM_PKGLEN_BBPEN 10
  26. #define WACOM_PKGLEN_WIRELESS 32
  27. #define WACOM_PKGLEN_PENABLED 8
  28. #define WACOM_PKGLEN_BPAD_TOUCH 32
  29. #define WACOM_PKGLEN_BPAD_TOUCH_USB 64
  30. /* wacom data size per MT contact */
  31. #define WACOM_BYTES_PER_MT_PACKET 11
  32. #define WACOM_BYTES_PER_24HDT_PACKET 14
  33. #define WACOM_BYTES_PER_QHDTHID_PACKET 6
  34. /* device IDs */
  35. #define STYLUS_DEVICE_ID 0x02
  36. #define TOUCH_DEVICE_ID 0x03
  37. #define CURSOR_DEVICE_ID 0x06
  38. #define ERASER_DEVICE_ID 0x0A
  39. #define PAD_DEVICE_ID 0x0F
  40. /* wacom data packet report IDs */
  41. #define WACOM_REPORT_PENABLED 2
  42. #define WACOM_REPORT_PENABLED_BT 3
  43. #define WACOM_REPORT_INTUOS_ID1 5
  44. #define WACOM_REPORT_INTUOS_ID2 6
  45. #define WACOM_REPORT_INTUOSPAD 12
  46. #define WACOM_REPORT_INTUOS5PAD 3
  47. #define WACOM_REPORT_DTUSPAD 21
  48. #define WACOM_REPORT_TPC1FG 6
  49. #define WACOM_REPORT_TPC2FG 13
  50. #define WACOM_REPORT_TPCMT 13
  51. #define WACOM_REPORT_TPCMT2 3
  52. #define WACOM_REPORT_TPCHID 15
  53. #define WACOM_REPORT_CINTIQ 16
  54. #define WACOM_REPORT_CINTIQPAD 17
  55. #define WACOM_REPORT_TPCST 16
  56. #define WACOM_REPORT_DTUS 17
  57. #define WACOM_REPORT_TPC1FGE 18
  58. #define WACOM_REPORT_24HDT 1
  59. #define WACOM_REPORT_WL 128
  60. #define WACOM_REPORT_USB 192
  61. #define WACOM_REPORT_BPAD_PEN 3
  62. #define WACOM_REPORT_BPAD_TOUCH 16
  63. #define WACOM_REPORT_DEVICE_LIST 16
  64. #define WACOM_REPORT_INTUOS_PEN 16
  65. #define WACOM_REPORT_REMOTE 17
  66. #define WACOM_REPORT_INTUOSHT2_ID 8
  67. /* device quirks */
  68. #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001
  69. #define WACOM_QUIRK_BATTERY 0x0008
  70. /* device types */
  71. #define WACOM_DEVICETYPE_NONE 0x0000
  72. #define WACOM_DEVICETYPE_PEN 0x0001
  73. #define WACOM_DEVICETYPE_TOUCH 0x0002
  74. #define WACOM_DEVICETYPE_PAD 0x0004
  75. #define WACOM_DEVICETYPE_WL_MONITOR 0x0008
  76. #define WACOM_DEVICETYPE_DIRECT 0x0010
  77. #define WACOM_VENDORDEFINED_PEN 0xff0d0001
  78. #define WACOM_G9_PAGE 0xff090000
  79. #define WACOM_G9_DIGITIZER (WACOM_G9_PAGE | 0x02)
  80. #define WACOM_G9_TOUCHSCREEN (WACOM_G9_PAGE | 0x11)
  81. #define WACOM_G11_PAGE 0xff110000
  82. #define WACOM_G11_DIGITIZER (WACOM_G11_PAGE | 0x02)
  83. #define WACOM_G11_TOUCHSCREEN (WACOM_G11_PAGE | 0x11)
  84. #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
  85. ((f)->physical == HID_DG_STYLUS) || \
  86. ((f)->physical == HID_DG_PEN) || \
  87. ((f)->application == HID_DG_PEN) || \
  88. ((f)->application == HID_DG_DIGITIZER) || \
  89. ((f)->application == WACOM_VENDORDEFINED_PEN))
  90. #define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \
  91. ((f)->physical == HID_DG_FINGER) || \
  92. ((f)->application == HID_DG_TOUCHSCREEN))
  93. enum {
  94. PENPARTNER = 0,
  95. GRAPHIRE,
  96. GRAPHIRE_BT,
  97. WACOM_G4,
  98. PTU,
  99. PL,
  100. DTU,
  101. DTUS,
  102. DTUSX,
  103. INTUOS,
  104. INTUOS3S,
  105. INTUOS3,
  106. INTUOS3L,
  107. INTUOS4S,
  108. INTUOS4,
  109. INTUOS4WL,
  110. INTUOS4L,
  111. INTUOS5S,
  112. INTUOS5,
  113. INTUOS5L,
  114. INTUOSPS,
  115. INTUOSPM,
  116. INTUOSPL,
  117. WACOM_21UX2,
  118. WACOM_22HD,
  119. DTK,
  120. WACOM_24HD,
  121. WACOM_27QHD,
  122. CINTIQ_HYBRID,
  123. CINTIQ_COMPANION_2,
  124. CINTIQ,
  125. WACOM_BEE,
  126. WACOM_13HD,
  127. WACOM_MO,
  128. BAMBOO_PEN,
  129. INTUOSHT,
  130. INTUOSHT2,
  131. BAMBOO_TOUCH,
  132. BAMBOO_PT,
  133. WACOM_24HDT,
  134. WACOM_27QHDT,
  135. BAMBOO_PAD,
  136. WIRELESS,
  137. REMOTE,
  138. TABLETPC, /* add new TPC below */
  139. TABLETPCE,
  140. TABLETPC2FG,
  141. MTSCREEN,
  142. MTTPC,
  143. MTTPC_B,
  144. HID_GENERIC,
  145. MAX_TYPE
  146. };
  147. struct wacom_features {
  148. const char *name;
  149. int x_max;
  150. int y_max;
  151. int pressure_max;
  152. int distance_max;
  153. int type;
  154. int x_resolution;
  155. int y_resolution;
  156. int numbered_buttons;
  157. int x_min;
  158. int y_min;
  159. int device_type;
  160. int x_phy;
  161. int y_phy;
  162. unsigned unit;
  163. int unitExpo;
  164. int x_fuzz;
  165. int y_fuzz;
  166. int pressure_fuzz;
  167. int distance_fuzz;
  168. int tilt_fuzz;
  169. unsigned quirks;
  170. unsigned touch_max;
  171. int oVid;
  172. int oPid;
  173. int pktlen;
  174. bool check_for_hid_type;
  175. int hid_type;
  176. };
  177. struct wacom_shared {
  178. bool stylus_in_proximity;
  179. bool touch_down;
  180. /* for wireless device to access USB interfaces */
  181. unsigned touch_max;
  182. int type;
  183. struct input_dev *touch_input;
  184. struct hid_device *pen;
  185. struct hid_device *touch;
  186. };
  187. struct hid_data {
  188. __s16 inputmode; /* InputMode HID feature, -1 if non-existent */
  189. __s16 inputmode_index; /* InputMode HID feature index in the report */
  190. bool inrange_state;
  191. bool invert_state;
  192. bool tipswitch;
  193. int x;
  194. int y;
  195. int pressure;
  196. int width;
  197. int height;
  198. int id;
  199. int cc_report;
  200. int cc_index;
  201. int cc_value_index;
  202. int last_slot_field;
  203. int num_expected;
  204. int num_received;
  205. };
  206. struct wacom_remote_data {
  207. struct {
  208. u32 serial;
  209. bool connected;
  210. } remote[WACOM_MAX_REMOTES];
  211. };
  212. struct wacom_wac {
  213. char name[WACOM_NAME_MAX];
  214. char pen_name[WACOM_NAME_MAX];
  215. char touch_name[WACOM_NAME_MAX];
  216. char pad_name[WACOM_NAME_MAX];
  217. unsigned char data[WACOM_PKGLEN_MAX];
  218. int tool[2];
  219. int id[2];
  220. __u32 serial[2];
  221. bool reporting_data;
  222. struct wacom_features features;
  223. struct wacom_shared *shared;
  224. struct input_dev *pen_input;
  225. struct input_dev *touch_input;
  226. struct input_dev *pad_input;
  227. int pid;
  228. int num_contacts_left;
  229. u8 bt_features;
  230. u8 bt_high_speed;
  231. int mode_report;
  232. int mode_value;
  233. struct hid_data hid_data;
  234. };
  235. #endif