wacom_wac.c 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  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.h"
  14. #include "wacom_wac.h"
  15. static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
  16. {
  17. unsigned char *data = wacom->data;
  18. switch (data[0]) {
  19. case 1:
  20. if (data[5] & 0x80) {
  21. wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  22. wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
  23. wacom_report_key(wcombo, wacom->tool[0], 1);
  24. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
  25. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1]));
  26. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3]));
  27. wacom_report_abs(wcombo, ABS_PRESSURE, (signed char)data[6] + 127);
  28. wacom_report_key(wcombo, BTN_TOUCH, ((signed char)data[6] > -127));
  29. wacom_report_key(wcombo, BTN_STYLUS, (data[5] & 0x40));
  30. } else {
  31. wacom_report_key(wcombo, wacom->tool[0], 0);
  32. wacom_report_abs(wcombo, ABS_MISC, 0); /* report tool id */
  33. wacom_report_abs(wcombo, ABS_PRESSURE, -1);
  34. wacom_report_key(wcombo, BTN_TOUCH, 0);
  35. }
  36. break;
  37. case 2:
  38. wacom_report_key(wcombo, BTN_TOOL_PEN, 1);
  39. wacom_report_abs(wcombo, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
  40. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1]));
  41. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3]));
  42. wacom_report_abs(wcombo, ABS_PRESSURE, (signed char)data[6] + 127);
  43. wacom_report_key(wcombo, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
  44. wacom_report_key(wcombo, BTN_STYLUS, (data[5] & 0x40));
  45. break;
  46. default:
  47. printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]);
  48. return 0;
  49. }
  50. return 1;
  51. }
  52. static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
  53. {
  54. struct wacom_features *features = &wacom->features;
  55. unsigned char *data = wacom->data;
  56. int prox, pressure;
  57. if (data[0] != WACOM_REPORT_PENABLED) {
  58. dbg("wacom_pl_irq: received unknown report #%d", data[0]);
  59. return 0;
  60. }
  61. prox = data[1] & 0x40;
  62. if (prox) {
  63. wacom->id[0] = ERASER_DEVICE_ID;
  64. pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
  65. if (features->pressure_max > 255)
  66. pressure = (pressure << 1) | ((data[4] >> 6) & 1);
  67. pressure += (features->pressure_max + 1) / 2;
  68. /*
  69. * if going from out of proximity into proximity select between the eraser
  70. * and the pen based on the state of the stylus2 button, choose eraser if
  71. * pressed else choose pen. if not a proximity change from out to in, send
  72. * an out of proximity for previous tool then a in for new tool.
  73. */
  74. if (!wacom->tool[0]) {
  75. /* Eraser bit set for DTF */
  76. if (data[1] & 0x10)
  77. wacom->tool[1] = BTN_TOOL_RUBBER;
  78. else
  79. /* Going into proximity select tool */
  80. wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  81. } else {
  82. /* was entered with stylus2 pressed */
  83. if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
  84. /* report out proximity for previous tool */
  85. wacom_report_key(wcombo, wacom->tool[1], 0);
  86. wacom_input_sync(wcombo);
  87. wacom->tool[1] = BTN_TOOL_PEN;
  88. return 0;
  89. }
  90. }
  91. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  92. /* Unknown tool selected default to pen tool */
  93. wacom->tool[1] = BTN_TOOL_PEN;
  94. wacom->id[0] = STYLUS_DEVICE_ID;
  95. }
  96. wacom_report_key(wcombo, wacom->tool[1], prox); /* report in proximity for tool */
  97. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
  98. wacom_report_abs(wcombo, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
  99. wacom_report_abs(wcombo, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
  100. wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
  101. wacom_report_key(wcombo, BTN_TOUCH, data[4] & 0x08);
  102. wacom_report_key(wcombo, BTN_STYLUS, data[4] & 0x10);
  103. /* Only allow the stylus2 button to be reported for the pen tool. */
  104. wacom_report_key(wcombo, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
  105. } else {
  106. /* report proximity-out of a (valid) tool */
  107. if (wacom->tool[1] != BTN_TOOL_RUBBER) {
  108. /* Unknown tool selected default to pen tool */
  109. wacom->tool[1] = BTN_TOOL_PEN;
  110. }
  111. wacom_report_key(wcombo, wacom->tool[1], prox);
  112. }
  113. wacom->tool[0] = prox; /* Save proximity state */
  114. return 1;
  115. }
  116. static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
  117. {
  118. unsigned char *data = wacom->data;
  119. if (data[0] != WACOM_REPORT_PENABLED) {
  120. printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
  121. return 0;
  122. }
  123. if (data[1] & 0x04) {
  124. wacom_report_key(wcombo, BTN_TOOL_RUBBER, data[1] & 0x20);
  125. wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x08);
  126. wacom->id[0] = ERASER_DEVICE_ID;
  127. } else {
  128. wacom_report_key(wcombo, BTN_TOOL_PEN, data[1] & 0x20);
  129. wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01);
  130. wacom->id[0] = STYLUS_DEVICE_ID;
  131. }
  132. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
  133. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
  134. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
  135. wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
  136. wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
  137. wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
  138. return 1;
  139. }
  140. static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
  141. {
  142. struct wacom_features *features = &wacom->features;
  143. unsigned char *data = wacom->data;
  144. int x, y, prox;
  145. int rw = 0;
  146. int retval = 0;
  147. if (data[0] != WACOM_REPORT_PENABLED) {
  148. dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
  149. goto exit;
  150. }
  151. prox = data[1] & 0x80;
  152. if (prox || wacom->id[0]) {
  153. if (prox) {
  154. switch ((data[1] >> 5) & 3) {
  155. case 0: /* Pen */
  156. wacom->tool[0] = BTN_TOOL_PEN;
  157. wacom->id[0] = STYLUS_DEVICE_ID;
  158. break;
  159. case 1: /* Rubber */
  160. wacom->tool[0] = BTN_TOOL_RUBBER;
  161. wacom->id[0] = ERASER_DEVICE_ID;
  162. break;
  163. case 2: /* Mouse with wheel */
  164. wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04);
  165. /* fall through */
  166. case 3: /* Mouse without wheel */
  167. wacom->tool[0] = BTN_TOOL_MOUSE;
  168. wacom->id[0] = CURSOR_DEVICE_ID;
  169. break;
  170. }
  171. }
  172. x = wacom_le16_to_cpu(&data[2]);
  173. y = wacom_le16_to_cpu(&data[4]);
  174. wacom_report_abs(wcombo, ABS_X, x);
  175. wacom_report_abs(wcombo, ABS_Y, y);
  176. if (wacom->tool[0] != BTN_TOOL_MOUSE) {
  177. wacom_report_abs(wcombo, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
  178. wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01);
  179. wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
  180. wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04);
  181. } else {
  182. wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
  183. wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
  184. if (features->type == WACOM_G4 ||
  185. features->type == WACOM_MO) {
  186. wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
  187. rw = (signed)(data[7] & 0x04) - (data[7] & 0x03);
  188. } else {
  189. wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
  190. rw = -(signed)data[6];
  191. }
  192. wacom_report_rel(wcombo, REL_WHEEL, rw);
  193. }
  194. if (!prox)
  195. wacom->id[0] = 0;
  196. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
  197. wacom_report_key(wcombo, wacom->tool[0], prox);
  198. wacom_input_sync(wcombo); /* sync last event */
  199. }
  200. /* send pad data */
  201. switch (features->type) {
  202. case WACOM_G4:
  203. prox = data[7] & 0xf8;
  204. if (prox || wacom->id[1]) {
  205. wacom->id[1] = PAD_DEVICE_ID;
  206. wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
  207. wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
  208. rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
  209. wacom_report_rel(wcombo, REL_WHEEL, rw);
  210. wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
  211. wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
  212. if (!prox)
  213. wacom->id[1] = 0;
  214. wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
  215. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
  216. }
  217. retval = 1;
  218. break;
  219. case WACOM_MO:
  220. prox = (data[7] & 0xf8) || data[8];
  221. if (prox || wacom->id[1]) {
  222. wacom->id[1] = PAD_DEVICE_ID;
  223. wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
  224. wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
  225. wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
  226. wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
  227. wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
  228. wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
  229. if (!prox)
  230. wacom->id[1] = 0;
  231. wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
  232. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
  233. }
  234. retval = 1;
  235. break;
  236. }
  237. exit:
  238. return retval;
  239. }
  240. static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
  241. {
  242. struct wacom_features *features = &wacom->features;
  243. unsigned char *data = wacom->data;
  244. int idx = 0;
  245. /* tool number */
  246. if (features->type == INTUOS)
  247. idx = data[1] & 0x01;
  248. /* Enter report */
  249. if ((data[1] & 0xfc) == 0xc0) {
  250. /* serial number of the tool */
  251. wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
  252. (data[4] << 20) + (data[5] << 12) +
  253. (data[6] << 4) + (data[7] >> 4);
  254. wacom->id[idx] = (data[2] << 4) | (data[3] >> 4);
  255. switch (wacom->id[idx]) {
  256. case 0x812: /* Inking pen */
  257. case 0x801: /* Intuos3 Inking pen */
  258. case 0x20802: /* Intuos4 Classic Pen */
  259. case 0x012:
  260. wacom->tool[idx] = BTN_TOOL_PENCIL;
  261. break;
  262. case 0x822: /* Pen */
  263. case 0x842:
  264. case 0x852:
  265. case 0x823: /* Intuos3 Grip Pen */
  266. case 0x813: /* Intuos3 Classic Pen */
  267. case 0x885: /* Intuos3 Marker Pen */
  268. case 0x802: /* Intuos4 Grip Pen Eraser */
  269. case 0x804: /* Intuos4 Marker Pen */
  270. case 0x40802: /* Intuos4 Classic Pen */
  271. case 0x022:
  272. wacom->tool[idx] = BTN_TOOL_PEN;
  273. break;
  274. case 0x832: /* Stroke pen */
  275. case 0x032:
  276. wacom->tool[idx] = BTN_TOOL_BRUSH;
  277. break;
  278. case 0x007: /* Mouse 4D and 2D */
  279. case 0x09c:
  280. case 0x094:
  281. case 0x017: /* Intuos3 2D Mouse */
  282. case 0x806: /* Intuos4 Mouse */
  283. wacom->tool[idx] = BTN_TOOL_MOUSE;
  284. break;
  285. case 0x096: /* Lens cursor */
  286. case 0x097: /* Intuos3 Lens cursor */
  287. case 0x006: /* Intuos4 Lens cursor */
  288. wacom->tool[idx] = BTN_TOOL_LENS;
  289. break;
  290. case 0x82a: /* Eraser */
  291. case 0x85a:
  292. case 0x91a:
  293. case 0xd1a:
  294. case 0x0fa:
  295. case 0x82b: /* Intuos3 Grip Pen Eraser */
  296. case 0x81b: /* Intuos3 Classic Pen Eraser */
  297. case 0x91b: /* Intuos3 Airbrush Eraser */
  298. case 0x80c: /* Intuos4 Marker Pen Eraser */
  299. case 0x80a: /* Intuos4 Grip Pen Eraser */
  300. case 0x4080a: /* Intuos4 Classic Pen Eraser */
  301. case 0x90a: /* Intuos4 Airbrush Eraser */
  302. wacom->tool[idx] = BTN_TOOL_RUBBER;
  303. break;
  304. case 0xd12:
  305. case 0x912:
  306. case 0x112:
  307. case 0x913: /* Intuos3 Airbrush */
  308. case 0x902: /* Intuos4 Airbrush */
  309. wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
  310. break;
  311. default: /* Unknown tool */
  312. wacom->tool[idx] = BTN_TOOL_PEN;
  313. }
  314. return 1;
  315. }
  316. /* Exit report */
  317. if ((data[1] & 0xfe) == 0x80) {
  318. /*
  319. * Reset all states otherwise we lose the initial states
  320. * when in-prox next time
  321. */
  322. wacom_report_abs(wcombo, ABS_X, 0);
  323. wacom_report_abs(wcombo, ABS_Y, 0);
  324. wacom_report_abs(wcombo, ABS_DISTANCE, 0);
  325. wacom_report_abs(wcombo, ABS_TILT_X, 0);
  326. wacom_report_abs(wcombo, ABS_TILT_Y, 0);
  327. if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
  328. wacom_report_key(wcombo, BTN_LEFT, 0);
  329. wacom_report_key(wcombo, BTN_MIDDLE, 0);
  330. wacom_report_key(wcombo, BTN_RIGHT, 0);
  331. wacom_report_key(wcombo, BTN_SIDE, 0);
  332. wacom_report_key(wcombo, BTN_EXTRA, 0);
  333. wacom_report_abs(wcombo, ABS_THROTTLE, 0);
  334. wacom_report_abs(wcombo, ABS_RZ, 0);
  335. } else {
  336. wacom_report_abs(wcombo, ABS_PRESSURE, 0);
  337. wacom_report_key(wcombo, BTN_STYLUS, 0);
  338. wacom_report_key(wcombo, BTN_STYLUS2, 0);
  339. wacom_report_key(wcombo, BTN_TOUCH, 0);
  340. wacom_report_abs(wcombo, ABS_WHEEL, 0);
  341. if (features->type >= INTUOS3S)
  342. wacom_report_abs(wcombo, ABS_Z, 0);
  343. }
  344. wacom_report_key(wcombo, wacom->tool[idx], 0);
  345. wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
  346. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  347. wacom->id[idx] = 0;
  348. return 2;
  349. }
  350. return 0;
  351. }
  352. static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
  353. {
  354. struct wacom_features *features = &wacom->features;
  355. unsigned char *data = wacom->data;
  356. unsigned int t;
  357. /* general pen packet */
  358. if ((data[1] & 0xb8) == 0xa0) {
  359. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  360. if (features->type >= INTUOS4S && features->type <= INTUOS4L)
  361. t = (t << 1) | (data[1] & 1);
  362. wacom_report_abs(wcombo, ABS_PRESSURE, t);
  363. wacom_report_abs(wcombo, ABS_TILT_X,
  364. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  365. wacom_report_abs(wcombo, ABS_TILT_Y, data[8] & 0x7f);
  366. wacom_report_key(wcombo, BTN_STYLUS, data[1] & 2);
  367. wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 4);
  368. wacom_report_key(wcombo, BTN_TOUCH, t > 10);
  369. }
  370. /* airbrush second packet */
  371. if ((data[1] & 0xbc) == 0xb4) {
  372. wacom_report_abs(wcombo, ABS_WHEEL,
  373. (data[6] << 2) | ((data[7] >> 6) & 3));
  374. wacom_report_abs(wcombo, ABS_TILT_X,
  375. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  376. wacom_report_abs(wcombo, ABS_TILT_Y, data[8] & 0x7f);
  377. }
  378. return;
  379. }
  380. static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
  381. {
  382. struct wacom_features *features = &wacom->features;
  383. unsigned char *data = wacom->data;
  384. unsigned int t;
  385. int idx = 0, result;
  386. if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD
  387. && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) {
  388. dbg("wacom_intuos_irq: received unknown report #%d", data[0]);
  389. return 0;
  390. }
  391. /* tool number */
  392. if (features->type == INTUOS)
  393. idx = data[1] & 0x01;
  394. /* pad packets. Works as a second tool and is always in prox */
  395. if (data[0] == WACOM_REPORT_INTUOSPAD) {
  396. /* initiate the pad as a device */
  397. if (wacom->tool[1] != BTN_TOOL_FINGER)
  398. wacom->tool[1] = BTN_TOOL_FINGER;
  399. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  400. wacom_report_key(wcombo, BTN_0, (data[2] & 0x01));
  401. wacom_report_key(wcombo, BTN_1, (data[3] & 0x01));
  402. wacom_report_key(wcombo, BTN_2, (data[3] & 0x02));
  403. wacom_report_key(wcombo, BTN_3, (data[3] & 0x04));
  404. wacom_report_key(wcombo, BTN_4, (data[3] & 0x08));
  405. wacom_report_key(wcombo, BTN_5, (data[3] & 0x10));
  406. wacom_report_key(wcombo, BTN_6, (data[3] & 0x20));
  407. if (data[1] & 0x80) {
  408. wacom_report_abs(wcombo, ABS_WHEEL, (data[1] & 0x7f));
  409. } else {
  410. /* Out of proximity, clear wheel value. */
  411. wacom_report_abs(wcombo, ABS_WHEEL, 0);
  412. }
  413. if (features->type != INTUOS4S) {
  414. wacom_report_key(wcombo, BTN_7, (data[3] & 0x40));
  415. wacom_report_key(wcombo, BTN_8, (data[3] & 0x80));
  416. }
  417. if (data[1] | (data[2] & 0x01) | data[3]) {
  418. wacom_report_key(wcombo, wacom->tool[1], 1);
  419. wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID);
  420. } else {
  421. wacom_report_key(wcombo, wacom->tool[1], 0);
  422. wacom_report_abs(wcombo, ABS_MISC, 0);
  423. }
  424. } else {
  425. wacom_report_key(wcombo, BTN_0, (data[5] & 0x01));
  426. wacom_report_key(wcombo, BTN_1, (data[5] & 0x02));
  427. wacom_report_key(wcombo, BTN_2, (data[5] & 0x04));
  428. wacom_report_key(wcombo, BTN_3, (data[5] & 0x08));
  429. wacom_report_key(wcombo, BTN_4, (data[6] & 0x01));
  430. wacom_report_key(wcombo, BTN_5, (data[6] & 0x02));
  431. wacom_report_key(wcombo, BTN_6, (data[6] & 0x04));
  432. wacom_report_key(wcombo, BTN_7, (data[6] & 0x08));
  433. wacom_report_key(wcombo, BTN_8, (data[5] & 0x10));
  434. wacom_report_key(wcombo, BTN_9, (data[6] & 0x10));
  435. wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
  436. wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
  437. if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) |
  438. data[2] | (data[3] & 0x1f) | data[4]) {
  439. wacom_report_key(wcombo, wacom->tool[1], 1);
  440. wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID);
  441. } else {
  442. wacom_report_key(wcombo, wacom->tool[1], 0);
  443. wacom_report_abs(wcombo, ABS_MISC, 0);
  444. }
  445. }
  446. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xffffffff);
  447. return 1;
  448. }
  449. /* process in/out prox events */
  450. result = wacom_intuos_inout(wacom, wcombo);
  451. if (result)
  452. return result-1;
  453. /* don't proceed if we don't know the ID */
  454. if (!wacom->id[idx])
  455. return 0;
  456. /* Only large Intuos support Lense Cursor */
  457. if (wacom->tool[idx] == BTN_TOOL_LENS &&
  458. (features->type == INTUOS3 ||
  459. features->type == INTUOS3S ||
  460. features->type == INTUOS4 ||
  461. features->type == INTUOS4S)) {
  462. return 0;
  463. }
  464. /* Cintiq doesn't send data when RDY bit isn't set */
  465. if (features->type == CINTIQ && !(data[1] & 0x40))
  466. return 0;
  467. if (features->type >= INTUOS3S) {
  468. wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
  469. wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
  470. wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
  471. } else {
  472. wacom_report_abs(wcombo, ABS_X, wacom_be16_to_cpu(&data[2]));
  473. wacom_report_abs(wcombo, ABS_Y, wacom_be16_to_cpu(&data[4]));
  474. wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
  475. }
  476. /* process general packets */
  477. wacom_intuos_general(wacom, wcombo);
  478. /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
  479. if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
  480. if (data[1] & 0x02) {
  481. /* Rotation packet */
  482. if (features->type >= INTUOS3S) {
  483. /* I3 marker pen rotation */
  484. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  485. t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
  486. ((t-1) / 2 + 450)) : (450 - t / 2) ;
  487. wacom_report_abs(wcombo, ABS_Z, t);
  488. } else {
  489. /* 4D mouse rotation packet */
  490. t = (data[6] << 3) | ((data[7] >> 5) & 7);
  491. wacom_report_abs(wcombo, ABS_RZ, (data[7] & 0x20) ?
  492. ((t - 1) / 2) : -t / 2);
  493. }
  494. } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
  495. /* 4D mouse packet */
  496. wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01);
  497. wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
  498. wacom_report_key(wcombo, BTN_RIGHT, data[8] & 0x04);
  499. wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x20);
  500. wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x10);
  501. t = (data[6] << 2) | ((data[7] >> 6) & 3);
  502. wacom_report_abs(wcombo, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
  503. } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
  504. /* I4 mouse */
  505. if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
  506. wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01);
  507. wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02);
  508. wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04);
  509. wacom_report_rel(wcombo, REL_WHEEL, ((data[7] & 0x80) >> 7)
  510. - ((data[7] & 0x40) >> 6));
  511. wacom_report_key(wcombo, BTN_SIDE, data[6] & 0x08);
  512. wacom_report_key(wcombo, BTN_EXTRA, data[6] & 0x10);
  513. wacom_report_abs(wcombo, ABS_TILT_X,
  514. ((data[7] << 1) & 0x7e) | (data[8] >> 7));
  515. wacom_report_abs(wcombo, ABS_TILT_Y, data[8] & 0x7f);
  516. } else {
  517. /* 2D mouse packet */
  518. wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x04);
  519. wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x08);
  520. wacom_report_key(wcombo, BTN_RIGHT, data[8] & 0x10);
  521. wacom_report_rel(wcombo, REL_WHEEL, (data[8] & 0x01)
  522. - ((data[8] & 0x02) >> 1));
  523. /* I3 2D mouse side buttons */
  524. if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
  525. wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40);
  526. wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20);
  527. }
  528. }
  529. } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
  530. features->type == INTUOS4L) &&
  531. wacom->tool[idx] == BTN_TOOL_LENS) {
  532. /* Lens cursor packets */
  533. wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01);
  534. wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
  535. wacom_report_key(wcombo, BTN_RIGHT, data[8] & 0x04);
  536. wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x10);
  537. wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x08);
  538. }
  539. }
  540. wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */
  541. wacom_report_key(wcombo, wacom->tool[idx], 1);
  542. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
  543. return 1;
  544. }
  545. static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx)
  546. {
  547. wacom_report_abs(wcombo, ABS_X,
  548. data[2 + idx * 2] | ((data[3 + idx * 2] & 0x7f) << 8));
  549. wacom_report_abs(wcombo, ABS_Y,
  550. data[6 + idx * 2] | ((data[7 + idx * 2] & 0x7f) << 8));
  551. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
  552. wacom_report_key(wcombo, wacom->tool[idx], 1);
  553. if (idx)
  554. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
  555. else
  556. wacom_report_key(wcombo, BTN_TOUCH, 1);
  557. }
  558. static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx)
  559. {
  560. wacom_report_abs(wcombo, ABS_X, 0);
  561. wacom_report_abs(wcombo, ABS_Y, 0);
  562. wacom_report_abs(wcombo, ABS_MISC, 0);
  563. wacom_report_key(wcombo, wacom->tool[idx], 0);
  564. if (idx)
  565. wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
  566. else
  567. wacom_report_key(wcombo, BTN_TOUCH, 0);
  568. return;
  569. }
  570. static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
  571. {
  572. char *data = wacom->data;
  573. struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
  574. static int firstFinger = 0;
  575. static int secondFinger = 0;
  576. wacom->tool[0] = BTN_TOOL_DOUBLETAP;
  577. wacom->id[0] = TOUCH_DEVICE_ID;
  578. wacom->tool[1] = BTN_TOOL_TRIPLETAP;
  579. if (urb->actual_length != WACOM_PKGLEN_TPC1FG) {
  580. switch (data[0]) {
  581. case WACOM_REPORT_TPC1FG:
  582. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
  583. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
  584. wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
  585. wacom_report_key(wcombo, BTN_TOUCH, wacom_le16_to_cpu(&data[6]));
  586. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
  587. wacom_report_key(wcombo, wacom->tool[0], 1);
  588. break;
  589. case WACOM_REPORT_TPC2FG:
  590. /* keep this byte to send proper out-prox event */
  591. wacom->id[1] = data[1] & 0x03;
  592. if (data[1] & 0x01) {
  593. wacom_tpc_finger_in(wacom, wcombo, data, 0);
  594. firstFinger = 1;
  595. } else if (firstFinger) {
  596. wacom_tpc_touch_out(wacom, wcombo, 0);
  597. }
  598. if (data[1] & 0x02) {
  599. /* sync first finger data */
  600. if (firstFinger)
  601. wacom_input_sync(wcombo);
  602. wacom_tpc_finger_in(wacom, wcombo, data, 1);
  603. secondFinger = 1;
  604. } else if (secondFinger) {
  605. /* sync first finger data */
  606. if (firstFinger)
  607. wacom_input_sync(wcombo);
  608. wacom_tpc_touch_out(wacom, wcombo, 1);
  609. secondFinger = 0;
  610. }
  611. if (!(data[1] & 0x01))
  612. firstFinger = 0;
  613. break;
  614. }
  615. } else {
  616. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1]));
  617. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3]));
  618. wacom_report_key(wcombo, BTN_TOUCH, 1);
  619. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
  620. wacom_report_key(wcombo, wacom->tool[0], 1);
  621. }
  622. return;
  623. }
  624. static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
  625. {
  626. struct wacom_features *features = &wacom->features;
  627. char *data = wacom->data;
  628. int prox = 0, pressure, idx = -1;
  629. static int stylusInProx, touchInProx = 1, touchOut;
  630. struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
  631. dbg("wacom_tpc_irq: received report #%d", data[0]);
  632. if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */
  633. data[0] == WACOM_REPORT_TPC1FG || /* single touch */
  634. data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
  635. if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */
  636. prox = data[0] & 0x01;
  637. } else { /* with capacity */
  638. if (data[0] == WACOM_REPORT_TPC1FG)
  639. /* single touch */
  640. prox = data[1] & 0x01;
  641. else
  642. /* 2FG touch data */
  643. prox = data[1] & 0x03;
  644. }
  645. if (!stylusInProx) { /* stylus not in prox */
  646. if (prox) {
  647. if (touchInProx) {
  648. wacom_tpc_touch_in(wacom, wcombo);
  649. touchOut = 1;
  650. return 1;
  651. }
  652. } else {
  653. /* 2FGT out-prox */
  654. if (data[0] == WACOM_REPORT_TPC2FG) {
  655. idx = (wacom->id[1] & 0x01) - 1;
  656. if (idx == 0) {
  657. wacom_tpc_touch_out(wacom, wcombo, idx);
  658. /* sync first finger event */
  659. if (wacom->id[1] & 0x02)
  660. wacom_input_sync(wcombo);
  661. }
  662. idx = (wacom->id[1] & 0x02) - 1;
  663. if (idx == 1)
  664. wacom_tpc_touch_out(wacom, wcombo, idx);
  665. } else /* one finger touch */
  666. wacom_tpc_touch_out(wacom, wcombo, 0);
  667. touchOut = 0;
  668. touchInProx = 1;
  669. return 1;
  670. }
  671. } else if (touchOut || !prox) { /* force touch out-prox */
  672. wacom_tpc_touch_out(wacom, wcombo, 0);
  673. touchOut = 0;
  674. touchInProx = 1;
  675. return 1;
  676. }
  677. } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
  678. prox = data[1] & 0x20;
  679. touchInProx = 0;
  680. if (!wacom->id[0]) { /* first in prox */
  681. /* Going into proximity select tool */
  682. wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
  683. if (wacom->tool[0] == BTN_TOOL_PEN)
  684. wacom->id[0] = STYLUS_DEVICE_ID;
  685. else
  686. wacom->id[0] = ERASER_DEVICE_ID;
  687. }
  688. wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
  689. wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
  690. wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
  691. wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
  692. pressure = ((data[7] & 0x01) << 8) | data[6];
  693. if (pressure < 0)
  694. pressure = features->pressure_max + pressure + 1;
  695. wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
  696. wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05);
  697. if (!prox) { /* out-prox */
  698. wacom->id[0] = 0;
  699. /* pen is out so touch can be enabled now */
  700. touchInProx = 1;
  701. }
  702. wacom_report_key(wcombo, wacom->tool[0], prox);
  703. wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
  704. stylusInProx = prox;
  705. return 1;
  706. }
  707. return 0;
  708. }
  709. int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
  710. {
  711. switch (wacom_wac->features.type) {
  712. case PENPARTNER:
  713. return wacom_penpartner_irq(wacom_wac, wcombo);
  714. case PL:
  715. return wacom_pl_irq(wacom_wac, wcombo);
  716. case WACOM_G4:
  717. case GRAPHIRE:
  718. case WACOM_MO:
  719. return wacom_graphire_irq(wacom_wac, wcombo);
  720. case PTU:
  721. return wacom_ptu_irq(wacom_wac, wcombo);
  722. case INTUOS:
  723. case INTUOS3S:
  724. case INTUOS3:
  725. case INTUOS3L:
  726. case INTUOS4S:
  727. case INTUOS4:
  728. case INTUOS4L:
  729. case CINTIQ:
  730. case WACOM_BEE:
  731. return wacom_intuos_irq(wacom_wac, wcombo);
  732. case TABLETPC:
  733. case TABLETPC2FG:
  734. return wacom_tpc_irq(wacom_wac, wcombo);
  735. default:
  736. return 0;
  737. }
  738. return 0;
  739. }
  740. void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
  741. {
  742. switch (wacom_wac->features.type) {
  743. case WACOM_MO:
  744. input_dev_mo(input_dev, wacom_wac);
  745. case WACOM_G4:
  746. input_dev_g4(input_dev, wacom_wac);
  747. /* fall through */
  748. case GRAPHIRE:
  749. input_dev_g(input_dev, wacom_wac);
  750. break;
  751. case WACOM_BEE:
  752. input_dev_bee(input_dev, wacom_wac);
  753. case INTUOS3:
  754. case INTUOS3L:
  755. case CINTIQ:
  756. input_dev_i3(input_dev, wacom_wac);
  757. /* fall through */
  758. case INTUOS3S:
  759. input_dev_i3s(input_dev, wacom_wac);
  760. /* fall through */
  761. case INTUOS:
  762. input_dev_i(input_dev, wacom_wac);
  763. break;
  764. case INTUOS4:
  765. case INTUOS4L:
  766. input_dev_i4(input_dev, wacom_wac);
  767. /* fall through */
  768. case INTUOS4S:
  769. input_dev_i4s(input_dev, wacom_wac);
  770. input_dev_i(input_dev, wacom_wac);
  771. break;
  772. case TABLETPC2FG:
  773. input_dev_tpc2fg(input_dev, wacom_wac);
  774. /* fall through */
  775. case TABLETPC:
  776. input_dev_tpc(input_dev, wacom_wac);
  777. if (wacom_wac->features.device_type != BTN_TOOL_PEN)
  778. break; /* no need to process stylus stuff */
  779. /* fall through */
  780. case PL:
  781. case PTU:
  782. input_dev_pl(input_dev, wacom_wac);
  783. /* fall through */
  784. case PENPARTNER:
  785. input_dev_pt(input_dev, wacom_wac);
  786. break;
  787. }
  788. return;
  789. }
  790. static const struct wacom_features wacom_features_0x00 =
  791. { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER };
  792. static const struct wacom_features wacom_features_0x10 =
  793. { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  794. static const struct wacom_features wacom_features_0x11 =
  795. { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE };
  796. static const struct wacom_features wacom_features_0x12 =
  797. { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE };
  798. static const struct wacom_features wacom_features_0x13 =
  799. { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE };
  800. static const struct wacom_features wacom_features_0x14 =
  801. { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  802. static const struct wacom_features wacom_features_0x15 =
  803. { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 };
  804. static const struct wacom_features wacom_features_0x16 =
  805. { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 };
  806. static const struct wacom_features wacom_features_0x17 =
  807. { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  808. static const struct wacom_features wacom_features_0x18 =
  809. { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO };
  810. static const struct wacom_features wacom_features_0x19 =
  811. { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE };
  812. static const struct wacom_features wacom_features_0x60 =
  813. { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  814. static const struct wacom_features wacom_features_0x61 =
  815. { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE };
  816. static const struct wacom_features wacom_features_0x62 =
  817. { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  818. static const struct wacom_features wacom_features_0x63 =
  819. { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE };
  820. static const struct wacom_features wacom_features_0x64 =
  821. { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE };
  822. static const struct wacom_features wacom_features_0x65 =
  823. { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO };
  824. static const struct wacom_features wacom_features_0x69 =
  825. { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE };
  826. static const struct wacom_features wacom_features_0x20 =
  827. { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  828. static const struct wacom_features wacom_features_0x21 =
  829. { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  830. static const struct wacom_features wacom_features_0x22 =
  831. { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  832. static const struct wacom_features wacom_features_0x23 =
  833. { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  834. static const struct wacom_features wacom_features_0x24 =
  835. { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  836. static const struct wacom_features wacom_features_0x30 =
  837. { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL };
  838. static const struct wacom_features wacom_features_0x31 =
  839. { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL };
  840. static const struct wacom_features wacom_features_0x32 =
  841. { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL };
  842. static const struct wacom_features wacom_features_0x33 =
  843. { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL };
  844. static const struct wacom_features wacom_features_0x34 =
  845. { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL };
  846. static const struct wacom_features wacom_features_0x35 =
  847. { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL };
  848. static const struct wacom_features wacom_features_0x37 =
  849. { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL };
  850. static const struct wacom_features wacom_features_0x38 =
  851. { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  852. static const struct wacom_features wacom_features_0x39 =
  853. { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL };
  854. static const struct wacom_features wacom_features_0xC4 =
  855. { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL };
  856. static const struct wacom_features wacom_features_0xC0 =
  857. { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  858. static const struct wacom_features wacom_features_0xC2 =
  859. { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL };
  860. static const struct wacom_features wacom_features_0x03 =
  861. { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU };
  862. static const struct wacom_features wacom_features_0x41 =
  863. { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS };
  864. static const struct wacom_features wacom_features_0x42 =
  865. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  866. static const struct wacom_features wacom_features_0x43 =
  867. { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS };
  868. static const struct wacom_features wacom_features_0x44 =
  869. { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS };
  870. static const struct wacom_features wacom_features_0x45 =
  871. { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS };
  872. static const struct wacom_features wacom_features_0xB0 =
  873. { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S };
  874. static const struct wacom_features wacom_features_0xB1 =
  875. { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 };
  876. static const struct wacom_features wacom_features_0xB2 =
  877. { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 };
  878. static const struct wacom_features wacom_features_0xB3 =
  879. { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L };
  880. static const struct wacom_features wacom_features_0xB4 =
  881. { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L };
  882. static const struct wacom_features wacom_features_0xB5 =
  883. { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 };
  884. static const struct wacom_features wacom_features_0xB7 =
  885. { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S };
  886. static const struct wacom_features wacom_features_0xB8 =
  887. { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S };
  888. static const struct wacom_features wacom_features_0xB9 =
  889. { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 };
  890. static const struct wacom_features wacom_features_0xBA =
  891. { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L };
  892. static const struct wacom_features wacom_features_0xBB =
  893. { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L };
  894. static const struct wacom_features wacom_features_0x3F =
  895. { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ };
  896. static const struct wacom_features wacom_features_0xC5 =
  897. { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE };
  898. static const struct wacom_features wacom_features_0xC6 =
  899. { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE };
  900. static const struct wacom_features wacom_features_0xC7 =
  901. { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL };
  902. static const struct wacom_features wacom_features_0x90 =
  903. { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  904. static const struct wacom_features wacom_features_0x93 =
  905. { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  906. static const struct wacom_features wacom_features_0x9A =
  907. { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  908. static const struct wacom_features wacom_features_0x9F =
  909. { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
  910. static const struct wacom_features wacom_features_0xE2 =
  911. { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  912. static const struct wacom_features wacom_features_0xE3 =
  913. { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
  914. static const struct wacom_features wacom_features_0x47 =
  915. { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
  916. #define USB_DEVICE_WACOM(prod) \
  917. USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
  918. .driver_info = (kernel_ulong_t)&wacom_features_##prod
  919. const struct usb_device_id wacom_ids[] = {
  920. { USB_DEVICE_WACOM(0x00) },
  921. { USB_DEVICE_WACOM(0x10) },
  922. { USB_DEVICE_WACOM(0x11) },
  923. { USB_DEVICE_WACOM(0x12) },
  924. { USB_DEVICE_WACOM(0x13) },
  925. { USB_DEVICE_WACOM(0x14) },
  926. { USB_DEVICE_WACOM(0x15) },
  927. { USB_DEVICE_WACOM(0x16) },
  928. { USB_DEVICE_WACOM(0x17) },
  929. { USB_DEVICE_WACOM(0x18) },
  930. { USB_DEVICE_WACOM(0x19) },
  931. { USB_DEVICE_WACOM(0x60) },
  932. { USB_DEVICE_WACOM(0x61) },
  933. { USB_DEVICE_WACOM(0x62) },
  934. { USB_DEVICE_WACOM(0x63) },
  935. { USB_DEVICE_WACOM(0x64) },
  936. { USB_DEVICE_WACOM(0x65) },
  937. { USB_DEVICE_WACOM(0x69) },
  938. { USB_DEVICE_WACOM(0x20) },
  939. { USB_DEVICE_WACOM(0x21) },
  940. { USB_DEVICE_WACOM(0x22) },
  941. { USB_DEVICE_WACOM(0x23) },
  942. { USB_DEVICE_WACOM(0x24) },
  943. { USB_DEVICE_WACOM(0x30) },
  944. { USB_DEVICE_WACOM(0x31) },
  945. { USB_DEVICE_WACOM(0x32) },
  946. { USB_DEVICE_WACOM(0x33) },
  947. { USB_DEVICE_WACOM(0x34) },
  948. { USB_DEVICE_WACOM(0x35) },
  949. { USB_DEVICE_WACOM(0x37) },
  950. { USB_DEVICE_WACOM(0x38) },
  951. { USB_DEVICE_WACOM(0x39) },
  952. { USB_DEVICE_WACOM(0xC4) },
  953. { USB_DEVICE_WACOM(0xC0) },
  954. { USB_DEVICE_WACOM(0xC2) },
  955. { USB_DEVICE_WACOM(0x03) },
  956. { USB_DEVICE_WACOM(0x41) },
  957. { USB_DEVICE_WACOM(0x42) },
  958. { USB_DEVICE_WACOM(0x43) },
  959. { USB_DEVICE_WACOM(0x44) },
  960. { USB_DEVICE_WACOM(0x45) },
  961. { USB_DEVICE_WACOM(0xB0) },
  962. { USB_DEVICE_WACOM(0xB1) },
  963. { USB_DEVICE_WACOM(0xB2) },
  964. { USB_DEVICE_WACOM(0xB3) },
  965. { USB_DEVICE_WACOM(0xB4) },
  966. { USB_DEVICE_WACOM(0xB5) },
  967. { USB_DEVICE_WACOM(0xB7) },
  968. { USB_DEVICE_WACOM(0xB8) },
  969. { USB_DEVICE_WACOM(0xB9) },
  970. { USB_DEVICE_WACOM(0xBA) },
  971. { USB_DEVICE_WACOM(0xBB) },
  972. { USB_DEVICE_WACOM(0x3F) },
  973. { USB_DEVICE_WACOM(0xC5) },
  974. { USB_DEVICE_WACOM(0xC6) },
  975. { USB_DEVICE_WACOM(0xC7) },
  976. { USB_DEVICE_WACOM(0x90) },
  977. { USB_DEVICE_WACOM(0x93) },
  978. { USB_DEVICE_WACOM(0x9A) },
  979. { USB_DEVICE_WACOM(0x9F) },
  980. { USB_DEVICE_WACOM(0xE2) },
  981. { USB_DEVICE_WACOM(0xE3) },
  982. { USB_DEVICE_WACOM(0x47) },
  983. { }
  984. };
  985. MODULE_DEVICE_TABLE(usb, wacom_ids);