wacom_wac.c 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876
  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. #include <linux/hid.h>
  17. /* resolution for penabled devices */
  18. #define WACOM_PL_RES 20
  19. #define WACOM_PENPRTN_RES 40
  20. #define WACOM_VOLITO_RES 50
  21. #define WACOM_GRAPHIRE_RES 80
  22. #define WACOM_INTUOS_RES 100
  23. #define WACOM_INTUOS3_RES 200
  24. static int wacom_penpartner_irq(struct wacom_wac *wacom)
  25. {
  26. unsigned char *data = wacom->data;
  27. struct input_dev *input = wacom->input;
  28. switch (data[0]) {
  29. case 1:
  30. if (data[5] & 0x80) {
  31. wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  32. wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
  33. input_report_key(input, wacom->tool[0], 1);
  34. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  35. input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
  36. input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
  37. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  38. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127));
  39. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  40. } else {
  41. input_report_key(input, wacom->tool[0], 0);
  42. input_report_abs(input, ABS_MISC, 0); /* report tool id */
  43. input_report_abs(input, ABS_PRESSURE, -1);
  44. input_report_key(input, BTN_TOUCH, 0);
  45. }
  46. break;
  47. case 2:
  48. input_report_key(input, BTN_TOOL_PEN, 1);
  49. input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
  50. input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
  51. input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
  52. input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
  53. input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
  54. input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
  55. break;
  56. default:
  57. printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]);
  58. return 0;
  59. }
  60. return 1;
  61. }
  62. static int wacom_pl_irq(struct wacom_wac *wacom)
  63. {
  64. struct wacom_features *features = &wacom->features;
  65. unsigned char *data = wacom->data;
  66. struct input_dev *input = wacom->input;
  67. int prox, pressure;
  68. if (data[0] != WACOM_REPORT_PENABLED) {
  69. dbg("wacom_pl_irq: received unknown report #%d", data[0]);
  70. return 0;
  71. }
  72. prox = data[1] & 0x40;
  73. if (prox) {
  74. wacom->id[0] = ERASER_DEVICE_ID;
  75. pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
  76. if (features->pressure_max > 255)
  77. pressure = (pressure << 1) | ((data[4] >> 6) & 1);
  78. pressure += (features->pressure_max + 1) / 2;
  79. /*
  80. * if going from out of proximity into proximity select between the eraser
  81. * and the pen based on the state of the stylus2 button, choose eraser if
  82. * pressed else choose pen. if not a proximity change from out to in, send
  83. * an out of proximity for previous tool then a in for new tool.
  84. */
  85. if (!wacom->tool[0]) {
  86. /* Eraser bit set for DTF */
  87. if (data[1] & 0x10)
  88. wacom->tool[1] = BTN_TOOL_RUBBER;
  89. else
  90. /* Going into proximity select tool */
  91. wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  92. } else {
  93. /* was entered with stylus2 pressed */
  94. if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
  95. /* report out proximity for previous tool */
  96. input_report_key(input, wacom->tool[1], 0);
  97. input_sync(input);
  98. wacom->tool[1] = BTN_TOOL_PEN;
  99. return 0;
  100. }
  101. }
  102. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  103. /* Unknown tool selected default to pen tool */
  104. wacom->tool[1] = BTN_TOOL_PEN;
  105. wacom->id[0] = STYLUS_DEVICE_ID;
  106. }
  107. input_report_key(input, wacom->tool[1], prox); /* report in proximity for tool */
  108. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  109. input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
  110. input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
  111. input_report_abs(input, ABS_PRESSURE, pressure);
  112. input_report_key(input, BTN_TOUCH, data[4] & 0x08);
  113. input_report_key(input, BTN_STYLUS, data[4] & 0x10);
  114. /* Only allow the stylus2 button to be reported for the pen tool. */
  115. input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
  116. } else {
  117. /* report proximity-out of a (valid) tool */
  118. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  119. /* Unknown tool selected default to pen tool */
  120. wacom->tool[1] = BTN_TOOL_PEN;
  121. }
  122. input_report_key(input, wacom->tool[1], prox);
  123. }
  124. wacom->tool[0] = prox; /* Save proximity state */
  125. return 1;
  126. }
  127. static int wacom_ptu_irq(struct wacom_wac *wacom)
  128. {
  129. unsigned char *data = wacom->data;
  130. struct input_dev *input = wacom->input;
  131. if (data[0] != WACOM_REPORT_PENABLED) {
  132. printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
  133. return 0;
  134. }
  135. if (data[1] & 0x04) {
  136. input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20);
  137. input_report_key(input, BTN_TOUCH, data[1] & 0x08);
  138. wacom->id[0] = ERASER_DEVICE_ID;
  139. } else {
  140. input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20);
  141. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  142. wacom->id[0] = STYLUS_DEVICE_ID;
  143. }
  144. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  145. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  146. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  147. input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6]));
  148. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  149. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  150. return 1;
  151. }
  152. static int wacom_dtu_irq(struct wacom_wac *wacom)
  153. {
  154. struct wacom_features *features = &wacom->features;
  155. char *data = wacom->data;
  156. struct input_dev *input = wacom->input;
  157. int prox = data[1] & 0x20, pressure;
  158. dbg("wacom_dtu_irq: received report #%d", data[0]);
  159. if (prox) {
  160. /* Going into proximity select tool */
  161. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  162. if (wacom->tool[0] == BTN_TOOL_PEN)
  163. wacom->id[0] = STYLUS_DEVICE_ID;
  164. else
  165. wacom->id[0] = ERASER_DEVICE_ID;
  166. }
  167. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  168. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  169. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  170. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  171. pressure = ((data[7] & 0x01) << 8) | data[6];
  172. if (pressure < 0)
  173. pressure = features->pressure_max + pressure + 1;
  174. input_report_abs(input, ABS_PRESSURE, pressure);
  175. input_report_key(input, BTN_TOUCH, data[1] & 0x05);
  176. if (!prox) /* out-prox */
  177. wacom->id[0] = 0;
  178. input_report_key(input, wacom->tool[0], prox);
  179. input_report_abs(input, ABS_MISC, wacom->id[0]);
  180. return 1;
  181. }
  182. static int wacom_graphire_irq(struct wacom_wac *wacom)
  183. {
  184. struct wacom_features *features = &wacom->features;
  185. unsigned char *data = wacom->data;
  186. struct input_dev *input = wacom->input;
  187. int prox;
  188. int rw = 0;
  189. int retval = 0;
  190. if (data[0] != WACOM_REPORT_PENABLED) {
  191. dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
  192. goto exit;
  193. }
  194. prox = data[1] & 0x80;
  195. if (prox || wacom->id[0]) {
  196. if (prox) {
  197. switch ((data[1] >> 5) & 3) {
  198. case 0: /* Pen */
  199. wacom->tool[0] = BTN_TOOL_PEN;
  200. wacom->id[0] = STYLUS_DEVICE_ID;
  201. break;
  202. case 1: /* Rubber */
  203. wacom->tool[0] = BTN_TOOL_RUBBER;
  204. wacom->id[0] = ERASER_DEVICE_ID;
  205. break;
  206. case 2: /* Mouse with wheel */
  207. input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
  208. /* fall through */
  209. case 3: /* Mouse without wheel */
  210. wacom->tool[0] = BTN_TOOL_MOUSE;
  211. wacom->id[0] = CURSOR_DEVICE_ID;
  212. break;
  213. }
  214. }
  215. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  216. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  217. if (wacom->tool[0] != BTN_TOOL_MOUSE) {
  218. input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
  219. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  220. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  221. input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
  222. } else {
  223. input_report_key(input, BTN_LEFT, data[1] & 0x01);
  224. input_report_key(input, BTN_RIGHT, data[1] & 0x02);
  225. if (features->type == WACOM_G4 ||
  226. features->type == WACOM_MO) {
  227. input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f);
  228. rw = (data[7] & 0x04) - (data[7] & 0x03);
  229. } else {
  230. input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f);
  231. rw = -(signed char)data[6];
  232. }
  233. input_report_rel(input, REL_WHEEL, rw);
  234. }
  235. if (!prox)
  236. wacom->id[0] = 0;
  237. input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
  238. input_report_key(input, wacom->tool[0], prox);
  239. input_event(input, EV_MSC, MSC_SERIAL, 1);
  240. input_sync(input); /* sync last event */
  241. }
  242. /* send pad data */
  243. switch (features->type) {
  244. case WACOM_G4:
  245. prox = data[7] & 0xf8;
  246. if (prox || wacom->id[1]) {
  247. wacom->id[1] = PAD_DEVICE_ID;
  248. input_report_key(input, BTN_BACK, (data[7] & 0x40));
  249. input_report_key(input, BTN_FORWARD, (data[7] & 0x80));
  250. rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
  251. input_report_rel(input, REL_WHEEL, rw);
  252. if (!prox)
  253. wacom->id[1] = 0;
  254. input_report_abs(input, ABS_MISC, wacom->id[1]);
  255. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  256. retval = 1;
  257. }
  258. break;
  259. case WACOM_MO:
  260. prox = (data[7] & 0xf8) || data[8];
  261. if (prox || wacom->id[1]) {
  262. wacom->id[1] = PAD_DEVICE_ID;
  263. input_report_key(input, BTN_BACK, (data[7] & 0x08));
  264. input_report_key(input, BTN_LEFT, (data[7] & 0x20));
  265. input_report_key(input, BTN_FORWARD, (data[7] & 0x10));
  266. input_report_key(input, BTN_RIGHT, (data[7] & 0x40));
  267. input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f));
  268. if (!prox)
  269. wacom->id[1] = 0;
  270. input_report_abs(input, ABS_MISC, wacom->id[1]);
  271. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  272. retval = 1;
  273. }
  274. break;
  275. }
  276. exit:
  277. return retval;
  278. }
  279. static int wacom_intuos_inout(struct wacom_wac *wacom)
  280. {
  281. struct wacom_features *features = &wacom->features;
  282. unsigned char *data = wacom->data;
  283. struct input_dev *input = wacom->input;
  284. int idx = 0;
  285. /* tool number */
  286. if (features->type == INTUOS)
  287. idx = data[1] & 0x01;
  288. /* Enter report */
  289. if ((data[1] & 0xfc) == 0xc0) {
  290. /* serial number of the tool */
  291. wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
  292. (data[4] << 20) + (data[5] << 12) +
  293. (data[6] << 4) + (data[7] >> 4);
  294. wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
  295. ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12);
  296. switch (wacom->id[idx] & 0xfffff) {
  297. case 0x812: /* Inking pen */
  298. case 0x801: /* Intuos3 Inking pen */
  299. case 0x20802: /* Intuos4 Inking Pen */
  300. case 0x012:
  301. wacom->tool[idx] = BTN_TOOL_PENCIL;
  302. break;
  303. case 0x822: /* Pen */
  304. case 0x842:
  305. case 0x852:
  306. case 0x823: /* Intuos3 Grip Pen */
  307. case 0x813: /* Intuos3 Classic Pen */
  308. case 0x885: /* Intuos3 Marker Pen */
  309. case 0x802: /* Intuos4 General Pen */
  310. case 0x804: /* Intuos4 Marker Pen */
  311. case 0x40802: /* Intuos4 Classic Pen */
  312. case 0x022:
  313. wacom->tool[idx] = BTN_TOOL_PEN;
  314. break;
  315. case 0x832: /* Stroke pen */
  316. case 0x032:
  317. wacom->tool[idx] = BTN_TOOL_BRUSH;
  318. break;
  319. case 0x007: /* Mouse 4D and 2D */
  320. case 0x09c:
  321. case 0x094:
  322. case 0x017: /* Intuos3 2D Mouse */
  323. case 0x806: /* Intuos4 Mouse */
  324. wacom->tool[idx] = BTN_TOOL_MOUSE;
  325. break;
  326. case 0x096: /* Lens cursor */
  327. case 0x097: /* Intuos3 Lens cursor */
  328. case 0x006: /* Intuos4 Lens cursor */
  329. wacom->tool[idx] = BTN_TOOL_LENS;
  330. break;
  331. case 0x82a: /* Eraser */
  332. case 0x85a:
  333. case 0x91a:
  334. case 0xd1a:
  335. case 0x0fa:
  336. case 0x82b: /* Intuos3 Grip Pen Eraser */
  337. case 0x81b: /* Intuos3 Classic Pen Eraser */
  338. case 0x91b: /* Intuos3 Airbrush Eraser */
  339. case 0x80c: /* Intuos4 Marker Pen Eraser */
  340. case 0x80a: /* Intuos4 General Pen Eraser */
  341. case 0x4080a: /* Intuos4 Classic Pen Eraser */
  342. case 0x90a: /* Intuos4 Airbrush Eraser */
  343. wacom->tool[idx] = BTN_TOOL_RUBBER;
  344. break;
  345. case 0xd12:
  346. case 0x912:
  347. case 0x112:
  348. case 0x913: /* Intuos3 Airbrush */
  349. case 0x902: /* Intuos4 Airbrush */
  350. wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
  351. break;
  352. default: /* Unknown tool */
  353. wacom->tool[idx] = BTN_TOOL_PEN;
  354. break;
  355. }
  356. return 1;
  357. }
  358. /* older I4 styli don't work with new Cintiqs */
  359. if (!((wacom->id[idx] >> 20) & 0x01) &&
  360. (features->type == WACOM_21UX2))
  361. return 1;
  362. /* Exit report */
  363. if ((data[1] & 0xfe) == 0x80) {
  364. /*
  365. * Reset all states otherwise we lose the initial states
  366. * when in-prox next time
  367. */
  368. input_report_abs(input, ABS_X, 0);
  369. input_report_abs(input, ABS_Y, 0);
  370. input_report_abs(input, ABS_DISTANCE, 0);
  371. input_report_abs(input, ABS_TILT_X, 0);
  372. input_report_abs(input, ABS_TILT_Y, 0);
  373. if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
  374. input_report_key(input, BTN_LEFT, 0);
  375. input_report_key(input, BTN_MIDDLE, 0);
  376. input_report_key(input, BTN_RIGHT, 0);
  377. input_report_key(input, BTN_SIDE, 0);
  378. input_report_key(input, BTN_EXTRA, 0);
  379. input_report_abs(input, ABS_THROTTLE, 0);
  380. input_report_abs(input, ABS_RZ, 0);
  381. } else {
  382. input_report_abs(input, ABS_PRESSURE, 0);
  383. input_report_key(input, BTN_STYLUS, 0);
  384. input_report_key(input, BTN_STYLUS2, 0);
  385. input_report_key(input, BTN_TOUCH, 0);
  386. input_report_abs(input, ABS_WHEEL, 0);
  387. if (features->type >= INTUOS3S)
  388. input_report_abs(input, ABS_Z, 0);
  389. }
  390. input_report_key(input, wacom->tool[idx], 0);
  391. input_report_abs(input, ABS_MISC, 0); /* reset tool id */
  392. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  393. wacom->id[idx] = 0;
  394. return 2;
  395. }
  396. return 0;
  397. }
  398. static void wacom_intuos_general(struct wacom_wac *wacom)
  399. {
  400. struct wacom_features *features = &wacom->features;
  401. unsigned char *data = wacom->data;
  402. struct input_dev *input = wacom->input;
  403. unsigned int t;
  404. /* general pen packet */
  405. if ((data[1] & 0xb8) == 0xa0) {
  406. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  407. if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
  408. (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
  409. features->type == WACOM_21UX2 || features->type == WACOM_24HD) {
  410. t = (t << 1) | (data[1] & 1);
  411. }
  412. input_report_abs(input, ABS_PRESSURE, t);
  413. input_report_abs(input, ABS_TILT_X,
  414. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  415. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  416. input_report_key(input, BTN_STYLUS, data[1] & 2);
  417. input_report_key(input, BTN_STYLUS2, data[1] & 4);
  418. input_report_key(input, BTN_TOUCH, t > 10);
  419. }
  420. /* airbrush second packet */
  421. if ((data[1] & 0xbc) == 0xb4) {
  422. input_report_abs(input, ABS_WHEEL,
  423. (data[6] << 2) | ((data[7] >> 6) & 3));
  424. input_report_abs(input, ABS_TILT_X,
  425. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  426. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  427. }
  428. }
  429. static int wacom_intuos_irq(struct wacom_wac *wacom)
  430. {
  431. struct wacom_features *features = &wacom->features;
  432. unsigned char *data = wacom->data;
  433. struct input_dev *input = wacom->input;
  434. unsigned int t;
  435. int idx = 0, result;
  436. if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD
  437. && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) {
  438. dbg("wacom_intuos_irq: received unknown report #%d", data[0]);
  439. return 0;
  440. }
  441. /* tool number */
  442. if (features->type == INTUOS)
  443. idx = data[1] & 0x01;
  444. /* pad packets. Works as a second tool and is always in prox */
  445. if (data[0] == WACOM_REPORT_INTUOSPAD) {
  446. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  447. input_report_key(input, BTN_0, (data[2] & 0x01));
  448. input_report_key(input, BTN_1, (data[3] & 0x01));
  449. input_report_key(input, BTN_2, (data[3] & 0x02));
  450. input_report_key(input, BTN_3, (data[3] & 0x04));
  451. input_report_key(input, BTN_4, (data[3] & 0x08));
  452. input_report_key(input, BTN_5, (data[3] & 0x10));
  453. input_report_key(input, BTN_6, (data[3] & 0x20));
  454. if (data[1] & 0x80) {
  455. input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
  456. } else {
  457. /* Out of proximity, clear wheel value. */
  458. input_report_abs(input, ABS_WHEEL, 0);
  459. }
  460. if (features->type != INTUOS4S) {
  461. input_report_key(input, BTN_7, (data[3] & 0x40));
  462. input_report_key(input, BTN_8, (data[3] & 0x80));
  463. }
  464. if (data[1] | (data[2] & 0x01) | data[3]) {
  465. input_report_key(input, wacom->tool[1], 1);
  466. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  467. } else {
  468. input_report_key(input, wacom->tool[1], 0);
  469. input_report_abs(input, ABS_MISC, 0);
  470. }
  471. } else if (features->type == WACOM_24HD) {
  472. input_report_key(input, BTN_0, (data[6] & 0x01));
  473. input_report_key(input, BTN_1, (data[6] & 0x02));
  474. input_report_key(input, BTN_2, (data[6] & 0x04));
  475. input_report_key(input, BTN_3, (data[6] & 0x08));
  476. input_report_key(input, BTN_4, (data[6] & 0x10));
  477. input_report_key(input, BTN_5, (data[6] & 0x20));
  478. input_report_key(input, BTN_6, (data[6] & 0x40));
  479. input_report_key(input, BTN_7, (data[6] & 0x80));
  480. input_report_key(input, BTN_8, (data[8] & 0x01));
  481. input_report_key(input, BTN_9, (data[8] & 0x02));
  482. input_report_key(input, BTN_A, (data[8] & 0x04));
  483. input_report_key(input, BTN_B, (data[8] & 0x08));
  484. input_report_key(input, BTN_C, (data[8] & 0x10));
  485. input_report_key(input, BTN_X, (data[8] & 0x20));
  486. input_report_key(input, BTN_Y, (data[8] & 0x40));
  487. input_report_key(input, BTN_Z, (data[8] & 0x80));
  488. /*
  489. * Three "buttons" are available on the 24HD which are
  490. * physically implemented as a touchstrip. Each button
  491. * is approximately 3 bits wide with a 2 bit spacing.
  492. * The raw touchstrip bits are stored at:
  493. * ((data[3] & 0x1f) << 8) | data[4])
  494. */
  495. input_report_key(input, KEY_PROG1, data[4] & 0x07);
  496. input_report_key(input, KEY_PROG2, data[4] & 0xE0);
  497. input_report_key(input, KEY_PROG3, data[3] & 0x1C);
  498. if (data[1] & 0x80) {
  499. input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
  500. } else {
  501. /* Out of proximity, clear wheel value. */
  502. input_report_abs(input, ABS_WHEEL, 0);
  503. }
  504. if (data[2] & 0x80) {
  505. input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f));
  506. } else {
  507. /* Out of proximity, clear second wheel value. */
  508. input_report_abs(input, ABS_THROTTLE, 0);
  509. }
  510. if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) {
  511. input_report_key(input, wacom->tool[1], 1);
  512. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  513. } else {
  514. input_report_key(input, wacom->tool[1], 0);
  515. input_report_abs(input, ABS_MISC, 0);
  516. }
  517. } else {
  518. if (features->type == WACOM_21UX2) {
  519. input_report_key(input, BTN_0, (data[5] & 0x01));
  520. input_report_key(input, BTN_1, (data[6] & 0x01));
  521. input_report_key(input, BTN_2, (data[6] & 0x02));
  522. input_report_key(input, BTN_3, (data[6] & 0x04));
  523. input_report_key(input, BTN_4, (data[6] & 0x08));
  524. input_report_key(input, BTN_5, (data[6] & 0x10));
  525. input_report_key(input, BTN_6, (data[6] & 0x20));
  526. input_report_key(input, BTN_7, (data[6] & 0x40));
  527. input_report_key(input, BTN_8, (data[6] & 0x80));
  528. input_report_key(input, BTN_9, (data[7] & 0x01));
  529. input_report_key(input, BTN_A, (data[8] & 0x01));
  530. input_report_key(input, BTN_B, (data[8] & 0x02));
  531. input_report_key(input, BTN_C, (data[8] & 0x04));
  532. input_report_key(input, BTN_X, (data[8] & 0x08));
  533. input_report_key(input, BTN_Y, (data[8] & 0x10));
  534. input_report_key(input, BTN_Z, (data[8] & 0x20));
  535. input_report_key(input, BTN_BASE, (data[8] & 0x40));
  536. input_report_key(input, BTN_BASE2, (data[8] & 0x80));
  537. } else {
  538. input_report_key(input, BTN_0, (data[5] & 0x01));
  539. input_report_key(input, BTN_1, (data[5] & 0x02));
  540. input_report_key(input, BTN_2, (data[5] & 0x04));
  541. input_report_key(input, BTN_3, (data[5] & 0x08));
  542. input_report_key(input, BTN_4, (data[6] & 0x01));
  543. input_report_key(input, BTN_5, (data[6] & 0x02));
  544. input_report_key(input, BTN_6, (data[6] & 0x04));
  545. input_report_key(input, BTN_7, (data[6] & 0x08));
  546. input_report_key(input, BTN_8, (data[5] & 0x10));
  547. input_report_key(input, BTN_9, (data[6] & 0x10));
  548. }
  549. input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
  550. input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
  551. if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) |
  552. data[2] | (data[3] & 0x1f) | data[4] | data[8] |
  553. (data[7] & 0x01)) {
  554. input_report_key(input, wacom->tool[1], 1);
  555. input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
  556. } else {
  557. input_report_key(input, wacom->tool[1], 0);
  558. input_report_abs(input, ABS_MISC, 0);
  559. }
  560. }
  561. input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
  562. return 1;
  563. }
  564. /* process in/out prox events */
  565. result = wacom_intuos_inout(wacom);
  566. if (result)
  567. return result - 1;
  568. /* don't proceed if we don't know the ID */
  569. if (!wacom->id[idx])
  570. return 0;
  571. /* Only large Intuos support Lense Cursor */
  572. if (wacom->tool[idx] == BTN_TOOL_LENS &&
  573. (features->type == INTUOS3 ||
  574. features->type == INTUOS3S ||
  575. features->type == INTUOS4 ||
  576. features->type == INTUOS4S ||
  577. features->type == INTUOS5 ||
  578. features->type == INTUOS5S)) {
  579. return 0;
  580. }
  581. /* Cintiq doesn't send data when RDY bit isn't set */
  582. if (features->type == CINTIQ && !(data[1] & 0x40))
  583. return 0;
  584. if (features->type >= INTUOS3S) {
  585. input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
  586. input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
  587. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
  588. } else {
  589. input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[2]));
  590. input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[4]));
  591. input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
  592. }
  593. /* process general packets */
  594. wacom_intuos_general(wacom);
  595. /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
  596. if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
  597. if (data[1] & 0x02) {
  598. /* Rotation packet */
  599. if (features->type >= INTUOS3S) {
  600. /* I3 marker pen rotation */
  601. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  602. t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
  603. ((t-1) / 2 + 450)) : (450 - t / 2) ;
  604. input_report_abs(input, ABS_Z, t);
  605. } else {
  606. /* 4D mouse rotation packet */
  607. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  608. input_report_abs(input, ABS_RZ, (data[7] & 0x20) ?
  609. ((t - 1) / 2) : -t / 2);
  610. }
  611. } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
  612. /* 4D mouse packet */
  613. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  614. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  615. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  616. input_report_key(input, BTN_SIDE, data[8] & 0x20);
  617. input_report_key(input, BTN_EXTRA, data[8] & 0x10);
  618. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  619. input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
  620. } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
  621. /* I4 mouse */
  622. if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
  623. (features->type >= INTUOS5S && features->type <= INTUOS5L)) {
  624. input_report_key(input, BTN_LEFT, data[6] & 0x01);
  625. input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
  626. input_report_key(input, BTN_RIGHT, data[6] & 0x04);
  627. input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7)
  628. - ((data[7] & 0x40) >> 6));
  629. input_report_key(input, BTN_SIDE, data[6] & 0x08);
  630. input_report_key(input, BTN_EXTRA, data[6] & 0x10);
  631. input_report_abs(input, ABS_TILT_X,
  632. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  633. input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
  634. } else {
  635. /* 2D mouse packet */
  636. input_report_key(input, BTN_LEFT, data[8] & 0x04);
  637. input_report_key(input, BTN_MIDDLE, data[8] & 0x08);
  638. input_report_key(input, BTN_RIGHT, data[8] & 0x10);
  639. input_report_rel(input, REL_WHEEL, (data[8] & 0x01)
  640. - ((data[8] & 0x02) >> 1));
  641. /* I3 2D mouse side buttons */
  642. if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
  643. input_report_key(input, BTN_SIDE, data[8] & 0x40);
  644. input_report_key(input, BTN_EXTRA, data[8] & 0x20);
  645. }
  646. }
  647. } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
  648. features->type == INTUOS4L || features->type == INTUOS5L) &&
  649. wacom->tool[idx] == BTN_TOOL_LENS) {
  650. /* Lens cursor packets */
  651. input_report_key(input, BTN_LEFT, data[8] & 0x01);
  652. input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
  653. input_report_key(input, BTN_RIGHT, data[8] & 0x04);
  654. input_report_key(input, BTN_SIDE, data[8] & 0x10);
  655. input_report_key(input, BTN_EXTRA, data[8] & 0x08);
  656. }
  657. }
  658. input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */
  659. input_report_key(input, wacom->tool[idx], 1);
  660. input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  661. return 1;
  662. }
  663. static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
  664. {
  665. struct input_dev *input = wacom->input;
  666. unsigned char *data = wacom->data;
  667. int contact_with_no_pen_down_count = 0;
  668. int i;
  669. for (i = 0; i < 2; i++) {
  670. int p = data[1] & (1 << i);
  671. bool touch = p && !wacom->shared->stylus_in_proximity;
  672. input_mt_slot(input, i);
  673. input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
  674. if (touch) {
  675. int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff;
  676. int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff;
  677. input_report_abs(input, ABS_MT_POSITION_X, x);
  678. input_report_abs(input, ABS_MT_POSITION_Y, y);
  679. contact_with_no_pen_down_count++;
  680. }
  681. }
  682. /* keep touch state for pen event */
  683. wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
  684. input_mt_report_pointer_emulation(input, true);
  685. return 1;
  686. }
  687. static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
  688. {
  689. char *data = wacom->data;
  690. struct input_dev *input = wacom->input;
  691. bool prox;
  692. int x = 0, y = 0;
  693. if (!wacom->shared->stylus_in_proximity) {
  694. if (len == WACOM_PKGLEN_TPC1FG) {
  695. prox = data[0] & 0x01;
  696. x = get_unaligned_le16(&data[1]);
  697. y = get_unaligned_le16(&data[3]);
  698. } else { /* with capacity */
  699. prox = data[1] & 0x01;
  700. x = le16_to_cpup((__le16 *)&data[2]);
  701. y = le16_to_cpup((__le16 *)&data[4]);
  702. }
  703. } else
  704. /* force touch out when pen is in prox */
  705. prox = 0;
  706. if (prox) {
  707. input_report_abs(input, ABS_X, x);
  708. input_report_abs(input, ABS_Y, y);
  709. }
  710. input_report_key(input, BTN_TOUCH, prox);
  711. /* keep touch state for pen events */
  712. wacom->shared->touch_down = prox;
  713. return 1;
  714. }
  715. static int wacom_tpc_pen(struct wacom_wac *wacom)
  716. {
  717. struct wacom_features *features = &wacom->features;
  718. char *data = wacom->data;
  719. struct input_dev *input = wacom->input;
  720. int pressure;
  721. bool prox = data[1] & 0x20;
  722. if (!wacom->shared->stylus_in_proximity) /* first in prox */
  723. /* Going into proximity select tool */
  724. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  725. /* keep pen state for touch events */
  726. wacom->shared->stylus_in_proximity = prox;
  727. /* send pen events only when touch is up or forced out */
  728. if (!wacom->shared->touch_down) {
  729. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  730. input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
  731. input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
  732. input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
  733. pressure = ((data[7] & 0x01) << 8) | data[6];
  734. if (pressure < 0)
  735. pressure = features->pressure_max + pressure + 1;
  736. input_report_abs(input, ABS_PRESSURE, pressure);
  737. input_report_key(input, BTN_TOUCH, data[1] & 0x05);
  738. input_report_key(input, wacom->tool[0], prox);
  739. return 1;
  740. }
  741. return 0;
  742. }
  743. static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
  744. {
  745. char *data = wacom->data;
  746. dbg("wacom_tpc_irq: received report #%d", data[0]);
  747. switch (len) {
  748. case WACOM_PKGLEN_TPC1FG:
  749. return wacom_tpc_single_touch(wacom, len);
  750. case WACOM_PKGLEN_TPC2FG:
  751. return wacom_tpc_mt_touch(wacom);
  752. default:
  753. switch (data[0]) {
  754. case WACOM_REPORT_TPC1FG:
  755. case WACOM_REPORT_TPCHID:
  756. case WACOM_REPORT_TPCST:
  757. return wacom_tpc_single_touch(wacom, len);
  758. case WACOM_REPORT_PENABLED:
  759. return wacom_tpc_pen(wacom);
  760. }
  761. }
  762. return 0;
  763. }
  764. static int wacom_bpt_touch(struct wacom_wac *wacom)
  765. {
  766. struct wacom_features *features = &wacom->features;
  767. struct input_dev *input = wacom->input;
  768. unsigned char *data = wacom->data;
  769. int i;
  770. if (data[0] != 0x02)
  771. return 0;
  772. for (i = 0; i < 2; i++) {
  773. int offset = (data[1] & 0x80) ? (8 * i) : (9 * i);
  774. bool touch = data[offset + 3] & 0x80;
  775. /*
  776. * Touch events need to be disabled while stylus is
  777. * in proximity because user's hand is resting on touchpad
  778. * and sending unwanted events. User expects tablet buttons
  779. * to continue working though.
  780. */
  781. touch = touch && !wacom->shared->stylus_in_proximity;
  782. input_mt_slot(input, i);
  783. input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
  784. if (touch) {
  785. int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff;
  786. int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff;
  787. if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
  788. x <<= 5;
  789. y <<= 5;
  790. }
  791. input_report_abs(input, ABS_MT_POSITION_X, x);
  792. input_report_abs(input, ABS_MT_POSITION_Y, y);
  793. }
  794. }
  795. input_mt_report_pointer_emulation(input, true);
  796. input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
  797. input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
  798. input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
  799. input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
  800. input_sync(input);
  801. return 0;
  802. }
  803. static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
  804. {
  805. struct input_dev *input = wacom->input;
  806. int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */
  807. bool touch = data[1] & 0x80;
  808. touch = touch && !wacom->shared->stylus_in_proximity;
  809. input_mt_slot(input, slot_id);
  810. input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
  811. if (touch) {
  812. int x = (data[2] << 4) | (data[4] >> 4);
  813. int y = (data[3] << 4) | (data[4] & 0x0f);
  814. int w = data[6];
  815. input_report_abs(input, ABS_MT_POSITION_X, x);
  816. input_report_abs(input, ABS_MT_POSITION_Y, y);
  817. input_report_abs(input, ABS_MT_TOUCH_MAJOR, w);
  818. }
  819. }
  820. static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
  821. {
  822. struct input_dev *input = wacom->input;
  823. input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
  824. input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
  825. input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
  826. input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
  827. }
  828. static int wacom_bpt3_touch(struct wacom_wac *wacom)
  829. {
  830. struct input_dev *input = wacom->input;
  831. unsigned char *data = wacom->data;
  832. int count = data[1] & 0x03;
  833. int i;
  834. if (data[0] != 0x02)
  835. return 0;
  836. /* data has up to 7 fixed sized 8-byte messages starting at data[2] */
  837. for (i = 0; i < count; i++) {
  838. int offset = (8 * i) + 2;
  839. int msg_id = data[offset];
  840. if (msg_id >= 2 && msg_id <= 17)
  841. wacom_bpt3_touch_msg(wacom, data + offset);
  842. else if (msg_id == 128)
  843. wacom_bpt3_button_msg(wacom, data + offset);
  844. }
  845. input_mt_report_pointer_emulation(input, true);
  846. input_sync(input);
  847. return 0;
  848. }
  849. static int wacom_bpt_pen(struct wacom_wac *wacom)
  850. {
  851. struct input_dev *input = wacom->input;
  852. unsigned char *data = wacom->data;
  853. int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
  854. if (data[0] != 0x02)
  855. return 0;
  856. prox = (data[1] & 0x20) == 0x20;
  857. /*
  858. * All reports shared between PEN and RUBBER tool must be
  859. * forced to a known starting value (zero) when transitioning to
  860. * out-of-prox.
  861. *
  862. * If not reset then, to userspace, it will look like lost events
  863. * if new tool comes in-prox with same values as previous tool sent.
  864. *
  865. * Hardware does report zero in most out-of-prox cases but not all.
  866. */
  867. if (prox) {
  868. if (!wacom->shared->stylus_in_proximity) {
  869. if (data[1] & 0x08) {
  870. wacom->tool[0] = BTN_TOOL_RUBBER;
  871. wacom->id[0] = ERASER_DEVICE_ID;
  872. } else {
  873. wacom->tool[0] = BTN_TOOL_PEN;
  874. wacom->id[0] = STYLUS_DEVICE_ID;
  875. }
  876. wacom->shared->stylus_in_proximity = true;
  877. }
  878. x = le16_to_cpup((__le16 *)&data[2]);
  879. y = le16_to_cpup((__le16 *)&data[4]);
  880. p = le16_to_cpup((__le16 *)&data[6]);
  881. /*
  882. * Convert distance from out prox to distance from tablet.
  883. * distance will be greater than distance_max once
  884. * touching and applying pressure; do not report negative
  885. * distance.
  886. */
  887. if (data[8] <= wacom->features.distance_max)
  888. d = wacom->features.distance_max - data[8];
  889. pen = data[1] & 0x01;
  890. btn1 = data[1] & 0x02;
  891. btn2 = data[1] & 0x04;
  892. }
  893. input_report_key(input, BTN_TOUCH, pen);
  894. input_report_key(input, BTN_STYLUS, btn1);
  895. input_report_key(input, BTN_STYLUS2, btn2);
  896. input_report_abs(input, ABS_X, x);
  897. input_report_abs(input, ABS_Y, y);
  898. input_report_abs(input, ABS_PRESSURE, p);
  899. input_report_abs(input, ABS_DISTANCE, d);
  900. if (!prox) {
  901. wacom->id[0] = 0;
  902. wacom->shared->stylus_in_proximity = false;
  903. }
  904. input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */
  905. input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
  906. return 1;
  907. }
  908. static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
  909. {
  910. if (len == WACOM_PKGLEN_BBTOUCH)
  911. return wacom_bpt_touch(wacom);
  912. else if (len == WACOM_PKGLEN_BBTOUCH3)
  913. return wacom_bpt3_touch(wacom);
  914. else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN)
  915. return wacom_bpt_pen(wacom);
  916. return 0;
  917. }
  918. static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
  919. {
  920. unsigned char *data = wacom->data;
  921. int connected;
  922. if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
  923. return 0;
  924. connected = data[1] & 0x01;
  925. if (connected) {
  926. int pid, battery;
  927. pid = get_unaligned_be16(&data[6]);
  928. battery = data[5] & 0x3f;
  929. if (wacom->pid != pid) {
  930. wacom->pid = pid;
  931. wacom_schedule_work(wacom);
  932. }
  933. wacom->battery_capacity = battery;
  934. } else if (wacom->pid != 0) {
  935. /* disconnected while previously connected */
  936. wacom->pid = 0;
  937. wacom_schedule_work(wacom);
  938. wacom->battery_capacity = 0;
  939. }
  940. return 0;
  941. }
  942. void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
  943. {
  944. bool sync;
  945. switch (wacom_wac->features.type) {
  946. case PENPARTNER:
  947. sync = wacom_penpartner_irq(wacom_wac);
  948. break;
  949. case PL:
  950. sync = wacom_pl_irq(wacom_wac);
  951. break;
  952. case WACOM_G4:
  953. case GRAPHIRE:
  954. case WACOM_MO:
  955. sync = wacom_graphire_irq(wacom_wac);
  956. break;
  957. case PTU:
  958. sync = wacom_ptu_irq(wacom_wac);
  959. break;
  960. case DTU:
  961. sync = wacom_dtu_irq(wacom_wac);
  962. break;
  963. case INTUOS:
  964. case INTUOS3S:
  965. case INTUOS3:
  966. case INTUOS3L:
  967. case INTUOS4S:
  968. case INTUOS4:
  969. case INTUOS4L:
  970. case INTUOS5S:
  971. case INTUOS5:
  972. case INTUOS5L:
  973. case CINTIQ:
  974. case WACOM_BEE:
  975. case WACOM_21UX2:
  976. case WACOM_24HD:
  977. sync = wacom_intuos_irq(wacom_wac);
  978. break;
  979. case TABLETPC:
  980. case TABLETPC2FG:
  981. sync = wacom_tpc_irq(wacom_wac, len);
  982. break;
  983. case BAMBOO_PT:
  984. sync = wacom_bpt_irq(wacom_wac, len);
  985. break;
  986. case WIRELESS:
  987. sync = wacom_wireless_irq(wacom_wac, len);
  988. break;
  989. default:
  990. sync = false;
  991. break;
  992. }
  993. if (sync)
  994. input_sync(wacom_wac->input);
  995. }
  996. static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
  997. {
  998. struct input_dev *input_dev = wacom_wac->input;
  999. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  1000. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1001. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1002. __set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
  1003. __set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
  1004. __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
  1005. __set_bit(BTN_STYLUS, input_dev->keybit);
  1006. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1007. input_set_abs_params(input_dev, ABS_DISTANCE,
  1008. 0, wacom_wac->features.distance_max, 0, 0);
  1009. input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
  1010. input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
  1011. input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
  1012. }
  1013. static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
  1014. {
  1015. struct input_dev *input_dev = wacom_wac->input;
  1016. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  1017. wacom_setup_cintiq(wacom_wac);
  1018. __set_bit(BTN_LEFT, input_dev->keybit);
  1019. __set_bit(BTN_RIGHT, input_dev->keybit);
  1020. __set_bit(BTN_MIDDLE, input_dev->keybit);
  1021. __set_bit(BTN_SIDE, input_dev->keybit);
  1022. __set_bit(BTN_EXTRA, input_dev->keybit);
  1023. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  1024. __set_bit(BTN_TOOL_LENS, input_dev->keybit);
  1025. input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
  1026. input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
  1027. }
  1028. void wacom_setup_device_quirks(struct wacom_features *features)
  1029. {
  1030. /* touch device found but size is not defined. use default */
  1031. if (features->device_type == BTN_TOOL_FINGER && !features->x_max) {
  1032. features->x_max = 1023;
  1033. features->y_max = 1023;
  1034. }
  1035. /* these device have multiple inputs */
  1036. if (features->type == TABLETPC || features->type == TABLETPC2FG ||
  1037. features->type == BAMBOO_PT || features->type == WIRELESS)
  1038. features->quirks |= WACOM_QUIRK_MULTI_INPUT;
  1039. /* quirk for bamboo touch with 2 low res touches */
  1040. if (features->type == BAMBOO_PT &&
  1041. features->pktlen == WACOM_PKGLEN_BBTOUCH) {
  1042. features->x_max <<= 5;
  1043. features->y_max <<= 5;
  1044. features->x_fuzz <<= 5;
  1045. features->y_fuzz <<= 5;
  1046. features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
  1047. }
  1048. if (features->type == WIRELESS) {
  1049. /* monitor never has input and pen/touch have delayed create */
  1050. features->quirks |= WACOM_QUIRK_NO_INPUT;
  1051. /* must be monitor interface if no device_type set */
  1052. if (!features->device_type)
  1053. features->quirks |= WACOM_QUIRK_MONITOR;
  1054. }
  1055. }
  1056. static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
  1057. unsigned int physical_max)
  1058. {
  1059. /* Touch physical dimensions are in 100th of mm */
  1060. return (logical_max * 100) / physical_max;
  1061. }
  1062. void wacom_setup_input_capabilities(struct input_dev *input_dev,
  1063. struct wacom_wac *wacom_wac)
  1064. {
  1065. struct wacom_features *features = &wacom_wac->features;
  1066. int i;
  1067. input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
  1068. __set_bit(BTN_TOUCH, input_dev->keybit);
  1069. input_set_abs_params(input_dev, ABS_X, 0, features->x_max,
  1070. features->x_fuzz, 0);
  1071. input_set_abs_params(input_dev, ABS_Y, 0, features->y_max,
  1072. features->y_fuzz, 0);
  1073. if (features->device_type == BTN_TOOL_PEN) {
  1074. input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
  1075. features->pressure_fuzz, 0);
  1076. /* penabled devices have fixed resolution for each model */
  1077. input_abs_set_res(input_dev, ABS_X, features->x_resolution);
  1078. input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
  1079. } else {
  1080. input_abs_set_res(input_dev, ABS_X,
  1081. wacom_calculate_touch_res(features->x_max,
  1082. features->x_phy));
  1083. input_abs_set_res(input_dev, ABS_Y,
  1084. wacom_calculate_touch_res(features->y_max,
  1085. features->y_phy));
  1086. }
  1087. __set_bit(ABS_MISC, input_dev->absbit);
  1088. switch (wacom_wac->features.type) {
  1089. case WACOM_MO:
  1090. input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
  1091. /* fall through */
  1092. case WACOM_G4:
  1093. input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
  1094. __set_bit(BTN_BACK, input_dev->keybit);
  1095. __set_bit(BTN_FORWARD, input_dev->keybit);
  1096. /* fall through */
  1097. case GRAPHIRE:
  1098. input_set_capability(input_dev, EV_REL, REL_WHEEL);
  1099. __set_bit(BTN_LEFT, input_dev->keybit);
  1100. __set_bit(BTN_RIGHT, input_dev->keybit);
  1101. __set_bit(BTN_MIDDLE, input_dev->keybit);
  1102. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1103. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1104. __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  1105. __set_bit(BTN_STYLUS, input_dev->keybit);
  1106. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1107. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  1108. break;
  1109. case WACOM_24HD:
  1110. __set_bit(BTN_A, input_dev->keybit);
  1111. __set_bit(BTN_B, input_dev->keybit);
  1112. __set_bit(BTN_C, input_dev->keybit);
  1113. __set_bit(BTN_X, input_dev->keybit);
  1114. __set_bit(BTN_Y, input_dev->keybit);
  1115. __set_bit(BTN_Z, input_dev->keybit);
  1116. for (i = 0; i < 10; i++)
  1117. __set_bit(BTN_0 + i, input_dev->keybit);
  1118. __set_bit(KEY_PROG1, input_dev->keybit);
  1119. __set_bit(KEY_PROG2, input_dev->keybit);
  1120. __set_bit(KEY_PROG3, input_dev->keybit);
  1121. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  1122. input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
  1123. wacom_setup_cintiq(wacom_wac);
  1124. break;
  1125. case WACOM_21UX2:
  1126. __set_bit(BTN_A, input_dev->keybit);
  1127. __set_bit(BTN_B, input_dev->keybit);
  1128. __set_bit(BTN_C, input_dev->keybit);
  1129. __set_bit(BTN_X, input_dev->keybit);
  1130. __set_bit(BTN_Y, input_dev->keybit);
  1131. __set_bit(BTN_Z, input_dev->keybit);
  1132. __set_bit(BTN_BASE, input_dev->keybit);
  1133. __set_bit(BTN_BASE2, input_dev->keybit);
  1134. /* fall through */
  1135. case WACOM_BEE:
  1136. __set_bit(BTN_8, input_dev->keybit);
  1137. __set_bit(BTN_9, input_dev->keybit);
  1138. /* fall through */
  1139. case CINTIQ:
  1140. for (i = 0; i < 8; i++)
  1141. __set_bit(BTN_0 + i, input_dev->keybit);
  1142. input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
  1143. input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
  1144. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  1145. __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
  1146. wacom_setup_cintiq(wacom_wac);
  1147. break;
  1148. case INTUOS3:
  1149. case INTUOS3L:
  1150. __set_bit(BTN_4, input_dev->keybit);
  1151. __set_bit(BTN_5, input_dev->keybit);
  1152. __set_bit(BTN_6, input_dev->keybit);
  1153. __set_bit(BTN_7, input_dev->keybit);
  1154. input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
  1155. /* fall through */
  1156. case INTUOS3S:
  1157. __set_bit(BTN_0, input_dev->keybit);
  1158. __set_bit(BTN_1, input_dev->keybit);
  1159. __set_bit(BTN_2, input_dev->keybit);
  1160. __set_bit(BTN_3, input_dev->keybit);
  1161. input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
  1162. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  1163. /* fall through */
  1164. case INTUOS:
  1165. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  1166. wacom_setup_intuos(wacom_wac);
  1167. break;
  1168. case INTUOS5:
  1169. case INTUOS5L:
  1170. case INTUOS4:
  1171. case INTUOS4L:
  1172. __set_bit(BTN_7, input_dev->keybit);
  1173. __set_bit(BTN_8, input_dev->keybit);
  1174. /* fall through */
  1175. case INTUOS5S:
  1176. case INTUOS4S:
  1177. for (i = 0; i < 7; i++)
  1178. __set_bit(BTN_0 + i, input_dev->keybit);
  1179. input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
  1180. wacom_setup_intuos(wacom_wac);
  1181. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  1182. break;
  1183. case TABLETPC2FG:
  1184. if (features->device_type == BTN_TOOL_FINGER) {
  1185. input_mt_init_slots(input_dev, 2);
  1186. input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
  1187. 0, MT_TOOL_MAX, 0, 0);
  1188. input_set_abs_params(input_dev, ABS_MT_POSITION_X,
  1189. 0, features->x_max, 0, 0);
  1190. input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
  1191. 0, features->y_max, 0, 0);
  1192. }
  1193. /* fall through */
  1194. case TABLETPC:
  1195. __clear_bit(ABS_MISC, input_dev->absbit);
  1196. __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
  1197. if (features->device_type != BTN_TOOL_PEN)
  1198. break; /* no need to process stylus stuff */
  1199. /* fall through */
  1200. case PL:
  1201. case DTU:
  1202. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1203. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1204. __set_bit(BTN_STYLUS, input_dev->keybit);
  1205. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1206. __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
  1207. break;
  1208. case PTU:
  1209. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1210. /* fall through */
  1211. case PENPARTNER:
  1212. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1213. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1214. __set_bit(BTN_STYLUS, input_dev->keybit);
  1215. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  1216. break;
  1217. case BAMBOO_PT:
  1218. __clear_bit(ABS_MISC, input_dev->absbit);
  1219. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  1220. if (features->device_type == BTN_TOOL_FINGER) {
  1221. __set_bit(BTN_LEFT, input_dev->keybit);
  1222. __set_bit(BTN_FORWARD, input_dev->keybit);
  1223. __set_bit(BTN_BACK, input_dev->keybit);
  1224. __set_bit(BTN_RIGHT, input_dev->keybit);
  1225. __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
  1226. __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
  1227. if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
  1228. __set_bit(BTN_TOOL_TRIPLETAP,
  1229. input_dev->keybit);
  1230. __set_bit(BTN_TOOL_QUADTAP,
  1231. input_dev->keybit);
  1232. input_mt_init_slots(input_dev, 16);
  1233. input_set_abs_params(input_dev,
  1234. ABS_MT_TOUCH_MAJOR,
  1235. 0, 255, 0, 0);
  1236. } else {
  1237. input_mt_init_slots(input_dev, 2);
  1238. }
  1239. input_set_abs_params(input_dev, ABS_MT_POSITION_X,
  1240. 0, features->x_max,
  1241. features->x_fuzz, 0);
  1242. input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
  1243. 0, features->y_max,
  1244. features->y_fuzz, 0);
  1245. } else if (features->device_type == BTN_TOOL_PEN) {
  1246. __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  1247. __set_bit(BTN_TOOL_PEN, input_dev->keybit);
  1248. __set_bit(BTN_STYLUS, input_dev->keybit);
  1249. __set_bit(BTN_STYLUS2, input_dev->keybit);
  1250. input_set_abs_params(input_dev, ABS_DISTANCE, 0,
  1251. features->distance_max,
  1252. 0, 0);
  1253. }
  1254. break;
  1255. }
  1256. }
  1257. static const struct wacom_features wacom_features_0x00 =
  1258. { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
  1259. 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
  1260. static const struct wacom_features wacom_features_0x10 =
  1261. { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
  1262. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1263. static const struct wacom_features wacom_features_0x11 =
  1264. { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
  1265. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1266. static const struct wacom_features wacom_features_0x12 =
  1267. { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511,
  1268. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1269. static const struct wacom_features wacom_features_0x13 =
  1270. { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
  1271. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1272. static const struct wacom_features wacom_features_0x14 =
  1273. { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
  1274. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1275. static const struct wacom_features wacom_features_0x15 =
  1276. { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
  1277. 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1278. static const struct wacom_features wacom_features_0x16 =
  1279. { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
  1280. 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1281. static const struct wacom_features wacom_features_0x17 =
  1282. { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
  1283. 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1284. static const struct wacom_features wacom_features_0x18 =
  1285. { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511,
  1286. 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1287. static const struct wacom_features wacom_features_0x19 =
  1288. { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
  1289. 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
  1290. static const struct wacom_features wacom_features_0x60 =
  1291. { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
  1292. 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
  1293. static const struct wacom_features wacom_features_0x61 =
  1294. { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255,
  1295. 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
  1296. static const struct wacom_features wacom_features_0x62 =
  1297. { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
  1298. 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
  1299. static const struct wacom_features wacom_features_0x63 =
  1300. { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511,
  1301. 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
  1302. static const struct wacom_features wacom_features_0x64 =
  1303. { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511,
  1304. 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
  1305. static const struct wacom_features wacom_features_0x65 =
  1306. { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
  1307. 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1308. static const struct wacom_features wacom_features_0x69 =
  1309. { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
  1310. 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
  1311. static const struct wacom_features wacom_features_0x6A =
  1312. { "Wacom Bamboo1 4x6", WACOM_PKGLEN_GRAPHIRE, 14760, 9225, 1023,
  1313. 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1314. static const struct wacom_features wacom_features_0x6B =
  1315. { "Wacom Bamboo1 5x8", WACOM_PKGLEN_GRAPHIRE, 21648, 13530, 1023,
  1316. 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1317. static const struct wacom_features wacom_features_0x20 =
  1318. { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
  1319. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1320. static const struct wacom_features wacom_features_0x21 =
  1321. { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
  1322. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1323. static const struct wacom_features wacom_features_0x22 =
  1324. { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
  1325. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1326. static const struct wacom_features wacom_features_0x23 =
  1327. { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
  1328. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1329. static const struct wacom_features wacom_features_0x24 =
  1330. { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
  1331. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1332. static const struct wacom_features wacom_features_0x30 =
  1333. { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255,
  1334. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1335. static const struct wacom_features wacom_features_0x31 =
  1336. { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255,
  1337. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1338. static const struct wacom_features wacom_features_0x32 =
  1339. { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255,
  1340. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1341. static const struct wacom_features wacom_features_0x33 =
  1342. { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255,
  1343. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1344. static const struct wacom_features wacom_features_0x34 =
  1345. { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511,
  1346. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1347. static const struct wacom_features wacom_features_0x35 =
  1348. { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511,
  1349. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1350. static const struct wacom_features wacom_features_0x37 =
  1351. { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511,
  1352. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1353. static const struct wacom_features wacom_features_0x38 =
  1354. { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
  1355. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1356. static const struct wacom_features wacom_features_0x39 =
  1357. { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511,
  1358. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1359. static const struct wacom_features wacom_features_0xC4 =
  1360. { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
  1361. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1362. static const struct wacom_features wacom_features_0xC0 =
  1363. { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
  1364. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1365. static const struct wacom_features wacom_features_0xC2 =
  1366. { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
  1367. 0, PL, WACOM_PL_RES, WACOM_PL_RES };
  1368. static const struct wacom_features wacom_features_0x03 =
  1369. { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511,
  1370. 0, PTU, WACOM_PL_RES, WACOM_PL_RES };
  1371. static const struct wacom_features wacom_features_0x41 =
  1372. { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
  1373. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1374. static const struct wacom_features wacom_features_0x42 =
  1375. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
  1376. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1377. static const struct wacom_features wacom_features_0x43 =
  1378. { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
  1379. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1380. static const struct wacom_features wacom_features_0x44 =
  1381. { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
  1382. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1383. static const struct wacom_features wacom_features_0x45 =
  1384. { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
  1385. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1386. static const struct wacom_features wacom_features_0xB0 =
  1387. { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023,
  1388. 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1389. static const struct wacom_features wacom_features_0xB1 =
  1390. { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023,
  1391. 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1392. static const struct wacom_features wacom_features_0xB2 =
  1393. { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023,
  1394. 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1395. static const struct wacom_features wacom_features_0xB3 =
  1396. { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023,
  1397. 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1398. static const struct wacom_features wacom_features_0xB4 =
  1399. { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023,
  1400. 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1401. static const struct wacom_features wacom_features_0xB5 =
  1402. { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023,
  1403. 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1404. static const struct wacom_features wacom_features_0xB7 =
  1405. { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023,
  1406. 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1407. static const struct wacom_features wacom_features_0xB8 =
  1408. { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
  1409. 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1410. static const struct wacom_features wacom_features_0xB9 =
  1411. { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
  1412. 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1413. static const struct wacom_features wacom_features_0xBA =
  1414. { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
  1415. 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1416. static const struct wacom_features wacom_features_0xBB =
  1417. { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047,
  1418. 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1419. static const struct wacom_features wacom_features_0xBC =
  1420. { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047,
  1421. 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1422. static const struct wacom_features wacom_features_0x26 =
  1423. { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
  1424. 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1425. static const struct wacom_features wacom_features_0x27 =
  1426. { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
  1427. 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1428. static const struct wacom_features wacom_features_0x28 =
  1429. { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
  1430. 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1431. static const struct wacom_features wacom_features_0x29 =
  1432. { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
  1433. 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1434. static const struct wacom_features wacom_features_0x2A =
  1435. { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
  1436. 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1437. static const struct wacom_features wacom_features_0xF4 =
  1438. { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047,
  1439. 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1440. static const struct wacom_features wacom_features_0x3F =
  1441. { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023,
  1442. 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1443. static const struct wacom_features wacom_features_0xC5 =
  1444. { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023,
  1445. 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1446. static const struct wacom_features wacom_features_0xC6 =
  1447. { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023,
  1448. 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1449. static const struct wacom_features wacom_features_0xC7 =
  1450. { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511,
  1451. 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1452. static const struct wacom_features wacom_features_0xCE =
  1453. { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511,
  1454. 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1455. static const struct wacom_features wacom_features_0xF0 =
  1456. { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511,
  1457. 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1458. static const struct wacom_features wacom_features_0xCC =
  1459. { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047,
  1460. 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
  1461. static const struct wacom_features wacom_features_0x90 =
  1462. { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
  1463. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1464. static const struct wacom_features wacom_features_0x93 =
  1465. { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
  1466. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1467. static const struct wacom_features wacom_features_0x97 =
  1468. { "Wacom ISDv4 97", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 511,
  1469. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1470. static const struct wacom_features wacom_features_0x9A =
  1471. { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
  1472. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1473. static const struct wacom_features wacom_features_0x9F =
  1474. { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
  1475. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1476. static const struct wacom_features wacom_features_0xE2 =
  1477. { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
  1478. 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1479. static const struct wacom_features wacom_features_0xE3 =
  1480. { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
  1481. 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1482. static const struct wacom_features wacom_features_0xE6 =
  1483. { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255,
  1484. 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1485. static const struct wacom_features wacom_features_0xEC =
  1486. { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255,
  1487. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1488. static const struct wacom_features wacom_features_0x47 =
  1489. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
  1490. 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1491. static const struct wacom_features wacom_features_0x84 =
  1492. { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0,
  1493. 0, WIRELESS, 0, 0 };
  1494. static const struct wacom_features wacom_features_0xD0 =
  1495. { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1496. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1497. static const struct wacom_features wacom_features_0xD1 =
  1498. { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1499. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1500. static const struct wacom_features wacom_features_0xD2 =
  1501. { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1502. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1503. static const struct wacom_features wacom_features_0xD3 =
  1504. { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
  1505. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1506. static const struct wacom_features wacom_features_0xD4 =
  1507. { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1508. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1509. static const struct wacom_features wacom_features_0xD5 =
  1510. { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
  1511. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1512. static const struct wacom_features wacom_features_0xD6 =
  1513. { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1514. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1515. static const struct wacom_features wacom_features_0xD7 =
  1516. { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1517. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1518. static const struct wacom_features wacom_features_0xD8 =
  1519. { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
  1520. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1521. static const struct wacom_features wacom_features_0xDA =
  1522. { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
  1523. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1524. static struct wacom_features wacom_features_0xDB =
  1525. { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
  1526. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1527. static const struct wacom_features wacom_features_0xDD =
  1528. { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
  1529. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1530. static const struct wacom_features wacom_features_0xDE =
  1531. { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
  1532. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1533. static const struct wacom_features wacom_features_0xDF =
  1534. { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023,
  1535. 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1536. static const struct wacom_features wacom_features_0x6004 =
  1537. { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
  1538. 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  1539. #define USB_DEVICE_WACOM(prod) \
  1540. USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
  1541. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  1542. #define USB_DEVICE_DETAILED(prod, class, sub, proto) \
  1543. USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_WACOM, prod, class, \
  1544. sub, proto), \
  1545. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  1546. #define USB_DEVICE_LENOVO(prod) \
  1547. USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
  1548. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  1549. const struct usb_device_id wacom_ids[] = {
  1550. { USB_DEVICE_WACOM(0x00) },
  1551. { USB_DEVICE_WACOM(0x10) },
  1552. { USB_DEVICE_WACOM(0x11) },
  1553. { USB_DEVICE_WACOM(0x12) },
  1554. { USB_DEVICE_WACOM(0x13) },
  1555. { USB_DEVICE_WACOM(0x14) },
  1556. { USB_DEVICE_WACOM(0x15) },
  1557. { USB_DEVICE_WACOM(0x16) },
  1558. { USB_DEVICE_WACOM(0x17) },
  1559. { USB_DEVICE_WACOM(0x18) },
  1560. { USB_DEVICE_WACOM(0x19) },
  1561. { USB_DEVICE_WACOM(0x60) },
  1562. { USB_DEVICE_WACOM(0x61) },
  1563. { USB_DEVICE_WACOM(0x62) },
  1564. { USB_DEVICE_WACOM(0x63) },
  1565. { USB_DEVICE_WACOM(0x64) },
  1566. { USB_DEVICE_WACOM(0x65) },
  1567. { USB_DEVICE_WACOM(0x69) },
  1568. { USB_DEVICE_WACOM(0x6A) },
  1569. { USB_DEVICE_WACOM(0x6B) },
  1570. { USB_DEVICE_WACOM(0x20) },
  1571. { USB_DEVICE_WACOM(0x21) },
  1572. { USB_DEVICE_WACOM(0x22) },
  1573. { USB_DEVICE_WACOM(0x23) },
  1574. { USB_DEVICE_WACOM(0x24) },
  1575. { USB_DEVICE_WACOM(0x30) },
  1576. { USB_DEVICE_WACOM(0x31) },
  1577. { USB_DEVICE_WACOM(0x32) },
  1578. { USB_DEVICE_WACOM(0x33) },
  1579. { USB_DEVICE_WACOM(0x34) },
  1580. { USB_DEVICE_WACOM(0x35) },
  1581. { USB_DEVICE_WACOM(0x37) },
  1582. { USB_DEVICE_WACOM(0x38) },
  1583. { USB_DEVICE_WACOM(0x39) },
  1584. { USB_DEVICE_WACOM(0xC4) },
  1585. { USB_DEVICE_WACOM(0xC0) },
  1586. { USB_DEVICE_WACOM(0xC2) },
  1587. { USB_DEVICE_WACOM(0x03) },
  1588. { USB_DEVICE_WACOM(0x41) },
  1589. { USB_DEVICE_WACOM(0x42) },
  1590. { USB_DEVICE_WACOM(0x43) },
  1591. { USB_DEVICE_WACOM(0x44) },
  1592. { USB_DEVICE_WACOM(0x45) },
  1593. { USB_DEVICE_WACOM(0xB0) },
  1594. { USB_DEVICE_WACOM(0xB1) },
  1595. { USB_DEVICE_WACOM(0xB2) },
  1596. { USB_DEVICE_WACOM(0xB3) },
  1597. { USB_DEVICE_WACOM(0xB4) },
  1598. { USB_DEVICE_WACOM(0xB5) },
  1599. { USB_DEVICE_WACOM(0xB7) },
  1600. { USB_DEVICE_WACOM(0xB8) },
  1601. { USB_DEVICE_WACOM(0xB9) },
  1602. { USB_DEVICE_WACOM(0xBA) },
  1603. { USB_DEVICE_WACOM(0xBB) },
  1604. { USB_DEVICE_WACOM(0xBC) },
  1605. { USB_DEVICE_WACOM(0x26) },
  1606. { USB_DEVICE_WACOM(0x27) },
  1607. { USB_DEVICE_WACOM(0x28) },
  1608. { USB_DEVICE_WACOM(0x29) },
  1609. { USB_DEVICE_WACOM(0x2A) },
  1610. { USB_DEVICE_WACOM(0x3F) },
  1611. { USB_DEVICE_WACOM(0xC5) },
  1612. { USB_DEVICE_WACOM(0xC6) },
  1613. { USB_DEVICE_WACOM(0xC7) },
  1614. /*
  1615. * DTU-2231 has two interfaces on the same configuration,
  1616. * only one is used.
  1617. */
  1618. { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID,
  1619. USB_INTERFACE_SUBCLASS_BOOT,
  1620. USB_INTERFACE_PROTOCOL_MOUSE) },
  1621. { USB_DEVICE_WACOM(0x84) },
  1622. { USB_DEVICE_WACOM(0xD0) },
  1623. { USB_DEVICE_WACOM(0xD1) },
  1624. { USB_DEVICE_WACOM(0xD2) },
  1625. { USB_DEVICE_WACOM(0xD3) },
  1626. { USB_DEVICE_WACOM(0xD4) },
  1627. { USB_DEVICE_WACOM(0xD5) },
  1628. { USB_DEVICE_WACOM(0xD6) },
  1629. { USB_DEVICE_WACOM(0xD7) },
  1630. { USB_DEVICE_WACOM(0xD8) },
  1631. { USB_DEVICE_WACOM(0xDA) },
  1632. { USB_DEVICE_WACOM(0xDB) },
  1633. { USB_DEVICE_WACOM(0xDD) },
  1634. { USB_DEVICE_WACOM(0xDE) },
  1635. { USB_DEVICE_WACOM(0xDF) },
  1636. { USB_DEVICE_WACOM(0xF0) },
  1637. { USB_DEVICE_WACOM(0xCC) },
  1638. { USB_DEVICE_WACOM(0x90) },
  1639. { USB_DEVICE_WACOM(0x93) },
  1640. { USB_DEVICE_WACOM(0x97) },
  1641. { USB_DEVICE_WACOM(0x9A) },
  1642. { USB_DEVICE_WACOM(0x9F) },
  1643. { USB_DEVICE_WACOM(0xE2) },
  1644. { USB_DEVICE_WACOM(0xE3) },
  1645. { USB_DEVICE_WACOM(0xE6) },
  1646. { USB_DEVICE_WACOM(0xEC) },
  1647. { USB_DEVICE_WACOM(0x47) },
  1648. { USB_DEVICE_WACOM(0xF4) },
  1649. { USB_DEVICE_LENOVO(0x6004) },
  1650. { }
  1651. };
  1652. MODULE_DEVICE_TABLE(usb, wacom_ids);