wacom_wac.c 81 KB

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