wacom_wac.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. /*
  2. * drivers/input/tablet/wacom_wac.c
  3. *
  4. * USB Wacom tablet support - Wacom specific code
  5. *
  6. */
  7. /*
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include "wacom_wac.h"
  14. #include "wacom.h"
  15. static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
  16. {
  17. unsigned char *data = wacom->data;
  18. struct input_dev *input = wacom->input;
  19. switch (data[0]) {
  20. case 1:
  21. if (data[5] & 0x80) {
  22. wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  23. wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
  24. input_report_key(input, wacom->tool[0], 1);
  25. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  26. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
  27. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
  28. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  29. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127));
  30. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  31. } else {
  32. input_report_key(input, wacom->tool[0], 0);
  33. input_report_abs(input, ABS_MISC, 0); /* report tool id */
  34. input_report_abs(input, ABS_PRESSURE, -1);
  35. input_report_key(input, BTN_TOUCH, 0);
  36. }
  37. break;
  38. case 2:
  39. input_report_key(input, BTN_TOOL_PEN, 1);
  40. input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
  41. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
  42. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
  43. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  44. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
  45. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  46. break;
  47. default:
  48. printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]);
  49. return 0;
  50. }
  51. return 1;
  52. }
  53. static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
  54. {
  55. struct wacom_features *features = &wacom->features;
  56. unsigned char *data = wacom->data;
  57. struct input_dev *input = wacom->input;
  58. int prox, pressure;
  59. if (data[0] != WACOM_REPORT_PENABLED) {
  60. dbg("wacom_pl_irq: received unknown report #%d", data[0]);
  61. return 0;
  62. }
  63. prox = data[1] & 0x40;
  64. if (prox) {
  65. wacom->id[0] = ERASER_DEVICE_ID;
  66. pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
  67. if (features->pressure_max > 255)
  68. pressure = (pressure << 1) | ((data[4] >> 6) & 1);
  69. pressure += (features->pressure_max + 1) / 2;
  70. /*
  71. * if going from out of proximity into proximity select between the eraser
  72. * and the pen based on the state of the stylus2 button, choose eraser if
  73. * pressed else choose pen. if not a proximity change from out to in, send
  74. * an out of proximity for previous tool then a in for new tool.
  75. */
  76. if (!wacom->tool[0]) {
  77. /* Eraser bit set for DTF */
  78. if (data[1] & 0x10)
  79. wacom->tool[1] = BTN_TOOL_RUBBER;
  80. else
  81. /* Going into proximity select tool */
  82. wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  83. } else {
  84. /* was entered with stylus2 pressed */
  85. if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
  86. /* report out proximity for previous tool */
  87. input_report_key(input, wacom->tool[1], 0);
  88. input_sync(input);
  89. wacom->tool[1] = BTN_TOOL_PEN;
  90. return 0;
  91. }
  92. }
  93. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  94. /* Unknown tool selected default to pen tool */
  95. wacom->tool[1] = BTN_TOOL_PEN;
  96. wacom->id[0] = STYLUS_DEVICE_ID;
  97. }
  98. input_report_key(input, wacom->tool[1], prox); /* report in proximity for tool */
  99. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  100. input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
  101. input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
  102. input_report_abs(input, ABS_PRESSURE, pressure);
  103. input_report_key(input, BTN_TOUCH, data[4] & 0x08);
  104. input_report_key(input, BTN_STYLUS, data[4] & 0x10);
  105. /* Only allow the stylus2 button to be reported for the pen tool. */
  106. input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
  107. } else {
  108. /* report proximity-out of a (valid) tool */
  109. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  110. /* Unknown tool selected default to pen tool */
  111. wacom->tool[1] = BTN_TOOL_PEN;
  112. }
  113. input_report_key(input, wacom->tool[1], prox);
  114. }
  115. wacom->tool[0] = prox; /* Save proximity state */
  116. return 1;
  117. }
  118. static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
  119. {
  120. unsigned char *data = wacom->data;
  121. struct input_dev *input = wacom->input;
  122. if (data[0] != WACOM_REPORT_PENABLED) {
  123. printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
  124. return 0;
  125. }
  126. if (data[1] & 0x04) {
  127. input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20);
  128. input_report_key(input, BTN_TOUCH, data[1] & 0x08);
  129. wacom->id[0] = ERASER_DEVICE_ID;
  130. } else {
  131. input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20);
  132. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  133. wacom->id[0] = STYLUS_DEVICE_ID;
  134. }
  135. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  136. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
  137. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
  138. input_report_abs(input, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
  139. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  140. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  141. return 1;
  142. }
  143. static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
  144. {
  145. struct wacom_features *features = &wacom->features;
  146. unsigned char *data = wacom->data;
  147. struct input_dev *input = wacom->input;
  148. int x, y, prox;
  149. int rw = 0;
  150. int retval = 0;
  151. if (data[0] != WACOM_REPORT_PENABLED) {
  152. dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
  153. goto exit;
  154. }
  155. prox = data[1] & 0x80;
  156. if (prox || wacom->id[0]) {
  157. if (prox) {
  158. switch ((data[1] >> 5) & 3) {
  159. case 0: /* Pen */
  160. wacom->tool[0] = BTN_TOOL_PEN;
  161. wacom->id[0] = STYLUS_DEVICE_ID;
  162. break;
  163. case 1: /* Rubber */
  164. wacom->tool[0] = BTN_TOOL_RUBBER;
  165. wacom->id[0] = ERASER_DEVICE_ID;
  166. break;
  167. case 2: /* Mouse with wheel */
  168. input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
  169. /* fall through */
  170. case 3: /* Mouse without wheel */
  171. wacom->tool[0] = BTN_TOOL_MOUSE;
  172. wacom->id[0] = CURSOR_DEVICE_ID;
  173. break;
  174. }
  175. }
  176. x = wacom_le16_to_cpu(&data[2]);
  177. y = wacom_le16_to_cpu(&data[4]);
  178. input_report_abs(input, ABS_X, x);
  179. input_report_abs(input, ABS_Y, y);
  180. if (wacom->tool[0] != BTN_TOOL_MOUSE) {
  181. input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
  182. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  183. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  184. input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
  185. } else {
  186. input_report_key(input, BTN_LEFT, data[1] & 0x01);
  187. input_report_key(input, BTN_RIGHT, data[1] & 0x02);
  188. if (features->type == WACOM_G4 ||
  189. features->type == WACOM_MO) {
  190. input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f);
  191. rw = (signed)(data[7] & 0x04) - (data[7] & 0x03);
  192. } else {
  193. input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f);
  194. rw = -(signed)data[6];
  195. }
  196. input_report_rel(input, REL_WHEEL, rw);
  197. }
  198. if (!prox)
  199. wacom->id[0] = 0;
  200. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  201. input_report_key(input, wacom->tool[0], prox);
  202. input_sync(input); /* sync last event */
  203. }
  204. /* send pad data */
  205. switch (features->type) {
  206. case WACOM_G4:
  207. prox = data[7] & 0xf8;
  208. if (prox || wacom->id[1]) {
  209. wacom->id[1] = PAD_DEVICE_ID;
  210. input_report_key(input, BTN_0, (data[7] & 0x40));
  211. input_report_key(input, BTN_4, (data[7] & 0x80));
  212. rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
  213. input_report_rel(input, REL_WHEEL, rw);
  214. input_report_key(input, BTN_TOOL_FINGER, 0xf0);
  215. input_report_abs(input, ABS_MISC, wacom->id[1]);
  216. if (!prox)
  217. wacom->id[1] = 0;
  218. input_report_abs(input, ABS_MISC, wacom->id[1]);
  219. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  220. }
  221. retval = 1;
  222. break;
  223. case WACOM_MO:
  224. prox = (data[7] & 0xf8) || data[8];
  225. if (prox || wacom->id[1]) {
  226. wacom->id[1] = PAD_DEVICE_ID;
  227. input_report_key(input, BTN_0, (data[7] & 0x08));
  228. input_report_key(input, BTN_1, (data[7] & 0x20));
  229. input_report_key(input, BTN_4, (data[7] & 0x10));
  230. input_report_key(input, BTN_5, (data[7] & 0x40));
  231. input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f));
  232. input_report_key(input, BTN_TOOL_FINGER, 0xf0);
  233. if (!prox)
  234. wacom->id[1] = 0;
  235. input_report_abs(input, ABS_MISC, wacom->id[1]);
  236. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  237. }
  238. retval = 1;
  239. break;
  240. }
  241. exit:
  242. return retval;
  243. }
  244. static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
  245. {
  246. struct wacom_features *features = &wacom->features;
  247. unsigned char *data = wacom->data;
  248. struct input_dev *input = wacom->input;
  249. int idx = 0;
  250. /* tool number */
  251. if (features->type == INTUOS)
  252. idx = data[1] & 0x01;
  253. /* Enter report */
  254. if ((data[1] & 0xfc) == 0xc0) {
  255. /* serial number of the tool */
  256. wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
  257. (data[4] << 20) + (data[5] << 12) +
  258. (data[6] << 4) + (data[7] >> 4);
  259. wacom->id[idx] = (data[2] << 4) | (data[3] >> 4);
  260. switch (wacom->id[idx]) {
  261. case 0x812: /* Inking pen */
  262. case 0x801: /* Intuos3 Inking pen */
  263. case 0x20802: /* Intuos4 Classic Pen */
  264. case 0x012:
  265. wacom->tool[idx] = BTN_TOOL_PENCIL;
  266. break;
  267. case 0x822: /* Pen */
  268. case 0x842:
  269. case 0x852:
  270. case 0x823: /* Intuos3 Grip Pen */
  271. case 0x813: /* Intuos3 Classic Pen */
  272. case 0x885: /* Intuos3 Marker Pen */
  273. case 0x802: /* Intuos4 Grip Pen Eraser */
  274. case 0x804: /* Intuos4 Marker Pen */
  275. case 0x40802: /* Intuos4 Classic Pen */
  276. case 0x022:
  277. wacom->tool[idx] = BTN_TOOL_PEN;
  278. break;
  279. case 0x832: /* Stroke pen */
  280. case 0x032:
  281. wacom->tool[idx] = BTN_TOOL_BRUSH;
  282. break;
  283. case 0x007: /* Mouse 4D and 2D */
  284. case 0x09c:
  285. case 0x094:
  286. case 0x017: /* Intuos3 2D Mouse */
  287. case 0x806: /* Intuos4 Mouse */
  288. wacom->tool[idx] = BTN_TOOL_MOUSE;
  289. break;
  290. case 0x096: /* Lens cursor */
  291. case 0x097: /* Intuos3 Lens cursor */
  292. case 0x006: /* Intuos4 Lens cursor */
  293. wacom->tool[idx] = BTN_TOOL_LENS;
  294. break;
  295. case 0x82a: /* Eraser */
  296. case 0x85a:
  297. case 0x91a:
  298. case 0xd1a:
  299. case 0x0fa:
  300. case 0x82b: /* Intuos3 Grip Pen Eraser */
  301. case 0x81b: /* Intuos3 Classic Pen Eraser */
  302. case 0x91b: /* Intuos3 Airbrush Eraser */
  303. case 0x80c: /* Intuos4 Marker Pen Eraser */
  304. case 0x80a: /* Intuos4 Grip Pen Eraser */
  305. case 0x4080a: /* Intuos4 Classic Pen Eraser */
  306. case 0x90a: /* Intuos4 Airbrush Eraser */
  307. wacom->tool[idx] = BTN_TOOL_RUBBER;
  308. break;
  309. case 0xd12:
  310. case 0x912:
  311. case 0x112:
  312. case 0x913: /* Intuos3 Airbrush */
  313. case 0x902: /* Intuos4 Airbrush */
  314. wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
  315. break;
  316. default: /* Unknown tool */
  317. wacom->tool[idx] = BTN_TOOL_PEN;
  318. break;
  319. }
  320. return 1;
  321. }
  322. /* Exit report */
  323. if ((data[1] & 0xfe) == 0x80) {
  324. /*
  325. * Reset all states otherwise we lose the initial states
  326. * when in-prox next time
  327. */
  328. input_report_abs(input, ABS_X, 0);
  329. input_report_abs(input, ABS_Y, 0);
  330. input_report_abs(input, ABS_DISTANCE, 0);
  331. input_report_abs(input, ABS_TILT_X, 0);
  332. input_report_abs(input, ABS_TILT_Y, 0);
  333. if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
  334. input_report_key(input, BTN_LEFT, 0);
  335. input_report_key(input, BTN_MIDDLE, 0);
  336. input_report_key(input, BTN_RIGHT, 0);
  337. input_report_key(input, BTN_SIDE, 0);
  338. input_report_key(input, BTN_EXTRA, 0);
  339. input_report_abs(input, ABS_THROTTLE, 0);
  340. input_report_abs(input, ABS_RZ, 0);
  341. } else {
  342. input_report_abs(input, ABS_PRESSURE, 0);
  343. input_report_key(input, BTN_STYLUS, 0);
  344. input_report_key(input, BTN_STYLUS2, 0);
  345. input_report_key(input, BTN_TOUCH, 0);
  346. input_report_abs(input, ABS_WHEEL, 0);
  347. if (features->type >= INTUOS3S)
  348. input_report_abs(input, ABS_Z, 0);
  349. }
  350. input_report_key(input, wacom->tool[idx], 0);
  351. input_report_abs(input, ABS_MISC, 0); /* reset tool id */
  352. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  353. wacom->id[idx] = 0;
  354. return 2;
  355. }
  356. return 0;
  357. }
  358. static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
  359. {
  360. struct wacom_features *features = &wacom->features;
  361. unsigned char *data = wacom->data;
  362. struct input_dev *input = wacom->input;
  363. unsigned int t;
  364. /* general pen packet */
  365. if ((data[1] & 0xb8) == 0xa0) {
  366. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  367. if (features->type >= INTUOS4S && features->type <= INTUOS4L)
  368. t = (t << 1) | (data[1] & 1);
  369. input_report_abs(input, ABS_PRESSURE, t);
  370. input_report_abs(input, ABS_TILT_X,
  371. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  372. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  373. input_report_key(input, BTN_STYLUS, data[1] & 2);
  374. input_report_key(input, BTN_STYLUS2, data[1] & 4);
  375. input_report_key(input, BTN_TOUCH, t > 10);
  376. }
  377. /* airbrush second packet */
  378. if ((data[1] & 0xbc) == 0xb4) {
  379. input_report_abs(input, ABS_WHEEL,
  380. (data[6] << 2) | ((data[7] >> 6) & 3));
  381. input_report_abs(input, ABS_TILT_X,
  382. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  383. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  384. }
  385. }
  386. static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
  387. {
  388. struct wacom_features *features = &wacom->features;
  389. unsigned char *data = wacom->data;
  390. struct input_dev *input = wacom->input;
  391. unsigned int t;
  392. int idx = 0, result;
  393. if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD
  394. && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) {
  395. dbg("wacom_intuos_irq: received unknown report #%d", data[0]);
  396. return 0;
  397. }
  398. /* tool number */
  399. if (features->type == INTUOS)
  400. idx = data[1] & 0x01;
  401. /* pad packets. Works as a second tool and is always in prox */
  402. if (data[0] == WACOM_REPORT_INTUOSPAD) {
  403. /* initiate the pad as a device */
  404. if (wacom->tool[1] != BTN_TOOL_FINGER)
  405. wacom->tool[1] = BTN_TOOL_FINGER;
  406. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  407. input_report_key(input, BTN_0, (data[2] & 0x01));
  408. input_report_key(input, BTN_1, (data[3] & 0x01));
  409. input_report_key(input, BTN_2, (data[3] & 0x02));
  410. input_report_key(input, BTN_3, (data[3] & 0x04));
  411. input_report_key(input, BTN_4, (data[3] & 0x08));
  412. input_report_key(input, BTN_5, (data[3] & 0x10));
  413. input_report_key(input, BTN_6, (data[3] & 0x20));
  414. if (data[1] & 0x80) {
  415. input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
  416. } else {
  417. /* Out of proximity, clear wheel value. */
  418. input_report_abs(input, ABS_WHEEL, 0);
  419. }
  420. if (features->type != INTUOS4S) {
  421. input_report_key(input, BTN_7, (data[3] & 0x40));
  422. input_report_key(input, BTN_8, (data[3] & 0x80));
  423. }
  424. if (data[1] | (data[2] & 0x01) | data[3]) {
  425. input_report_key(input, wacom->tool[1], 1);
  426. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  427. } else {
  428. input_report_key(input, wacom->tool[1], 0);
  429. input_report_abs(input, ABS_MISC, 0);
  430. }
  431. } else {
  432. input_report_key(input, BTN_0, (data[5] & 0x01));
  433. input_report_key(input, BTN_1, (data[5] & 0x02));
  434. input_report_key(input, BTN_2, (data[5] & 0x04));
  435. input_report_key(input, BTN_3, (data[5] & 0x08));
  436. input_report_key(input, BTN_4, (data[6] & 0x01));
  437. input_report_key(input, BTN_5, (data[6] & 0x02));
  438. input_report_key(input, BTN_6, (data[6] & 0x04));
  439. input_report_key(input, BTN_7, (data[6] & 0x08));
  440. input_report_key(input, BTN_8, (data[5] & 0x10));
  441. input_report_key(input, BTN_9, (data[6] & 0x10));
  442. input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
  443. input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
  444. if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) |
  445. data[2] | (data[3] & 0x1f) | data[4]) {
  446. input_report_key(input, wacom->tool[1], 1);
  447. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  448. } else {
  449. input_report_key(input, wacom->tool[1], 0);
  450. input_report_abs(input, ABS_MISC, 0);
  451. }
  452. }
  453. input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
  454. return 1;
  455. }
  456. /* process in/out prox events */
  457. result = wacom_intuos_inout(wacom, wcombo);
  458. if (result)
  459. return result - 1;
  460. /* don't proceed if we don't know the ID */
  461. if (!wacom->id[idx])
  462. return 0;
  463. /* Only large Intuos support Lense Cursor */
  464. if (wacom->tool[idx] == BTN_TOOL_LENS &&
  465. (features->type == INTUOS3 ||
  466. features->type == INTUOS3S ||
  467. features->type == INTUOS4 ||
  468. features->type == INTUOS4S)) {
  469. return 0;
  470. }
  471. /* Cintiq doesn't send data when RDY bit isn't set */
  472. if (features->type == CINTIQ && !(data[1] & 0x40))
  473. return 0;
  474. if (features->type >= INTUOS3S) {
  475. input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
  476. input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
  477. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
  478. } else {
  479. input_report_abs(input, ABS_X, wacom_be16_to_cpu(&data[2]));
  480. input_report_abs(input, ABS_Y, wacom_be16_to_cpu(&data[4]));
  481. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
  482. }
  483. /* process general packets */
  484. wacom_intuos_general(wacom, wcombo);
  485. /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
  486. if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
  487. if (data[1] & 0x02) {
  488. /* Rotation packet */
  489. if (features->type >= INTUOS3S) {
  490. /* I3 marker pen rotation */
  491. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  492. t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
  493. ((t-1) / 2 + 450)) : (450 - t / 2) ;
  494. input_report_abs(input, ABS_Z, t);
  495. } else {
  496. /* 4D mouse rotation packet */
  497. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  498. input_report_abs(input, ABS_RZ, (data[7] & 0x20) ?
  499. ((t - 1) / 2) : -t / 2);
  500. }
  501. } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
  502. /* 4D mouse packet */
  503. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  504. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  505. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  506. input_report_key(input, BTN_SIDE, data[8] & 0x20);
  507. input_report_key(input, BTN_EXTRA, data[8] & 0x10);
  508. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  509. input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
  510. } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
  511. /* I4 mouse */
  512. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  513. input_report_key(input, BTN_LEFT, data[6] & 0x01);
  514. input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
  515. input_report_key(input, BTN_RIGHT, data[6] & 0x04);
  516. input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7)
  517. - ((data[7] & 0x40) >> 6));
  518. input_report_key(input, BTN_SIDE, data[6] & 0x08);
  519. input_report_key(input, BTN_EXTRA, data[6] & 0x10);
  520. input_report_abs(input, ABS_TILT_X,
  521. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  522. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  523. } else {
  524. /* 2D mouse packet */
  525. input_report_key(input, BTN_LEFT, data[8] & 0x04);
  526. input_report_key(input, BTN_MIDDLE, data[8] & 0x08);
  527. input_report_key(input, BTN_RIGHT, data[8] & 0x10);
  528. input_report_rel(input, REL_WHEEL, (data[8] & 0x01)
  529. - ((data[8] & 0x02) >> 1));
  530. /* I3 2D mouse side buttons */
  531. if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
  532. input_report_key(input, BTN_SIDE, data[8] & 0x40);
  533. input_report_key(input, BTN_EXTRA, data[8] & 0x20);
  534. }
  535. }
  536. } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
  537. features->type == INTUOS4L) &&
  538. wacom->tool[idx] == BTN_TOOL_LENS) {
  539. /* Lens cursor packets */
  540. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  541. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  542. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  543. input_report_key(input, BTN_SIDE, data[8] & 0x10);
  544. input_report_key(input, BTN_EXTRA, data[8] & 0x08);
  545. }
  546. }
  547. input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */
  548. input_report_key(input, wacom->tool[idx], 1);
  549. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  550. return 1;
  551. }
  552. static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx)
  553. {
  554. struct input_dev *input = wacom->input;
  555. input_report_abs(input, ABS_X,
  556. data[2 + idx * 2] | ((data[3 + idx * 2] & 0x7f) << 8));
  557. input_report_abs(input, ABS_Y,
  558. data[6 + idx * 2] | ((data[7 + idx * 2] & 0x7f) << 8));
  559. input_report_abs(input, ABS_MISC, wacom->id[0]);
  560. input_report_key(input, wacom->tool[idx], 1);
  561. if (idx)
  562. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  563. else
  564. input_report_key(input, BTN_TOUCH, 1);
  565. }
  566. static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx)
  567. {
  568. struct input_dev *input = wacom->input;
  569. input_report_abs(input, ABS_X, 0);
  570. input_report_abs(input, ABS_Y, 0);
  571. input_report_abs(input, ABS_MISC, 0);
  572. input_report_key(input, wacom->tool[idx], 0);
  573. if (idx)
  574. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  575. else
  576. input_report_key(input, BTN_TOUCH, 0);
  577. }
  578. static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
  579. {
  580. char *data = wacom->data;
  581. struct input_dev *input = wacom->input;
  582. struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
  583. static int firstFinger = 0;
  584. static int secondFinger = 0;
  585. wacom->tool[0] = BTN_TOOL_DOUBLETAP;
  586. wacom->id[0] = TOUCH_DEVICE_ID;
  587. wacom->tool[1] = BTN_TOOL_TRIPLETAP;
  588. if (urb->actual_length != WACOM_PKGLEN_TPC1FG) {
  589. switch (data[0]) {
  590. case WACOM_REPORT_TPC1FG:
  591. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
  592. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
  593. input_report_abs(input, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
  594. input_report_key(input, BTN_TOUCH, wacom_le16_to_cpu(&data[6]));
  595. input_report_abs(input, ABS_MISC, wacom->id[0]);
  596. input_report_key(input, wacom->tool[0], 1);
  597. break;
  598. case WACOM_REPORT_TPC2FG:
  599. /* keep this byte to send proper out-prox event */
  600. wacom->id[1] = data[1] & 0x03;
  601. if (data[1] & 0x01) {
  602. wacom_tpc_finger_in(wacom, wcombo, data, 0);
  603. firstFinger = 1;
  604. } else if (firstFinger) {
  605. wacom_tpc_touch_out(wacom, wcombo, 0);
  606. }
  607. if (data[1] & 0x02) {
  608. /* sync first finger data */
  609. if (firstFinger)
  610. input_sync(input);
  611. wacom_tpc_finger_in(wacom, wcombo, data, 1);
  612. secondFinger = 1;
  613. } else if (secondFinger) {
  614. /* sync first finger data */
  615. if (firstFinger)
  616. input_sync(input);
  617. wacom_tpc_touch_out(wacom, wcombo, 1);
  618. secondFinger = 0;
  619. }
  620. if (!(data[1] & 0x01))
  621. firstFinger = 0;
  622. break;
  623. }
  624. } else {
  625. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
  626. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
  627. input_report_key(input, BTN_TOUCH, 1);
  628. input_report_abs(input, ABS_MISC, wacom->id[0]);
  629. input_report_key(input, wacom->tool[0], 1);
  630. }
  631. }
  632. static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
  633. {
  634. struct wacom_features *features = &wacom->features;
  635. char *data = wacom->data;
  636. struct input_dev *input = wacom->input;
  637. int prox = 0, pressure, idx = -1;
  638. struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
  639. dbg("wacom_tpc_irq: received report #%d", data[0]);
  640. if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */
  641. data[0] == WACOM_REPORT_TPC1FG || /* single touch */
  642. data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
  643. if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */
  644. prox = data[0] & 0x01;
  645. } else { /* with capacity */
  646. if (data[0] == WACOM_REPORT_TPC1FG)
  647. /* single touch */
  648. prox = data[1] & 0x01;
  649. else
  650. /* 2FG touch data */
  651. prox = data[1] & 0x03;
  652. }
  653. if (!wacom->shared->stylus_in_proximity) {
  654. if (prox) {
  655. wacom_tpc_touch_in(wacom, wcombo);
  656. } else {
  657. if (data[0] == WACOM_REPORT_TPC2FG) {
  658. /* 2FGT out-prox */
  659. idx = (wacom->id[1] & 0x01) - 1;
  660. if (idx == 0) {
  661. wacom_tpc_touch_out(wacom, wcombo, idx);
  662. /* sync first finger event */
  663. if (wacom->id[1] & 0x02)
  664. input_sync(input);
  665. }
  666. idx = (wacom->id[1] & 0x02) - 1;
  667. if (idx == 1)
  668. wacom_tpc_touch_out(wacom, wcombo, idx);
  669. } else {
  670. /* one finger touch */
  671. wacom_tpc_touch_out(wacom, wcombo, 0);
  672. }
  673. wacom->id[0] = 0;
  674. }
  675. } else if (wacom->id[0]) { /* force touch out-prox */
  676. wacom_tpc_touch_out(wacom, wcombo, 0);
  677. }
  678. return 1;
  679. } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
  680. prox = data[1] & 0x20;
  681. if (!wacom->id[0]) { /* first in prox */
  682. /* Going into proximity select tool */
  683. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  684. if (wacom->tool[0] == BTN_TOOL_PEN)
  685. wacom->id[0] = STYLUS_DEVICE_ID;
  686. else
  687. wacom->id[0] = ERASER_DEVICE_ID;
  688. wacom->shared->stylus_in_proximity = true;
  689. }
  690. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  691. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  692. input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
  693. input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
  694. pressure = ((data[7] & 0x01) << 8) | data[6];
  695. if (pressure < 0)
  696. pressure = features->pressure_max + pressure + 1;
  697. input_report_abs(input, ABS_PRESSURE, pressure);
  698. input_report_key(input, BTN_TOUCH, data[1] & 0x05);
  699. if (!prox) { /* out-prox */
  700. wacom->id[0] = 0;
  701. wacom->shared->stylus_in_proximity = false;
  702. }
  703. input_report_key(input, wacom->tool[0], prox);
  704. input_report_abs(input, ABS_MISC, wacom->id[0]);
  705. return 1;
  706. }
  707. return 0;
  708. }
  709. int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
  710. {
  711. switch (wacom_wac->features.type) {
  712. case PENPARTNER:
  713. return wacom_penpartner_irq(wacom_wac, wcombo);
  714. case PL:
  715. return wacom_pl_irq(wacom_wac, wcombo);
  716. case WACOM_G4:
  717. case GRAPHIRE:
  718. case WACOM_MO:
  719. return wacom_graphire_irq(wacom_wac, wcombo);
  720. case PTU:
  721. return wacom_ptu_irq(wacom_wac, wcombo);
  722. case INTUOS:
  723. case INTUOS3S:
  724. case INTUOS3:
  725. case INTUOS3L:
  726. case INTUOS4S:
  727. case INTUOS4:
  728. case INTUOS4L:
  729. case CINTIQ:
  730. case WACOM_BEE:
  731. return wacom_intuos_irq(wacom_wac, wcombo);
  732. case TABLETPC:
  733. case TABLETPC2FG:
  734. return wacom_tpc_irq(wacom_wac, wcombo);
  735. default:
  736. return 0;
  737. }
  738. return 0;
  739. }
  740. static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
  741. {
  742. struct input_dev *input_dev = wacom_wac->input;
  743. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  744. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  745. __set_bit(BTN_LEFT, input_dev->keybit);
  746. __set_bit(BTN_RIGHT, input_dev->keybit);
  747. __set_bit(BTN_MIDDLE, input_dev->keybit);
  748. __set_bit(BTN_SIDE, input_dev->keybit);
  749. __set_bit(BTN_EXTRA, input_dev->keybit);
  750. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  751. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  752. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  753. __set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
  754. __set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
  755. __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
  756. __set_bit(BTN_TOOL_LENS, input_dev->keybit);
  757. __set_bit(BTN_STYLUS, input_dev->keybit);
  758. __set_bit(BTN_STYLUS2, input_dev->keybit);
  759. input_set_abs_params(input_dev, ABS_DISTANCE,
  760. 0, wacom_wac->features.distance_max, 0, 0);
  761. input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
  762. input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
  763. input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
  764. input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
  765. input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
  766. }
  767. void wacom_setup_input_capabilities(struct input_dev *input_dev,
  768. struct wacom_wac *wacom_wac)
  769. {
  770. struct wacom_features *features = &wacom_wac->features;
  771. int i;
  772. input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
  773. __set_bit(BTN_TOUCH, input_dev->keybit);
  774. input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 4, 0);
  775. input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0);
  776. input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0);
  777. __set_bit(ABS_MISC, input_dev->absbit);
  778. switch (wacom_wac->features.type) {
  779. case WACOM_MO:
  780. __set_bit(BTN_1, input_dev->keybit);
  781. __set_bit(BTN_5, input_dev->keybit);
  782. input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
  783. /* fall through */
  784. case WACOM_G4:
  785. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  786. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  787. __set_bit(BTN_0, input_dev->keybit);
  788. __set_bit(BTN_4, input_dev->keybit);
  789. /* fall through */
  790. case GRAPHIRE:
  791. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  792. __set_bit(BTN_LEFT, input_dev->keybit);
  793. __set_bit(BTN_RIGHT, input_dev->keybit);
  794. __set_bit(BTN_MIDDLE, input_dev->keybit);
  795. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  796. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  797. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  798. __set_bit(BTN_STYLUS, input_dev->keybit);
  799. __set_bit(BTN_STYLUS2, input_dev->keybit);
  800. break;
  801. case WACOM_BEE:
  802. __set_bit(BTN_8, input_dev->keybit);
  803. __set_bit(BTN_9, input_dev->keybit);
  804. /* fall through */
  805. case INTUOS3:
  806. case INTUOS3L:
  807. case CINTIQ:
  808. __set_bit(BTN_4, input_dev->keybit);
  809. __set_bit(BTN_5, input_dev->keybit);
  810. __set_bit(BTN_6, input_dev->keybit);
  811. __set_bit(BTN_7, input_dev->keybit);
  812. input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
  813. /* fall through */
  814. case INTUOS3S:
  815. __set_bit(BTN_0, input_dev->keybit);
  816. __set_bit(BTN_1, input_dev->keybit);
  817. __set_bit(BTN_2, input_dev->keybit);
  818. __set_bit(BTN_3, input_dev->keybit);
  819. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  820. input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
  821. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  822. /* fall through */
  823. case INTUOS:
  824. wacom_setup_intuos(wacom_wac);
  825. break;
  826. case INTUOS4:
  827. case INTUOS4L:
  828. __set_bit(BTN_7, input_dev->keybit);
  829. __set_bit(BTN_8, input_dev->keybit);
  830. /* fall through */
  831. case INTUOS4S:
  832. for (i = 0; i < 7; i++)
  833. __set_bit(BTN_0 + i, input_dev->keybit);
  834. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  835. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  836. wacom_setup_intuos(wacom_wac);
  837. break;
  838. case TABLETPC2FG:
  839. if (features->device_type == BTN_TOOL_TRIPLETAP) {
  840. __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
  841. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  842. }
  843. /* fall through */
  844. case TABLETPC:
  845. if (features->device_type == BTN_TOOL_DOUBLETAP ||
  846. features->device_type == BTN_TOOL_TRIPLETAP) {
  847. input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
  848. input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
  849. __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
  850. }
  851. if (features->device_type != BTN_TOOL_PEN)
  852. break; /* no need to process stylus stuff */
  853. /* fall through */
  854. case PL:
  855. case PTU:
  856. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  857. __set_bit(BTN_STYLUS, input_dev->keybit);
  858. __set_bit(BTN_STYLUS2, input_dev->keybit);
  859. /* fall through */
  860. case PENPARTNER:
  861. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  862. break;
  863. }
  864. }
  865. static const struct wacom_features wacom_features_0x00 =
  866. { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER };
  867. static const struct wacom_features wacom_features_0x10 =
  868. { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  869. static const struct wacom_features wacom_features_0x11 =
  870. { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  871. static const struct wacom_features wacom_features_0x12 =
  872. { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE };
  873. static const struct wacom_features wacom_features_0x13 =
  874. { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE };
  875. static const struct wacom_features wacom_features_0x14 =
  876. { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  877. static const struct wacom_features wacom_features_0x15 =
  878. { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 };
  879. static const struct wacom_features wacom_features_0x16 =
  880. { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 };
  881. static const struct wacom_features wacom_features_0x17 =
  882. { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  883. static const struct wacom_features wacom_features_0x18 =
  884. { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO };
  885. static const struct wacom_features wacom_features_0x19 =
  886. { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  887. static const struct wacom_features wacom_features_0x60 =
  888. { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  889. static const struct wacom_features wacom_features_0x61 =
  890. { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE };
  891. static const struct wacom_features wacom_features_0x62 =
  892. { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  893. static const struct wacom_features wacom_features_0x63 =
  894. { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE };
  895. static const struct wacom_features wacom_features_0x64 =
  896. { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE };
  897. static const struct wacom_features wacom_features_0x65 =
  898. { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  899. static const struct wacom_features wacom_features_0x69 =
  900. { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  901. static const struct wacom_features wacom_features_0x20 =
  902. { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  903. static const struct wacom_features wacom_features_0x21 =
  904. { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  905. static const struct wacom_features wacom_features_0x22 =
  906. { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  907. static const struct wacom_features wacom_features_0x23 =
  908. { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  909. static const struct wacom_features wacom_features_0x24 =
  910. { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  911. static const struct wacom_features wacom_features_0x30 =
  912. { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL };
  913. static const struct wacom_features wacom_features_0x31 =
  914. { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL };
  915. static const struct wacom_features wacom_features_0x32 =
  916. { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL };
  917. static const struct wacom_features wacom_features_0x33 =
  918. { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL };
  919. static const struct wacom_features wacom_features_0x34 =
  920. { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL };
  921. static const struct wacom_features wacom_features_0x35 =
  922. { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL };
  923. static const struct wacom_features wacom_features_0x37 =
  924. { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL };
  925. static const struct wacom_features wacom_features_0x38 =
  926. { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  927. static const struct wacom_features wacom_features_0x39 =
  928. { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL };
  929. static const struct wacom_features wacom_features_0xC4 =
  930. { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  931. static const struct wacom_features wacom_features_0xC0 =
  932. { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  933. static const struct wacom_features wacom_features_0xC2 =
  934. { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  935. static const struct wacom_features wacom_features_0x03 =
  936. { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU };
  937. static const struct wacom_features wacom_features_0x41 =
  938. { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  939. static const struct wacom_features wacom_features_0x42 =
  940. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  941. static const struct wacom_features wacom_features_0x43 =
  942. { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  943. static const struct wacom_features wacom_features_0x44 =
  944. { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  945. static const struct wacom_features wacom_features_0x45 =
  946. { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  947. static const struct wacom_features wacom_features_0xB0 =
  948. { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S };
  949. static const struct wacom_features wacom_features_0xB1 =
  950. { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 };
  951. static const struct wacom_features wacom_features_0xB2 =
  952. { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 };
  953. static const struct wacom_features wacom_features_0xB3 =
  954. { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L };
  955. static const struct wacom_features wacom_features_0xB4 =
  956. { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L };
  957. static const struct wacom_features wacom_features_0xB5 =
  958. { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 };
  959. static const struct wacom_features wacom_features_0xB7 =
  960. { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S };
  961. static const struct wacom_features wacom_features_0xB8 =
  962. { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S };
  963. static const struct wacom_features wacom_features_0xB9 =
  964. { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 };
  965. static const struct wacom_features wacom_features_0xBA =
  966. { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L };
  967. static const struct wacom_features wacom_features_0xBB =
  968. { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L };
  969. static const struct wacom_features wacom_features_0x3F =
  970. { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ };
  971. static const struct wacom_features wacom_features_0xC5 =
  972. { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE };
  973. static const struct wacom_features wacom_features_0xC6 =
  974. { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE };
  975. static const struct wacom_features wacom_features_0xC7 =
  976. { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL };
  977. static const struct wacom_features wacom_features_0x90 =
  978. { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  979. static const struct wacom_features wacom_features_0x93 =
  980. { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  981. static const struct wacom_features wacom_features_0x9A =
  982. { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  983. static const struct wacom_features wacom_features_0x9F =
  984. { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  985. static const struct wacom_features wacom_features_0xE2 =
  986. { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  987. static const struct wacom_features wacom_features_0xE3 =
  988. { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  989. static const struct wacom_features wacom_features_0x47 =
  990. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  991. #define USB_DEVICE_WACOM(prod) \
  992. USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
  993. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  994. const struct usb_device_id wacom_ids[] = {
  995. { USB_DEVICE_WACOM(0x00) },
  996. { USB_DEVICE_WACOM(0x10) },
  997. { USB_DEVICE_WACOM(0x11) },
  998. { USB_DEVICE_WACOM(0x12) },
  999. { USB_DEVICE_WACOM(0x13) },
  1000. { USB_DEVICE_WACOM(0x14) },
  1001. { USB_DEVICE_WACOM(0x15) },
  1002. { USB_DEVICE_WACOM(0x16) },
  1003. { USB_DEVICE_WACOM(0x17) },
  1004. { USB_DEVICE_WACOM(0x18) },
  1005. { USB_DEVICE_WACOM(0x19) },
  1006. { USB_DEVICE_WACOM(0x60) },
  1007. { USB_DEVICE_WACOM(0x61) },
  1008. { USB_DEVICE_WACOM(0x62) },
  1009. { USB_DEVICE_WACOM(0x63) },
  1010. { USB_DEVICE_WACOM(0x64) },
  1011. { USB_DEVICE_WACOM(0x65) },
  1012. { USB_DEVICE_WACOM(0x69) },
  1013. { USB_DEVICE_WACOM(0x20) },
  1014. { USB_DEVICE_WACOM(0x21) },
  1015. { USB_DEVICE_WACOM(0x22) },
  1016. { USB_DEVICE_WACOM(0x23) },
  1017. { USB_DEVICE_WACOM(0x24) },
  1018. { USB_DEVICE_WACOM(0x30) },
  1019. { USB_DEVICE_WACOM(0x31) },
  1020. { USB_DEVICE_WACOM(0x32) },
  1021. { USB_DEVICE_WACOM(0x33) },
  1022. { USB_DEVICE_WACOM(0x34) },
  1023. { USB_DEVICE_WACOM(0x35) },
  1024. { USB_DEVICE_WACOM(0x37) },
  1025. { USB_DEVICE_WACOM(0x38) },
  1026. { USB_DEVICE_WACOM(0x39) },
  1027. { USB_DEVICE_WACOM(0xC4) },
  1028. { USB_DEVICE_WACOM(0xC0) },
  1029. { USB_DEVICE_WACOM(0xC2) },
  1030. { USB_DEVICE_WACOM(0x03) },
  1031. { USB_DEVICE_WACOM(0x41) },
  1032. { USB_DEVICE_WACOM(0x42) },
  1033. { USB_DEVICE_WACOM(0x43) },
  1034. { USB_DEVICE_WACOM(0x44) },
  1035. { USB_DEVICE_WACOM(0x45) },
  1036. { USB_DEVICE_WACOM(0xB0) },
  1037. { USB_DEVICE_WACOM(0xB1) },
  1038. { USB_DEVICE_WACOM(0xB2) },
  1039. { USB_DEVICE_WACOM(0xB3) },
  1040. { USB_DEVICE_WACOM(0xB4) },
  1041. { USB_DEVICE_WACOM(0xB5) },
  1042. { USB_DEVICE_WACOM(0xB7) },
  1043. { USB_DEVICE_WACOM(0xB8) },
  1044. { USB_DEVICE_WACOM(0xB9) },
  1045. { USB_DEVICE_WACOM(0xBA) },
  1046. { USB_DEVICE_WACOM(0xBB) },
  1047. { USB_DEVICE_WACOM(0x3F) },
  1048. { USB_DEVICE_WACOM(0xC5) },
  1049. { USB_DEVICE_WACOM(0xC6) },
  1050. { USB_DEVICE_WACOM(0xC7) },
  1051. { USB_DEVICE_WACOM(0x90) },
  1052. { USB_DEVICE_WACOM(0x93) },
  1053. { USB_DEVICE_WACOM(0x9A) },
  1054. { USB_DEVICE_WACOM(0x9F) },
  1055. { USB_DEVICE_WACOM(0xE2) },
  1056. { USB_DEVICE_WACOM(0xE3) },
  1057. { USB_DEVICE_WACOM(0x47) },
  1058. { }
  1059. };
  1060. MODULE_DEVICE_TABLE(usb, wacom_ids);