wacom_wac.c 77 KB

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