wacom_wac.c 63 KB

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