wacom_wac.c 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446
  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. #include <linux/input/mt.h>
  16. static int wacom_penpartner_irq(struct wacom_wac *wacom)
  17. {
  18. unsigned char *data = wacom->data;
  19. struct input_dev *input = wacom->input;
  20. switch (data[0]) {
  21. case 1:
  22. if (data[5] & 0x80) {
  23. wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  24. wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
  25. input_report_key(input, wacom->tool[0], 1);
  26. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  27. input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
  28. input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
  29. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  30. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127));
  31. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  32. } else {
  33. input_report_key(input, wacom->tool[0], 0);
  34. input_report_abs(input, ABS_MISC, 0); /* report tool id */
  35. input_report_abs(input, ABS_PRESSURE, -1);
  36. input_report_key(input, BTN_TOUCH, 0);
  37. }
  38. break;
  39. case 2:
  40. input_report_key(input, BTN_TOOL_PEN, 1);
  41. input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
  42. input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
  43. input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
  44. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  45. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
  46. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  47. break;
  48. default:
  49. printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]);
  50. return 0;
  51. }
  52. return 1;
  53. }
  54. static int wacom_pl_irq(struct wacom_wac *wacom)
  55. {
  56. struct wacom_features *features = &wacom->features;
  57. unsigned char *data = wacom->data;
  58. struct input_dev *input = wacom->input;
  59. int prox, pressure;
  60. if (data[0] != WACOM_REPORT_PENABLED) {
  61. dbg("wacom_pl_irq: received unknown report #%d", data[0]);
  62. return 0;
  63. }
  64. prox = data[1] & 0x40;
  65. if (prox) {
  66. wacom->id[0] = ERASER_DEVICE_ID;
  67. pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
  68. if (features->pressure_max > 255)
  69. pressure = (pressure << 1) | ((data[4] >> 6) & 1);
  70. pressure += (features->pressure_max + 1) / 2;
  71. /*
  72. * if going from out of proximity into proximity select between the eraser
  73. * and the pen based on the state of the stylus2 button, choose eraser if
  74. * pressed else choose pen. if not a proximity change from out to in, send
  75. * an out of proximity for previous tool then a in for new tool.
  76. */
  77. if (!wacom->tool[0]) {
  78. /* Eraser bit set for DTF */
  79. if (data[1] & 0x10)
  80. wacom->tool[1] = BTN_TOOL_RUBBER;
  81. else
  82. /* Going into proximity select tool */
  83. wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  84. } else {
  85. /* was entered with stylus2 pressed */
  86. if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
  87. /* report out proximity for previous tool */
  88. input_report_key(input, wacom->tool[1], 0);
  89. input_sync(input);
  90. wacom->tool[1] = BTN_TOOL_PEN;
  91. return 0;
  92. }
  93. }
  94. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  95. /* Unknown tool selected default to pen tool */
  96. wacom->tool[1] = BTN_TOOL_PEN;
  97. wacom->id[0] = STYLUS_DEVICE_ID;
  98. }
  99. input_report_key(input, wacom->tool[1], prox); /* report in proximity for tool */
  100. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  101. input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
  102. input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
  103. input_report_abs(input, ABS_PRESSURE, pressure);
  104. input_report_key(input, BTN_TOUCH, data[4] & 0x08);
  105. input_report_key(input, BTN_STYLUS, data[4] & 0x10);
  106. /* Only allow the stylus2 button to be reported for the pen tool. */
  107. input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
  108. } else {
  109. /* report proximity-out of a (valid) tool */
  110. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  111. /* Unknown tool selected default to pen tool */
  112. wacom->tool[1] = BTN_TOOL_PEN;
  113. }
  114. input_report_key(input, wacom->tool[1], prox);
  115. }
  116. wacom->tool[0] = prox; /* Save proximity state */
  117. return 1;
  118. }
  119. static int wacom_ptu_irq(struct wacom_wac *wacom)
  120. {
  121. unsigned char *data = wacom->data;
  122. struct input_dev *input = wacom->input;
  123. if (data[0] != WACOM_REPORT_PENABLED) {
  124. printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
  125. return 0;
  126. }
  127. if (data[1] & 0x04) {
  128. input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20);
  129. input_report_key(input, BTN_TOUCH, data[1] & 0x08);
  130. wacom->id[0] = ERASER_DEVICE_ID;
  131. } else {
  132. input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20);
  133. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  134. wacom->id[0] = STYLUS_DEVICE_ID;
  135. }
  136. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  137. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  138. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  139. input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6]));
  140. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  141. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  142. return 1;
  143. }
  144. static int wacom_dtu_irq(struct wacom_wac *wacom)
  145. {
  146. struct wacom_features *features = &wacom->features;
  147. char *data = wacom->data;
  148. struct input_dev *input = wacom->input;
  149. int prox = data[1] & 0x20, pressure;
  150. dbg("wacom_dtu_irq: received report #%d", data[0]);
  151. if (prox) {
  152. /* Going into proximity select tool */
  153. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  154. if (wacom->tool[0] == BTN_TOOL_PEN)
  155. wacom->id[0] = STYLUS_DEVICE_ID;
  156. else
  157. wacom->id[0] = ERASER_DEVICE_ID;
  158. }
  159. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  160. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  161. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  162. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  163. pressure = ((data[7] & 0x01) << 8) | data[6];
  164. if (pressure < 0)
  165. pressure = features->pressure_max + pressure + 1;
  166. input_report_abs(input, ABS_PRESSURE, pressure);
  167. input_report_key(input, BTN_TOUCH, data[1] & 0x05);
  168. if (!prox) /* out-prox */
  169. wacom->id[0] = 0;
  170. input_report_key(input, wacom->tool[0], prox);
  171. input_report_abs(input, ABS_MISC, wacom->id[0]);
  172. return 1;
  173. }
  174. static int wacom_graphire_irq(struct wacom_wac *wacom)
  175. {
  176. struct wacom_features *features = &wacom->features;
  177. unsigned char *data = wacom->data;
  178. struct input_dev *input = wacom->input;
  179. int prox;
  180. int rw = 0;
  181. int retval = 0;
  182. if (data[0] != WACOM_REPORT_PENABLED) {
  183. dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
  184. goto exit;
  185. }
  186. prox = data[1] & 0x80;
  187. if (prox || wacom->id[0]) {
  188. if (prox) {
  189. switch ((data[1] >> 5) & 3) {
  190. case 0: /* Pen */
  191. wacom->tool[0] = BTN_TOOL_PEN;
  192. wacom->id[0] = STYLUS_DEVICE_ID;
  193. break;
  194. case 1: /* Rubber */
  195. wacom->tool[0] = BTN_TOOL_RUBBER;
  196. wacom->id[0] = ERASER_DEVICE_ID;
  197. break;
  198. case 2: /* Mouse with wheel */
  199. input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
  200. /* fall through */
  201. case 3: /* Mouse without wheel */
  202. wacom->tool[0] = BTN_TOOL_MOUSE;
  203. wacom->id[0] = CURSOR_DEVICE_ID;
  204. break;
  205. }
  206. }
  207. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  208. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  209. if (wacom->tool[0] != BTN_TOOL_MOUSE) {
  210. input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
  211. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  212. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  213. input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
  214. } else {
  215. input_report_key(input, BTN_LEFT, data[1] & 0x01);
  216. input_report_key(input, BTN_RIGHT, data[1] & 0x02);
  217. if (features->type == WACOM_G4 ||
  218. features->type == WACOM_MO) {
  219. input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f);
  220. rw = (data[7] & 0x04) - (data[7] & 0x03);
  221. } else {
  222. input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f);
  223. rw = -(signed char)data[6];
  224. }
  225. input_report_rel(input, REL_WHEEL, rw);
  226. }
  227. if (!prox)
  228. wacom->id[0] = 0;
  229. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  230. input_report_key(input, wacom->tool[0], prox);
  231. input_sync(input); /* sync last event */
  232. }
  233. /* send pad data */
  234. switch (features->type) {
  235. case WACOM_G4:
  236. prox = data[7] & 0xf8;
  237. if (prox || wacom->id[1]) {
  238. wacom->id[1] = PAD_DEVICE_ID;
  239. input_report_key(input, BTN_0, (data[7] & 0x40));
  240. input_report_key(input, BTN_4, (data[7] & 0x80));
  241. rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
  242. input_report_rel(input, REL_WHEEL, rw);
  243. input_report_key(input, BTN_TOOL_FINGER, 0xf0);
  244. if (!prox)
  245. wacom->id[1] = 0;
  246. input_report_abs(input, ABS_MISC, wacom->id[1]);
  247. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  248. retval = 1;
  249. }
  250. break;
  251. case WACOM_MO:
  252. prox = (data[7] & 0xf8) || data[8];
  253. if (prox || wacom->id[1]) {
  254. wacom->id[1] = PAD_DEVICE_ID;
  255. input_report_key(input, BTN_0, (data[7] & 0x08));
  256. input_report_key(input, BTN_1, (data[7] & 0x20));
  257. input_report_key(input, BTN_4, (data[7] & 0x10));
  258. input_report_key(input, BTN_5, (data[7] & 0x40));
  259. input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f));
  260. input_report_key(input, BTN_TOOL_FINGER, 0xf0);
  261. if (!prox)
  262. wacom->id[1] = 0;
  263. input_report_abs(input, ABS_MISC, wacom->id[1]);
  264. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  265. }
  266. retval = 1;
  267. break;
  268. }
  269. exit:
  270. return retval;
  271. }
  272. static int wacom_intuos_inout(struct wacom_wac *wacom)
  273. {
  274. struct wacom_features *features = &wacom->features;
  275. unsigned char *data = wacom->data;
  276. struct input_dev *input = wacom->input;
  277. int idx = 0;
  278. /* tool number */
  279. if (features->type == INTUOS)
  280. idx = data[1] & 0x01;
  281. /* Enter report */
  282. if ((data[1] & 0xfc) == 0xc0) {
  283. /* serial number of the tool */
  284. wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
  285. (data[4] << 20) + (data[5] << 12) +
  286. (data[6] << 4) + (data[7] >> 4);
  287. wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
  288. ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12);
  289. switch (wacom->id[idx] & 0xfffff) {
  290. case 0x812: /* Inking pen */
  291. case 0x801: /* Intuos3 Inking pen */
  292. case 0x20802: /* Intuos4 Inking Pen */
  293. case 0x012:
  294. wacom->tool[idx] = BTN_TOOL_PENCIL;
  295. break;
  296. case 0x822: /* Pen */
  297. case 0x842:
  298. case 0x852:
  299. case 0x823: /* Intuos3 Grip Pen */
  300. case 0x813: /* Intuos3 Classic Pen */
  301. case 0x885: /* Intuos3 Marker Pen */
  302. case 0x802: /* Intuos4 General Pen */
  303. case 0x804: /* Intuos4 Marker Pen */
  304. case 0x40802: /* Intuos4 Classic Pen */
  305. case 0x022:
  306. wacom->tool[idx] = BTN_TOOL_PEN;
  307. break;
  308. case 0x832: /* Stroke pen */
  309. case 0x032:
  310. wacom->tool[idx] = BTN_TOOL_BRUSH;
  311. break;
  312. case 0x007: /* Mouse 4D and 2D */
  313. case 0x09c:
  314. case 0x094:
  315. case 0x017: /* Intuos3 2D Mouse */
  316. case 0x806: /* Intuos4 Mouse */
  317. wacom->tool[idx] = BTN_TOOL_MOUSE;
  318. break;
  319. case 0x096: /* Lens cursor */
  320. case 0x097: /* Intuos3 Lens cursor */
  321. case 0x006: /* Intuos4 Lens cursor */
  322. wacom->tool[idx] = BTN_TOOL_LENS;
  323. break;
  324. case 0x82a: /* Eraser */
  325. case 0x85a:
  326. case 0x91a:
  327. case 0xd1a:
  328. case 0x0fa:
  329. case 0x82b: /* Intuos3 Grip Pen Eraser */
  330. case 0x81b: /* Intuos3 Classic Pen Eraser */
  331. case 0x91b: /* Intuos3 Airbrush Eraser */
  332. case 0x80c: /* Intuos4 Marker Pen Eraser */
  333. case 0x80a: /* Intuos4 General Pen Eraser */
  334. case 0x4080a: /* Intuos4 Classic Pen Eraser */
  335. case 0x90a: /* Intuos4 Airbrush Eraser */
  336. wacom->tool[idx] = BTN_TOOL_RUBBER;
  337. break;
  338. case 0xd12:
  339. case 0x912:
  340. case 0x112:
  341. case 0x913: /* Intuos3 Airbrush */
  342. case 0x902: /* Intuos4 Airbrush */
  343. wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
  344. break;
  345. default: /* Unknown tool */
  346. wacom->tool[idx] = BTN_TOOL_PEN;
  347. break;
  348. }
  349. return 1;
  350. }
  351. /* older I4 styli don't work with new Cintiqs */
  352. if (!((wacom->id[idx] >> 20) & 0x01) &&
  353. (features->type == WACOM_21UX2))
  354. return 1;
  355. /* Exit report */
  356. if ((data[1] & 0xfe) == 0x80) {
  357. /*
  358. * Reset all states otherwise we lose the initial states
  359. * when in-prox next time
  360. */
  361. input_report_abs(input, ABS_X, 0);
  362. input_report_abs(input, ABS_Y, 0);
  363. input_report_abs(input, ABS_DISTANCE, 0);
  364. input_report_abs(input, ABS_TILT_X, 0);
  365. input_report_abs(input, ABS_TILT_Y, 0);
  366. if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
  367. input_report_key(input, BTN_LEFT, 0);
  368. input_report_key(input, BTN_MIDDLE, 0);
  369. input_report_key(input, BTN_RIGHT, 0);
  370. input_report_key(input, BTN_SIDE, 0);
  371. input_report_key(input, BTN_EXTRA, 0);
  372. input_report_abs(input, ABS_THROTTLE, 0);
  373. input_report_abs(input, ABS_RZ, 0);
  374. } else {
  375. input_report_abs(input, ABS_PRESSURE, 0);
  376. input_report_key(input, BTN_STYLUS, 0);
  377. input_report_key(input, BTN_STYLUS2, 0);
  378. input_report_key(input, BTN_TOUCH, 0);
  379. input_report_abs(input, ABS_WHEEL, 0);
  380. if (features->type >= INTUOS3S)
  381. input_report_abs(input, ABS_Z, 0);
  382. }
  383. input_report_key(input, wacom->tool[idx], 0);
  384. input_report_abs(input, ABS_MISC, 0); /* reset tool id */
  385. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  386. wacom->id[idx] = 0;
  387. return 2;
  388. }
  389. return 0;
  390. }
  391. static void wacom_intuos_general(struct wacom_wac *wacom)
  392. {
  393. struct wacom_features *features = &wacom->features;
  394. unsigned char *data = wacom->data;
  395. struct input_dev *input = wacom->input;
  396. unsigned int t;
  397. /* general pen packet */
  398. if ((data[1] & 0xb8) == 0xa0) {
  399. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  400. if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
  401. features->type == WACOM_21UX2) {
  402. t = (t << 1) | (data[1] & 1);
  403. }
  404. input_report_abs(input, ABS_PRESSURE, t);
  405. input_report_abs(input, ABS_TILT_X,
  406. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  407. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  408. input_report_key(input, BTN_STYLUS, data[1] & 2);
  409. input_report_key(input, BTN_STYLUS2, data[1] & 4);
  410. input_report_key(input, BTN_TOUCH, t > 10);
  411. }
  412. /* airbrush second packet */
  413. if ((data[1] & 0xbc) == 0xb4) {
  414. input_report_abs(input, ABS_WHEEL,
  415. (data[6] << 2) | ((data[7] >> 6) & 3));
  416. input_report_abs(input, ABS_TILT_X,
  417. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  418. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  419. }
  420. }
  421. static int wacom_intuos_irq(struct wacom_wac *wacom)
  422. {
  423. struct wacom_features *features = &wacom->features;
  424. unsigned char *data = wacom->data;
  425. struct input_dev *input = wacom->input;
  426. unsigned int t;
  427. int idx = 0, result;
  428. if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD
  429. && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) {
  430. dbg("wacom_intuos_irq: received unknown report #%d", data[0]);
  431. return 0;
  432. }
  433. /* tool number */
  434. if (features->type == INTUOS)
  435. idx = data[1] & 0x01;
  436. /* pad packets. Works as a second tool and is always in prox */
  437. if (data[0] == WACOM_REPORT_INTUOSPAD) {
  438. /* initiate the pad as a device */
  439. if (wacom->tool[1] != BTN_TOOL_FINGER)
  440. wacom->tool[1] = BTN_TOOL_FINGER;
  441. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  442. input_report_key(input, BTN_0, (data[2] & 0x01));
  443. input_report_key(input, BTN_1, (data[3] & 0x01));
  444. input_report_key(input, BTN_2, (data[3] & 0x02));
  445. input_report_key(input, BTN_3, (data[3] & 0x04));
  446. input_report_key(input, BTN_4, (data[3] & 0x08));
  447. input_report_key(input, BTN_5, (data[3] & 0x10));
  448. input_report_key(input, BTN_6, (data[3] & 0x20));
  449. if (data[1] & 0x80) {
  450. input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
  451. } else {
  452. /* Out of proximity, clear wheel value. */
  453. input_report_abs(input, ABS_WHEEL, 0);
  454. }
  455. if (features->type != INTUOS4S) {
  456. input_report_key(input, BTN_7, (data[3] & 0x40));
  457. input_report_key(input, BTN_8, (data[3] & 0x80));
  458. }
  459. if (data[1] | (data[2] & 0x01) | data[3]) {
  460. input_report_key(input, wacom->tool[1], 1);
  461. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  462. } else {
  463. input_report_key(input, wacom->tool[1], 0);
  464. input_report_abs(input, ABS_MISC, 0);
  465. }
  466. } else {
  467. if (features->type == WACOM_21UX2) {
  468. input_report_key(input, BTN_0, (data[5] & 0x01));
  469. input_report_key(input, BTN_1, (data[6] & 0x01));
  470. input_report_key(input, BTN_2, (data[6] & 0x02));
  471. input_report_key(input, BTN_3, (data[6] & 0x04));
  472. input_report_key(input, BTN_4, (data[6] & 0x08));
  473. input_report_key(input, BTN_5, (data[6] & 0x10));
  474. input_report_key(input, BTN_6, (data[6] & 0x20));
  475. input_report_key(input, BTN_7, (data[6] & 0x40));
  476. input_report_key(input, BTN_8, (data[6] & 0x80));
  477. input_report_key(input, BTN_9, (data[7] & 0x01));
  478. input_report_key(input, BTN_A, (data[8] & 0x01));
  479. input_report_key(input, BTN_B, (data[8] & 0x02));
  480. input_report_key(input, BTN_C, (data[8] & 0x04));
  481. input_report_key(input, BTN_X, (data[8] & 0x08));
  482. input_report_key(input, BTN_Y, (data[8] & 0x10));
  483. input_report_key(input, BTN_Z, (data[8] & 0x20));
  484. input_report_key(input, BTN_BASE, (data[8] & 0x40));
  485. input_report_key(input, BTN_BASE2, (data[8] & 0x80));
  486. } else {
  487. input_report_key(input, BTN_0, (data[5] & 0x01));
  488. input_report_key(input, BTN_1, (data[5] & 0x02));
  489. input_report_key(input, BTN_2, (data[5] & 0x04));
  490. input_report_key(input, BTN_3, (data[5] & 0x08));
  491. input_report_key(input, BTN_4, (data[6] & 0x01));
  492. input_report_key(input, BTN_5, (data[6] & 0x02));
  493. input_report_key(input, BTN_6, (data[6] & 0x04));
  494. input_report_key(input, BTN_7, (data[6] & 0x08));
  495. input_report_key(input, BTN_8, (data[5] & 0x10));
  496. input_report_key(input, BTN_9, (data[6] & 0x10));
  497. }
  498. input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
  499. input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
  500. if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) |
  501. data[2] | (data[3] & 0x1f) | data[4] | data[8] |
  502. (data[7] & 0x01)) {
  503. input_report_key(input, wacom->tool[1], 1);
  504. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  505. } else {
  506. input_report_key(input, wacom->tool[1], 0);
  507. input_report_abs(input, ABS_MISC, 0);
  508. }
  509. }
  510. input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
  511. return 1;
  512. }
  513. /* process in/out prox events */
  514. result = wacom_intuos_inout(wacom);
  515. if (result)
  516. return result - 1;
  517. /* don't proceed if we don't know the ID */
  518. if (!wacom->id[idx])
  519. return 0;
  520. /* Only large Intuos support Lense Cursor */
  521. if (wacom->tool[idx] == BTN_TOOL_LENS &&
  522. (features->type == INTUOS3 ||
  523. features->type == INTUOS3S ||
  524. features->type == INTUOS4 ||
  525. features->type == INTUOS4S)) {
  526. return 0;
  527. }
  528. /* Cintiq doesn't send data when RDY bit isn't set */
  529. if (features->type == CINTIQ && !(data[1] & 0x40))
  530. return 0;
  531. if (features->type >= INTUOS3S) {
  532. input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
  533. input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
  534. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
  535. } else {
  536. input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[2]));
  537. input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[4]));
  538. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
  539. }
  540. /* process general packets */
  541. wacom_intuos_general(wacom);
  542. /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
  543. if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
  544. if (data[1] & 0x02) {
  545. /* Rotation packet */
  546. if (features->type >= INTUOS3S) {
  547. /* I3 marker pen rotation */
  548. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  549. t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
  550. ((t-1) / 2 + 450)) : (450 - t / 2) ;
  551. input_report_abs(input, ABS_Z, t);
  552. } else {
  553. /* 4D mouse rotation packet */
  554. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  555. input_report_abs(input, ABS_RZ, (data[7] & 0x20) ?
  556. ((t - 1) / 2) : -t / 2);
  557. }
  558. } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
  559. /* 4D mouse packet */
  560. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  561. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  562. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  563. input_report_key(input, BTN_SIDE, data[8] & 0x20);
  564. input_report_key(input, BTN_EXTRA, data[8] & 0x10);
  565. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  566. input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
  567. } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
  568. /* I4 mouse */
  569. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  570. input_report_key(input, BTN_LEFT, data[6] & 0x01);
  571. input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
  572. input_report_key(input, BTN_RIGHT, data[6] & 0x04);
  573. input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7)
  574. - ((data[7] & 0x40) >> 6));
  575. input_report_key(input, BTN_SIDE, data[6] & 0x08);
  576. input_report_key(input, BTN_EXTRA, data[6] & 0x10);
  577. input_report_abs(input, ABS_TILT_X,
  578. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  579. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  580. } else {
  581. /* 2D mouse packet */
  582. input_report_key(input, BTN_LEFT, data[8] & 0x04);
  583. input_report_key(input, BTN_MIDDLE, data[8] & 0x08);
  584. input_report_key(input, BTN_RIGHT, data[8] & 0x10);
  585. input_report_rel(input, REL_WHEEL, (data[8] & 0x01)
  586. - ((data[8] & 0x02) >> 1));
  587. /* I3 2D mouse side buttons */
  588. if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
  589. input_report_key(input, BTN_SIDE, data[8] & 0x40);
  590. input_report_key(input, BTN_EXTRA, data[8] & 0x20);
  591. }
  592. }
  593. } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
  594. features->type == INTUOS4L) &&
  595. wacom->tool[idx] == BTN_TOOL_LENS) {
  596. /* Lens cursor packets */
  597. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  598. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  599. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  600. input_report_key(input, BTN_SIDE, data[8] & 0x10);
  601. input_report_key(input, BTN_EXTRA, data[8] & 0x08);
  602. }
  603. }
  604. input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */
  605. input_report_key(input, wacom->tool[idx], 1);
  606. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  607. return 1;
  608. }
  609. static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
  610. {
  611. char *data = wacom->data;
  612. struct input_dev *input = wacom->input;
  613. bool prox;
  614. int x = 0, y = 0;
  615. if (!wacom->shared->stylus_in_proximity) {
  616. if (len == WACOM_PKGLEN_TPC1FG) {
  617. prox = data[0] & 0x01;
  618. x = get_unaligned_le16(&data[1]);
  619. y = get_unaligned_le16(&data[3]);
  620. } else { /* with capacity */
  621. prox = data[1] & 0x01;
  622. x = le16_to_cpup((__le16 *)&data[2]);
  623. y = le16_to_cpup((__le16 *)&data[4]);
  624. }
  625. } else
  626. /* force touch out when pen is in prox */
  627. prox = 0;
  628. if (prox) {
  629. input_report_abs(input, ABS_X, x);
  630. input_report_abs(input, ABS_Y, y);
  631. }
  632. input_report_key(input, BTN_TOUCH, prox);
  633. /* keep touch state for pen events */
  634. wacom->shared->touch_down = prox;
  635. return 1;
  636. }
  637. static int wacom_tpc_pen(struct wacom_wac *wacom)
  638. {
  639. struct wacom_features *features = &wacom->features;
  640. char *data = wacom->data;
  641. struct input_dev *input = wacom->input;
  642. int pressure;
  643. bool prox = data[1] & 0x20;
  644. if (!wacom->shared->stylus_in_proximity) /* first in prox */
  645. /* Going into proximity select tool */
  646. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  647. /* keep pen state for touch events */
  648. wacom->shared->stylus_in_proximity = prox;
  649. /* send pen events only when touch is up or forced out */
  650. if (!wacom->shared->touch_down) {
  651. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  652. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  653. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  654. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  655. pressure = ((data[7] & 0x01) << 8) | data[6];
  656. if (pressure < 0)
  657. pressure = features->pressure_max + pressure + 1;
  658. input_report_abs(input, ABS_PRESSURE, pressure);
  659. input_report_key(input, BTN_TOUCH, data[1] & 0x05);
  660. input_report_key(input, wacom->tool[0], prox);
  661. return 1;
  662. }
  663. return 0;
  664. }
  665. static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
  666. {
  667. char *data = wacom->data;
  668. dbg("wacom_tpc_irq: received report #%d", data[0]);
  669. if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG)
  670. return wacom_tpc_single_touch(wacom, len);
  671. else if (data[0] == WACOM_REPORT_PENABLED)
  672. return wacom_tpc_pen(wacom);
  673. return 0;
  674. }
  675. static int wacom_bpt_touch(struct wacom_wac *wacom)
  676. {
  677. struct wacom_features *features = &wacom->features;
  678. struct input_dev *input = wacom->input;
  679. unsigned char *data = wacom->data;
  680. int i;
  681. for (i = 0; i < 2; i++) {
  682. int p = data[9 * i + 2];
  683. bool touch = p && !wacom->shared->stylus_in_proximity;
  684. input_mt_slot(input, i);
  685. input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
  686. /*
  687. * Touch events need to be disabled while stylus is
  688. * in proximity because user's hand is resting on touchpad
  689. * and sending unwanted events. User expects tablet buttons
  690. * to continue working though.
  691. */
  692. if (touch) {
  693. int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
  694. int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
  695. if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
  696. x <<= 5;
  697. y <<= 5;
  698. }
  699. input_report_abs(input, ABS_MT_PRESSURE, p);
  700. input_report_abs(input, ABS_MT_POSITION_X, x);
  701. input_report_abs(input, ABS_MT_POSITION_Y, y);
  702. }
  703. }
  704. input_mt_report_pointer_emulation(input, true);
  705. input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
  706. input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
  707. input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
  708. input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
  709. input_sync(input);
  710. return 0;
  711. }
  712. static int wacom_bpt_pen(struct wacom_wac *wacom)
  713. {
  714. struct input_dev *input = wacom->input;
  715. unsigned char *data = wacom->data;
  716. int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
  717. /*
  718. * Similar to Graphire protocol, data[1] & 0x20 is proximity and
  719. * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore
  720. * 2 unused tool ID's.
  721. */
  722. prox = (data[1] & 0x30) == 0x30;
  723. /*
  724. * All reports shared between PEN and RUBBER tool must be
  725. * forced to a known starting value (zero) when transitioning to
  726. * out-of-prox.
  727. *
  728. * If not reset then, to userspace, it will look like lost events
  729. * if new tool comes in-prox with same values as previous tool sent.
  730. *
  731. * Hardware does report zero in most out-of-prox cases but not all.
  732. */
  733. if (prox) {
  734. if (!wacom->shared->stylus_in_proximity) {
  735. if (data[1] & 0x08) {
  736. wacom->tool[0] = BTN_TOOL_RUBBER;
  737. wacom->id[0] = ERASER_DEVICE_ID;
  738. } else {
  739. wacom->tool[0] = BTN_TOOL_PEN;
  740. wacom->id[0] = STYLUS_DEVICE_ID;
  741. }
  742. wacom->shared->stylus_in_proximity = true;
  743. }
  744. x = le16_to_cpup((__le16 *)&data[2]);
  745. y = le16_to_cpup((__le16 *)&data[4]);
  746. p = le16_to_cpup((__le16 *)&data[6]);
  747. d = data[8];
  748. pen = data[1] & 0x01;
  749. btn1 = data[1] & 0x02;
  750. btn2 = data[1] & 0x04;
  751. }
  752. input_report_key(input, BTN_TOUCH, pen);
  753. input_report_key(input, BTN_STYLUS, btn1);
  754. input_report_key(input, BTN_STYLUS2, btn2);
  755. input_report_abs(input, ABS_X, x);
  756. input_report_abs(input, ABS_Y, y);
  757. input_report_abs(input, ABS_PRESSURE, p);
  758. input_report_abs(input, ABS_DISTANCE, d);
  759. if (!prox) {
  760. wacom->id[0] = 0;
  761. wacom->shared->stylus_in_proximity = false;
  762. }
  763. input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */
  764. input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
  765. return 1;
  766. }
  767. static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
  768. {
  769. if (len == WACOM_PKGLEN_BBTOUCH)
  770. return wacom_bpt_touch(wacom);
  771. else if (len == WACOM_PKGLEN_BBFUN)
  772. return wacom_bpt_pen(wacom);
  773. return 0;
  774. }
  775. void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
  776. {
  777. bool sync;
  778. switch (wacom_wac->features.type) {
  779. case PENPARTNER:
  780. sync = wacom_penpartner_irq(wacom_wac);
  781. break;
  782. case PL:
  783. sync = wacom_pl_irq(wacom_wac);
  784. break;
  785. case WACOM_G4:
  786. case GRAPHIRE:
  787. case WACOM_MO:
  788. sync = wacom_graphire_irq(wacom_wac);
  789. break;
  790. case PTU:
  791. sync = wacom_ptu_irq(wacom_wac);
  792. break;
  793. case DTU:
  794. sync = wacom_dtu_irq(wacom_wac);
  795. break;
  796. case INTUOS:
  797. case INTUOS3S:
  798. case INTUOS3:
  799. case INTUOS3L:
  800. case INTUOS4S:
  801. case INTUOS4:
  802. case INTUOS4L:
  803. case CINTIQ:
  804. case WACOM_BEE:
  805. case WACOM_21UX2:
  806. sync = wacom_intuos_irq(wacom_wac);
  807. break;
  808. case TABLETPC:
  809. case TABLETPC2FG:
  810. sync = wacom_tpc_irq(wacom_wac, len);
  811. break;
  812. case BAMBOO_PT:
  813. sync = wacom_bpt_irq(wacom_wac, len);
  814. break;
  815. default:
  816. sync = false;
  817. break;
  818. }
  819. if (sync)
  820. input_sync(wacom_wac->input);
  821. }
  822. static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
  823. {
  824. struct input_dev *input_dev = wacom_wac->input;
  825. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  826. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  827. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  828. __set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
  829. __set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
  830. __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
  831. __set_bit(BTN_STYLUS, input_dev->keybit);
  832. __set_bit(BTN_STYLUS2, input_dev->keybit);
  833. input_set_abs_params(input_dev, ABS_DISTANCE,
  834. 0, wacom_wac->features.distance_max, 0, 0);
  835. input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
  836. input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
  837. input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
  838. }
  839. static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
  840. {
  841. struct input_dev *input_dev = wacom_wac->input;
  842. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  843. wacom_setup_cintiq(wacom_wac);
  844. __set_bit(BTN_LEFT, input_dev->keybit);
  845. __set_bit(BTN_RIGHT, input_dev->keybit);
  846. __set_bit(BTN_MIDDLE, input_dev->keybit);
  847. __set_bit(BTN_SIDE, input_dev->keybit);
  848. __set_bit(BTN_EXTRA, input_dev->keybit);
  849. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  850. __set_bit(BTN_TOOL_LENS, input_dev->keybit);
  851. input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
  852. input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
  853. }
  854. void wacom_setup_device_quirks(struct wacom_features *features)
  855. {
  856. /* touch device found but size is not defined. use default */
  857. if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
  858. features->x_max = 1023;
  859. features->y_max = 1023;
  860. }
  861. /* these device have multiple inputs */
  862. if (features->type == TABLETPC || features->type == TABLETPC2FG ||
  863. features->type == BAMBOO_PT)
  864. features->quirks |= WACOM_QUIRK_MULTI_INPUT;
  865. /* quirks for bamboo touch */
  866. if (features->type == BAMBOO_PT &&
  867. features->device_type == BTN_TOOL_TRIPLETAP) {
  868. features->x_max <<= 5;
  869. features->y_max <<= 5;
  870. features->x_fuzz <<= 5;
  871. features->y_fuzz <<= 5;
  872. features->pressure_max = 256;
  873. features->pressure_fuzz = 16;
  874. features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
  875. }
  876. }
  877. static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
  878. unsigned int physical_max)
  879. {
  880. /* Touch physical dimensions are in 100th of mm */
  881. return (logical_max * 100) / physical_max;
  882. }
  883. void wacom_setup_input_capabilities(struct input_dev *input_dev,
  884. struct wacom_wac *wacom_wac)
  885. {
  886. struct wacom_features *features = &wacom_wac->features;
  887. int i;
  888. input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
  889. __set_bit(BTN_TOUCH, input_dev->keybit);
  890. input_set_abs_params(input_dev, ABS_X, 0, features->x_max,
  891. features->x_fuzz, 0);
  892. input_set_abs_params(input_dev, ABS_Y, 0, features->y_max,
  893. features->y_fuzz, 0);
  894. input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
  895. features->pressure_fuzz, 0);
  896. __set_bit(ABS_MISC, input_dev->absbit);
  897. switch (wacom_wac->features.type) {
  898. case WACOM_MO:
  899. __set_bit(BTN_1, input_dev->keybit);
  900. __set_bit(BTN_5, input_dev->keybit);
  901. input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
  902. /* fall through */
  903. case WACOM_G4:
  904. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  905. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  906. __set_bit(BTN_0, input_dev->keybit);
  907. __set_bit(BTN_4, input_dev->keybit);
  908. /* fall through */
  909. case GRAPHIRE:
  910. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  911. __set_bit(BTN_LEFT, input_dev->keybit);
  912. __set_bit(BTN_RIGHT, input_dev->keybit);
  913. __set_bit(BTN_MIDDLE, input_dev->keybit);
  914. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  915. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  916. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  917. __set_bit(BTN_STYLUS, input_dev->keybit);
  918. __set_bit(BTN_STYLUS2, input_dev->keybit);
  919. break;
  920. case WACOM_21UX2:
  921. __set_bit(BTN_A, input_dev->keybit);
  922. __set_bit(BTN_B, input_dev->keybit);
  923. __set_bit(BTN_C, input_dev->keybit);
  924. __set_bit(BTN_X, input_dev->keybit);
  925. __set_bit(BTN_Y, input_dev->keybit);
  926. __set_bit(BTN_Z, input_dev->keybit);
  927. __set_bit(BTN_BASE, input_dev->keybit);
  928. __set_bit(BTN_BASE2, input_dev->keybit);
  929. /* fall through */
  930. case WACOM_BEE:
  931. __set_bit(BTN_8, input_dev->keybit);
  932. __set_bit(BTN_9, input_dev->keybit);
  933. /* fall through */
  934. case CINTIQ:
  935. for (i = 0; i < 8; i++)
  936. __set_bit(BTN_0 + i, input_dev->keybit);
  937. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  938. input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
  939. input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
  940. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  941. wacom_setup_cintiq(wacom_wac);
  942. break;
  943. case INTUOS3:
  944. case INTUOS3L:
  945. __set_bit(BTN_4, input_dev->keybit);
  946. __set_bit(BTN_5, input_dev->keybit);
  947. __set_bit(BTN_6, input_dev->keybit);
  948. __set_bit(BTN_7, input_dev->keybit);
  949. input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
  950. /* fall through */
  951. case INTUOS3S:
  952. __set_bit(BTN_0, input_dev->keybit);
  953. __set_bit(BTN_1, input_dev->keybit);
  954. __set_bit(BTN_2, input_dev->keybit);
  955. __set_bit(BTN_3, input_dev->keybit);
  956. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  957. input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
  958. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  959. /* fall through */
  960. case INTUOS:
  961. wacom_setup_intuos(wacom_wac);
  962. break;
  963. case INTUOS4:
  964. case INTUOS4L:
  965. __set_bit(BTN_7, input_dev->keybit);
  966. __set_bit(BTN_8, input_dev->keybit);
  967. /* fall through */
  968. case INTUOS4S:
  969. for (i = 0; i < 7; i++)
  970. __set_bit(BTN_0 + i, input_dev->keybit);
  971. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  972. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  973. wacom_setup_intuos(wacom_wac);
  974. break;
  975. case TABLETPC2FG:
  976. if (features->device_type == BTN_TOOL_TRIPLETAP) {
  977. __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
  978. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  979. }
  980. /* fall through */
  981. case TABLETPC:
  982. __clear_bit(ABS_MISC, input_dev->absbit);
  983. if (features->device_type == BTN_TOOL_DOUBLETAP ||
  984. features->device_type == BTN_TOOL_TRIPLETAP) {
  985. input_abs_set_res(input_dev, ABS_X,
  986. wacom_calculate_touch_res(features->x_max,
  987. features->x_phy));
  988. input_abs_set_res(input_dev, ABS_Y,
  989. wacom_calculate_touch_res(features->y_max,
  990. features->y_phy));
  991. }
  992. if (features->device_type != BTN_TOOL_PEN)
  993. break; /* no need to process stylus stuff */
  994. /* fall through */
  995. case PL:
  996. case PTU:
  997. case DTU:
  998. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  999. __set_bit(BTN_STYLUS, input_dev->keybit);
  1000. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1001. /* fall through */
  1002. case PENPARTNER:
  1003. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1004. break;
  1005. case BAMBOO_PT:
  1006. __clear_bit(ABS_MISC, input_dev->absbit);
  1007. if (features->device_type == BTN_TOOL_TRIPLETAP) {
  1008. __set_bit(BTN_LEFT, input_dev->keybit);
  1009. __set_bit(BTN_FORWARD, input_dev->keybit);
  1010. __set_bit(BTN_BACK, input_dev->keybit);
  1011. __set_bit(BTN_RIGHT, input_dev->keybit);
  1012. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  1013. __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
  1014. input_mt_init_slots(input_dev, 2);
  1015. input_set_abs_params(input_dev, ABS_MT_POSITION_X,
  1016. 0, features->x_max,
  1017. features->x_fuzz, 0);
  1018. input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
  1019. 0, features->y_max,
  1020. features->y_fuzz, 0);
  1021. input_set_abs_params(input_dev, ABS_MT_PRESSURE,
  1022. 0, features->pressure_max,
  1023. features->pressure_fuzz, 0);
  1024. input_abs_set_res(input_dev, ABS_X,
  1025. wacom_calculate_touch_res(features->x_max,
  1026. features->x_phy));
  1027. input_abs_set_res(input_dev, ABS_Y,
  1028. wacom_calculate_touch_res(features->y_max,
  1029. features->y_phy));
  1030. } else if (features->device_type == BTN_TOOL_PEN) {
  1031. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1032. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1033. __set_bit(BTN_STYLUS, input_dev->keybit);
  1034. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1035. }
  1036. break;
  1037. }
  1038. }
  1039. static const struct wacom_features wacom_features_0x00 =
  1040. { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER };
  1041. static const struct wacom_features wacom_features_0x10 =
  1042. { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  1043. static const struct wacom_features wacom_features_0x11 =
  1044. { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  1045. static const struct wacom_features wacom_features_0x12 =
  1046. { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE };
  1047. static const struct wacom_features wacom_features_0x13 =
  1048. { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE };
  1049. static const struct wacom_features wacom_features_0x14 =
  1050. { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  1051. static const struct wacom_features wacom_features_0x15 =
  1052. { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 };
  1053. static const struct wacom_features wacom_features_0x16 =
  1054. { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 };
  1055. static const struct wacom_features wacom_features_0x17 =
  1056. { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  1057. static const struct wacom_features wacom_features_0x18 =
  1058. { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO };
  1059. static const struct wacom_features wacom_features_0x19 =
  1060. { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  1061. static const struct wacom_features wacom_features_0x60 =
  1062. { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  1063. static const struct wacom_features wacom_features_0x61 =
  1064. { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE };
  1065. static const struct wacom_features wacom_features_0x62 =
  1066. { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  1067. static const struct wacom_features wacom_features_0x63 =
  1068. { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE };
  1069. static const struct wacom_features wacom_features_0x64 =
  1070. { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE };
  1071. static const struct wacom_features wacom_features_0x65 =
  1072. { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  1073. static const struct wacom_features wacom_features_0x69 =
  1074. { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  1075. static const struct wacom_features wacom_features_0x20 =
  1076. { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  1077. static const struct wacom_features wacom_features_0x21 =
  1078. { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  1079. static const struct wacom_features wacom_features_0x22 =
  1080. { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  1081. static const struct wacom_features wacom_features_0x23 =
  1082. { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  1083. static const struct wacom_features wacom_features_0x24 =
  1084. { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  1085. static const struct wacom_features wacom_features_0x30 =
  1086. { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL };
  1087. static const struct wacom_features wacom_features_0x31 =
  1088. { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL };
  1089. static const struct wacom_features wacom_features_0x32 =
  1090. { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL };
  1091. static const struct wacom_features wacom_features_0x33 =
  1092. { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL };
  1093. static const struct wacom_features wacom_features_0x34 =
  1094. { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL };
  1095. static const struct wacom_features wacom_features_0x35 =
  1096. { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL };
  1097. static const struct wacom_features wacom_features_0x37 =
  1098. { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL };
  1099. static const struct wacom_features wacom_features_0x38 =
  1100. { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  1101. static const struct wacom_features wacom_features_0x39 =
  1102. { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL };
  1103. static const struct wacom_features wacom_features_0xC4 =
  1104. { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  1105. static const struct wacom_features wacom_features_0xC0 =
  1106. { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  1107. static const struct wacom_features wacom_features_0xC2 =
  1108. { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  1109. static const struct wacom_features wacom_features_0x03 =
  1110. { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU };
  1111. static const struct wacom_features wacom_features_0x41 =
  1112. { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  1113. static const struct wacom_features wacom_features_0x42 =
  1114. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  1115. static const struct wacom_features wacom_features_0x43 =
  1116. { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  1117. static const struct wacom_features wacom_features_0x44 =
  1118. { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  1119. static const struct wacom_features wacom_features_0x45 =
  1120. { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  1121. static const struct wacom_features wacom_features_0xB0 =
  1122. { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S };
  1123. static const struct wacom_features wacom_features_0xB1 =
  1124. { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 };
  1125. static const struct wacom_features wacom_features_0xB2 =
  1126. { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 };
  1127. static const struct wacom_features wacom_features_0xB3 =
  1128. { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L };
  1129. static const struct wacom_features wacom_features_0xB4 =
  1130. { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L };
  1131. static const struct wacom_features wacom_features_0xB5 =
  1132. { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 };
  1133. static const struct wacom_features wacom_features_0xB7 =
  1134. { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S };
  1135. static const struct wacom_features wacom_features_0xB8 =
  1136. { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S };
  1137. static const struct wacom_features wacom_features_0xB9 =
  1138. { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 };
  1139. static const struct wacom_features wacom_features_0xBA =
  1140. { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L };
  1141. static const struct wacom_features wacom_features_0xBB =
  1142. { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L };
  1143. static const struct wacom_features wacom_features_0xBC =
  1144. { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 63, INTUOS4 };
  1145. static const struct wacom_features wacom_features_0x3F =
  1146. { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ };
  1147. static const struct wacom_features wacom_features_0xC5 =
  1148. { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE };
  1149. static const struct wacom_features wacom_features_0xC6 =
  1150. { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE };
  1151. static const struct wacom_features wacom_features_0xC7 =
  1152. { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL };
  1153. static const struct wacom_features wacom_features_0xCE =
  1154. { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, 0, DTU };
  1155. static const struct wacom_features wacom_features_0xF0 =
  1156. { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, 0, DTU };
  1157. static const struct wacom_features wacom_features_0xCC =
  1158. { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047, 63, WACOM_21UX2 };
  1159. static const struct wacom_features wacom_features_0x90 =
  1160. { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  1161. static const struct wacom_features wacom_features_0x93 =
  1162. { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  1163. static const struct wacom_features wacom_features_0x9A =
  1164. { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  1165. static const struct wacom_features wacom_features_0x9F =
  1166. { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  1167. static const struct wacom_features wacom_features_0xE2 =
  1168. { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  1169. static const struct wacom_features wacom_features_0xE3 =
  1170. { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  1171. static const struct wacom_features wacom_features_0x47 =
  1172. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  1173. static struct wacom_features wacom_features_0xD0 =
  1174. { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1175. static struct wacom_features wacom_features_0xD1 =
  1176. { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1177. static struct wacom_features wacom_features_0xD2 =
  1178. { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1179. static struct wacom_features wacom_features_0xD3 =
  1180. { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
  1181. static const struct wacom_features wacom_features_0xD4 =
  1182. { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT };
  1183. static struct wacom_features wacom_features_0xD6 =
  1184. { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1185. static struct wacom_features wacom_features_0xD7 =
  1186. { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1187. static struct wacom_features wacom_features_0xD8 =
  1188. { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
  1189. static struct wacom_features wacom_features_0xDA =
  1190. { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
  1191. static struct wacom_features wacom_features_0xDB =
  1192. { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
  1193. static const struct wacom_features wacom_features_0x6004 =
  1194. { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC };
  1195. #define USB_DEVICE_WACOM(prod) \
  1196. USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
  1197. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  1198. #define USB_DEVICE_LENOVO(prod) \
  1199. USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
  1200. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  1201. const struct usb_device_id wacom_ids[] = {
  1202. { USB_DEVICE_WACOM(0x00) },
  1203. { USB_DEVICE_WACOM(0x10) },
  1204. { USB_DEVICE_WACOM(0x11) },
  1205. { USB_DEVICE_WACOM(0x12) },
  1206. { USB_DEVICE_WACOM(0x13) },
  1207. { USB_DEVICE_WACOM(0x14) },
  1208. { USB_DEVICE_WACOM(0x15) },
  1209. { USB_DEVICE_WACOM(0x16) },
  1210. { USB_DEVICE_WACOM(0x17) },
  1211. { USB_DEVICE_WACOM(0x18) },
  1212. { USB_DEVICE_WACOM(0x19) },
  1213. { USB_DEVICE_WACOM(0x60) },
  1214. { USB_DEVICE_WACOM(0x61) },
  1215. { USB_DEVICE_WACOM(0x62) },
  1216. { USB_DEVICE_WACOM(0x63) },
  1217. { USB_DEVICE_WACOM(0x64) },
  1218. { USB_DEVICE_WACOM(0x65) },
  1219. { USB_DEVICE_WACOM(0x69) },
  1220. { USB_DEVICE_WACOM(0x20) },
  1221. { USB_DEVICE_WACOM(0x21) },
  1222. { USB_DEVICE_WACOM(0x22) },
  1223. { USB_DEVICE_WACOM(0x23) },
  1224. { USB_DEVICE_WACOM(0x24) },
  1225. { USB_DEVICE_WACOM(0x30) },
  1226. { USB_DEVICE_WACOM(0x31) },
  1227. { USB_DEVICE_WACOM(0x32) },
  1228. { USB_DEVICE_WACOM(0x33) },
  1229. { USB_DEVICE_WACOM(0x34) },
  1230. { USB_DEVICE_WACOM(0x35) },
  1231. { USB_DEVICE_WACOM(0x37) },
  1232. { USB_DEVICE_WACOM(0x38) },
  1233. { USB_DEVICE_WACOM(0x39) },
  1234. { USB_DEVICE_WACOM(0xC4) },
  1235. { USB_DEVICE_WACOM(0xC0) },
  1236. { USB_DEVICE_WACOM(0xC2) },
  1237. { USB_DEVICE_WACOM(0x03) },
  1238. { USB_DEVICE_WACOM(0x41) },
  1239. { USB_DEVICE_WACOM(0x42) },
  1240. { USB_DEVICE_WACOM(0x43) },
  1241. { USB_DEVICE_WACOM(0x44) },
  1242. { USB_DEVICE_WACOM(0x45) },
  1243. { USB_DEVICE_WACOM(0xB0) },
  1244. { USB_DEVICE_WACOM(0xB1) },
  1245. { USB_DEVICE_WACOM(0xB2) },
  1246. { USB_DEVICE_WACOM(0xB3) },
  1247. { USB_DEVICE_WACOM(0xB4) },
  1248. { USB_DEVICE_WACOM(0xB5) },
  1249. { USB_DEVICE_WACOM(0xB7) },
  1250. { USB_DEVICE_WACOM(0xB8) },
  1251. { USB_DEVICE_WACOM(0xB9) },
  1252. { USB_DEVICE_WACOM(0xBA) },
  1253. { USB_DEVICE_WACOM(0xBB) },
  1254. { USB_DEVICE_WACOM(0xBC) },
  1255. { USB_DEVICE_WACOM(0x3F) },
  1256. { USB_DEVICE_WACOM(0xC5) },
  1257. { USB_DEVICE_WACOM(0xC6) },
  1258. { USB_DEVICE_WACOM(0xC7) },
  1259. { USB_DEVICE_WACOM(0xCE) },
  1260. { USB_DEVICE_WACOM(0xD0) },
  1261. { USB_DEVICE_WACOM(0xD1) },
  1262. { USB_DEVICE_WACOM(0xD2) },
  1263. { USB_DEVICE_WACOM(0xD3) },
  1264. { USB_DEVICE_WACOM(0xD4) },
  1265. { USB_DEVICE_WACOM(0xD6) },
  1266. { USB_DEVICE_WACOM(0xD7) },
  1267. { USB_DEVICE_WACOM(0xD8) },
  1268. { USB_DEVICE_WACOM(0xDA) },
  1269. { USB_DEVICE_WACOM(0xDB) },
  1270. { USB_DEVICE_WACOM(0xF0) },
  1271. { USB_DEVICE_WACOM(0xCC) },
  1272. { USB_DEVICE_WACOM(0x90) },
  1273. { USB_DEVICE_WACOM(0x93) },
  1274. { USB_DEVICE_WACOM(0x9A) },
  1275. { USB_DEVICE_WACOM(0x9F) },
  1276. { USB_DEVICE_WACOM(0xE2) },
  1277. { USB_DEVICE_WACOM(0xE3) },
  1278. { USB_DEVICE_WACOM(0x47) },
  1279. { USB_DEVICE_LENOVO(0x6004) },
  1280. { }
  1281. };
  1282. MODULE_DEVICE_TABLE(usb, wacom_ids);