wacom_wac.c 40 KB

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