wacom_wac.c 77 KB

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