usbtouchscreen.c 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773
  1. /******************************************************************************
  2. * usbtouchscreen.c
  3. * Driver for USB Touchscreens, supporting those devices:
  4. * - eGalax Touchkit
  5. * includes eTurboTouch CT-410/510/700
  6. * - 3M/Microtouch EX II series
  7. * - ITM
  8. * - PanJit TouchSet
  9. * - eTurboTouch
  10. * - Gunze AHL61
  11. * - DMC TSC-10/25
  12. * - IRTOUCHSYSTEMS/UNITOP
  13. * - IdealTEK URTC1000
  14. * - General Touch
  15. * - GoTop Super_Q2/GogoPen/PenPower tablets
  16. * - JASTEC USB touch controller/DigiTech DTR-02U
  17. * - Zytronic capacitive touchscreen
  18. * - NEXIO/iNexio
  19. * - Elo TouchSystems 2700 IntelliTouch
  20. * - EasyTouch USB Dual/Multi touch controller from Data Modul
  21. *
  22. * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
  23. * Copyright (C) by Todd E. Johnson (mtouchusb.c)
  24. *
  25. * This program is free software; you can redistribute it and/or
  26. * modify it under the terms of the GNU General Public License as
  27. * published by the Free Software Foundation; either version 2 of the
  28. * License, or (at your option) any later version.
  29. *
  30. * This program is distributed in the hope that it will be useful, but
  31. * WITHOUT ANY WARRANTY; without even the implied warranty of
  32. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  33. * General Public License for more details.
  34. *
  35. * You should have received a copy of the GNU General Public License
  36. * along with this program; if not, write to the Free Software
  37. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  38. *
  39. * Driver is based on touchkitusb.c
  40. * - ITM parts are from itmtouch.c
  41. * - 3M parts are from mtouchusb.c
  42. * - PanJit parts are from an unmerged driver by Lanslott Gish
  43. * - DMC TSC 10/25 are from Holger Schurig, with ideas from an unmerged
  44. * driver from Marius Vollmer
  45. *
  46. *****************************************************************************/
  47. //#define DEBUG
  48. #include <linux/kernel.h>
  49. #include <linux/slab.h>
  50. #include <linux/input.h>
  51. #include <linux/module.h>
  52. #include <linux/usb.h>
  53. #include <linux/usb/input.h>
  54. #include <linux/hid.h>
  55. #define DRIVER_VERSION "v0.6"
  56. #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
  57. #define DRIVER_DESC "USB Touchscreen Driver"
  58. static bool swap_xy;
  59. module_param(swap_xy, bool, 0644);
  60. MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
  61. static bool hwcalib_xy;
  62. module_param(hwcalib_xy, bool, 0644);
  63. MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
  64. /* device specifc data/functions */
  65. struct usbtouch_usb;
  66. struct usbtouch_device_info {
  67. int min_xc, max_xc;
  68. int min_yc, max_yc;
  69. int min_press, max_press;
  70. int rept_size;
  71. /*
  72. * Always service the USB devices irq not just when the input device is
  73. * open. This is useful when devices have a watchdog which prevents us
  74. * from periodically polling the device. Leave this unset unless your
  75. * touchscreen device requires it, as it does consume more of the USB
  76. * bandwidth.
  77. */
  78. bool irq_always;
  79. void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
  80. /*
  81. * used to get the packet len. possible return values:
  82. * > 0: packet len
  83. * = 0: skip one byte
  84. * < 0: -return value more bytes needed
  85. */
  86. int (*get_pkt_len) (unsigned char *pkt, int len);
  87. int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
  88. int (*alloc) (struct usbtouch_usb *usbtouch);
  89. int (*init) (struct usbtouch_usb *usbtouch);
  90. void (*exit) (struct usbtouch_usb *usbtouch);
  91. };
  92. /* a usbtouch device */
  93. struct usbtouch_usb {
  94. unsigned char *data;
  95. dma_addr_t data_dma;
  96. int data_size;
  97. unsigned char *buffer;
  98. int buf_len;
  99. struct urb *irq;
  100. struct usb_interface *interface;
  101. struct input_dev *input;
  102. struct usbtouch_device_info *type;
  103. char name[128];
  104. char phys[64];
  105. void *priv;
  106. int x, y;
  107. int touch, press;
  108. };
  109. /* device types */
  110. enum {
  111. DEVTYPE_IGNORE = -1,
  112. DEVTYPE_EGALAX,
  113. DEVTYPE_PANJIT,
  114. DEVTYPE_3M,
  115. DEVTYPE_ITM,
  116. DEVTYPE_ETURBO,
  117. DEVTYPE_GUNZE,
  118. DEVTYPE_DMC_TSC10,
  119. DEVTYPE_IRTOUCH,
  120. DEVTYPE_IRTOUCH_HIRES,
  121. DEVTYPE_IDEALTEK,
  122. DEVTYPE_GENERAL_TOUCH,
  123. DEVTYPE_GOTOP,
  124. DEVTYPE_JASTEC,
  125. DEVTYPE_E2I,
  126. DEVTYPE_ZYTRONIC,
  127. DEVTYPE_TC45USB,
  128. DEVTYPE_NEXIO,
  129. DEVTYPE_ELO,
  130. DEVTYPE_ETOUCH,
  131. };
  132. #define USB_DEVICE_HID_CLASS(vend, prod) \
  133. .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \
  134. | USB_DEVICE_ID_MATCH_DEVICE, \
  135. .idVendor = (vend), \
  136. .idProduct = (prod), \
  137. .bInterfaceClass = USB_INTERFACE_CLASS_HID
  138. static const struct usb_device_id usbtouch_devices[] = {
  139. #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
  140. /* ignore the HID capable devices, handled by usbhid */
  141. {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
  142. {USB_DEVICE_HID_CLASS(0x0eef, 0x0002), .driver_info = DEVTYPE_IGNORE},
  143. /* normal device IDs */
  144. {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
  145. {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
  146. {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
  147. {USB_DEVICE(0x0eef, 0x0001), .driver_info = DEVTYPE_EGALAX},
  148. {USB_DEVICE(0x0eef, 0x0002), .driver_info = DEVTYPE_EGALAX},
  149. {USB_DEVICE(0x1234, 0x0001), .driver_info = DEVTYPE_EGALAX},
  150. {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX},
  151. #endif
  152. #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
  153. {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
  154. {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
  155. {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
  156. {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
  157. #endif
  158. #ifdef CONFIG_TOUCHSCREEN_USB_3M
  159. {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
  160. #endif
  161. #ifdef CONFIG_TOUCHSCREEN_USB_ITM
  162. {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
  163. {USB_DEVICE(0x16e3, 0xf9e9), .driver_info = DEVTYPE_ITM},
  164. #endif
  165. #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
  166. {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO},
  167. #endif
  168. #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
  169. {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE},
  170. #endif
  171. #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
  172. {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10},
  173. #endif
  174. #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
  175. {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
  176. {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
  177. {USB_DEVICE(0x6615, 0x0012), .driver_info = DEVTYPE_IRTOUCH_HIRES},
  178. #endif
  179. #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
  180. {USB_DEVICE(0x1391, 0x1000), .driver_info = DEVTYPE_IDEALTEK},
  181. #endif
  182. #ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
  183. {USB_DEVICE(0x0dfc, 0x0001), .driver_info = DEVTYPE_GENERAL_TOUCH},
  184. #endif
  185. #ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
  186. {USB_DEVICE(0x08f2, 0x007f), .driver_info = DEVTYPE_GOTOP},
  187. {USB_DEVICE(0x08f2, 0x00ce), .driver_info = DEVTYPE_GOTOP},
  188. {USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP},
  189. #endif
  190. #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
  191. {USB_DEVICE(0x0f92, 0x0001), .driver_info = DEVTYPE_JASTEC},
  192. #endif
  193. #ifdef CONFIG_TOUCHSCREEN_USB_E2I
  194. {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I},
  195. #endif
  196. #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
  197. {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC},
  198. #endif
  199. #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB
  200. /* TC5UH */
  201. {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC45USB},
  202. /* TC4UM */
  203. {USB_DEVICE(0x0664, 0x0306), .driver_info = DEVTYPE_TC45USB},
  204. #endif
  205. #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
  206. /* data interface only */
  207. {USB_DEVICE_AND_INTERFACE_INFO(0x10f0, 0x2002, 0x0a, 0x00, 0x00),
  208. .driver_info = DEVTYPE_NEXIO},
  209. {USB_DEVICE_AND_INTERFACE_INFO(0x1870, 0x0001, 0x0a, 0x00, 0x00),
  210. .driver_info = DEVTYPE_NEXIO},
  211. #endif
  212. #ifdef CONFIG_TOUCHSCREEN_USB_ELO
  213. {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO},
  214. #endif
  215. #ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
  216. {USB_DEVICE(0x7374, 0x0001), .driver_info = DEVTYPE_ETOUCH},
  217. #endif
  218. {}
  219. };
  220. /*****************************************************************************
  221. * e2i Part
  222. */
  223. #ifdef CONFIG_TOUCHSCREEN_USB_E2I
  224. static int e2i_init(struct usbtouch_usb *usbtouch)
  225. {
  226. int ret;
  227. struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
  228. ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
  229. 0x01, 0x02, 0x0000, 0x0081,
  230. NULL, 0, USB_CTRL_SET_TIMEOUT);
  231. dev_dbg(&usbtouch->interface->dev,
  232. "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n",
  233. __func__, ret);
  234. return ret;
  235. }
  236. static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  237. {
  238. int tmp = (pkt[0] << 8) | pkt[1];
  239. dev->x = (pkt[2] << 8) | pkt[3];
  240. dev->y = (pkt[4] << 8) | pkt[5];
  241. tmp = tmp - 0xA000;
  242. dev->touch = (tmp > 0);
  243. dev->press = (tmp > 0 ? tmp : 0);
  244. return 1;
  245. }
  246. #endif
  247. /*****************************************************************************
  248. * eGalax part
  249. */
  250. #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
  251. #ifndef MULTI_PACKET
  252. #define MULTI_PACKET
  253. #endif
  254. #define EGALAX_PKT_TYPE_MASK 0xFE
  255. #define EGALAX_PKT_TYPE_REPT 0x80
  256. #define EGALAX_PKT_TYPE_DIAG 0x0A
  257. static int egalax_init(struct usbtouch_usb *usbtouch)
  258. {
  259. int ret, i;
  260. unsigned char *buf;
  261. struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
  262. /*
  263. * An eGalax diagnostic packet kicks the device into using the right
  264. * protocol. We send a "check active" packet. The response will be
  265. * read later and ignored.
  266. */
  267. buf = kmalloc(3, GFP_KERNEL);
  268. if (!buf)
  269. return -ENOMEM;
  270. buf[0] = EGALAX_PKT_TYPE_DIAG;
  271. buf[1] = 1; /* length */
  272. buf[2] = 'A'; /* command - check active */
  273. for (i = 0; i < 3; i++) {
  274. ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
  275. 0,
  276. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  277. 0, 0, buf, 3,
  278. USB_CTRL_SET_TIMEOUT);
  279. if (ret >= 0) {
  280. ret = 0;
  281. break;
  282. }
  283. if (ret != -EPIPE)
  284. break;
  285. }
  286. kfree(buf);
  287. return ret;
  288. }
  289. static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  290. {
  291. if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
  292. return 0;
  293. dev->x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F);
  294. dev->y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F);
  295. dev->touch = pkt[0] & 0x01;
  296. return 1;
  297. }
  298. static int egalax_get_pkt_len(unsigned char *buf, int len)
  299. {
  300. switch (buf[0] & EGALAX_PKT_TYPE_MASK) {
  301. case EGALAX_PKT_TYPE_REPT:
  302. return 5;
  303. case EGALAX_PKT_TYPE_DIAG:
  304. if (len < 2)
  305. return -1;
  306. return buf[1] + 2;
  307. }
  308. return 0;
  309. }
  310. #endif
  311. /*****************************************************************************
  312. * EasyTouch part
  313. */
  314. #ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
  315. #ifndef MULTI_PACKET
  316. #define MULTI_PACKET
  317. #endif
  318. #define ETOUCH_PKT_TYPE_MASK 0xFE
  319. #define ETOUCH_PKT_TYPE_REPT 0x80
  320. #define ETOUCH_PKT_TYPE_REPT2 0xB0
  321. #define ETOUCH_PKT_TYPE_DIAG 0x0A
  322. static int etouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  323. {
  324. if ((pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT &&
  325. (pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT2)
  326. return 0;
  327. dev->x = ((pkt[1] & 0x1F) << 7) | (pkt[2] & 0x7F);
  328. dev->y = ((pkt[3] & 0x1F) << 7) | (pkt[4] & 0x7F);
  329. dev->touch = pkt[0] & 0x01;
  330. return 1;
  331. }
  332. static int etouch_get_pkt_len(unsigned char *buf, int len)
  333. {
  334. switch (buf[0] & ETOUCH_PKT_TYPE_MASK) {
  335. case ETOUCH_PKT_TYPE_REPT:
  336. case ETOUCH_PKT_TYPE_REPT2:
  337. return 5;
  338. case ETOUCH_PKT_TYPE_DIAG:
  339. if (len < 2)
  340. return -1;
  341. return buf[1] + 2;
  342. }
  343. return 0;
  344. }
  345. #endif
  346. /*****************************************************************************
  347. * PanJit Part
  348. */
  349. #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
  350. static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  351. {
  352. dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1];
  353. dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3];
  354. dev->touch = pkt[0] & 0x01;
  355. return 1;
  356. }
  357. #endif
  358. /*****************************************************************************
  359. * 3M/Microtouch Part
  360. */
  361. #ifdef CONFIG_TOUCHSCREEN_USB_3M
  362. #define MTOUCHUSB_ASYNC_REPORT 1
  363. #define MTOUCHUSB_RESET 7
  364. #define MTOUCHUSB_REQ_CTRLLR_ID 10
  365. static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  366. {
  367. if (hwcalib_xy) {
  368. dev->x = (pkt[4] << 8) | pkt[3];
  369. dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]);
  370. } else {
  371. dev->x = (pkt[8] << 8) | pkt[7];
  372. dev->y = (pkt[10] << 8) | pkt[9];
  373. }
  374. dev->touch = (pkt[2] & 0x40) ? 1 : 0;
  375. return 1;
  376. }
  377. static int mtouch_init(struct usbtouch_usb *usbtouch)
  378. {
  379. int ret, i;
  380. struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
  381. ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
  382. MTOUCHUSB_RESET,
  383. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  384. 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
  385. dev_dbg(&usbtouch->interface->dev,
  386. "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n",
  387. __func__, ret);
  388. if (ret < 0)
  389. return ret;
  390. msleep(150);
  391. for (i = 0; i < 3; i++) {
  392. ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
  393. MTOUCHUSB_ASYNC_REPORT,
  394. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  395. 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
  396. dev_dbg(&usbtouch->interface->dev,
  397. "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n",
  398. __func__, ret);
  399. if (ret >= 0)
  400. break;
  401. if (ret != -EPIPE)
  402. return ret;
  403. }
  404. /* Default min/max xy are the raw values, override if using hw-calib */
  405. if (hwcalib_xy) {
  406. input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0);
  407. input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0);
  408. }
  409. return 0;
  410. }
  411. #endif
  412. /*****************************************************************************
  413. * ITM Part
  414. */
  415. #ifdef CONFIG_TOUCHSCREEN_USB_ITM
  416. static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  417. {
  418. int touch;
  419. /*
  420. * ITM devices report invalid x/y data if not touched.
  421. * if the screen was touched before but is not touched any more
  422. * report touch as 0 with the last valid x/y data once. then stop
  423. * reporting data until touched again.
  424. */
  425. dev->press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F);
  426. touch = ~pkt[7] & 0x20;
  427. if (!touch) {
  428. if (dev->touch) {
  429. dev->touch = 0;
  430. return 1;
  431. }
  432. return 0;
  433. }
  434. dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
  435. dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
  436. dev->touch = touch;
  437. return 1;
  438. }
  439. #endif
  440. /*****************************************************************************
  441. * eTurboTouch part
  442. */
  443. #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
  444. #ifndef MULTI_PACKET
  445. #define MULTI_PACKET
  446. #endif
  447. static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  448. {
  449. unsigned int shift;
  450. /* packets should start with sync */
  451. if (!(pkt[0] & 0x80))
  452. return 0;
  453. shift = (6 - (pkt[0] & 0x03));
  454. dev->x = ((pkt[3] << 7) | pkt[4]) >> shift;
  455. dev->y = ((pkt[1] << 7) | pkt[2]) >> shift;
  456. dev->touch = (pkt[0] & 0x10) ? 1 : 0;
  457. return 1;
  458. }
  459. static int eturbo_get_pkt_len(unsigned char *buf, int len)
  460. {
  461. if (buf[0] & 0x80)
  462. return 5;
  463. if (buf[0] == 0x01)
  464. return 3;
  465. return 0;
  466. }
  467. #endif
  468. /*****************************************************************************
  469. * Gunze part
  470. */
  471. #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
  472. static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  473. {
  474. if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80))
  475. return 0;
  476. dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[2] & 0x7F);
  477. dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[3] & 0x7F);
  478. dev->touch = pkt[0] & 0x20;
  479. return 1;
  480. }
  481. #endif
  482. /*****************************************************************************
  483. * DMC TSC-10/25 Part
  484. *
  485. * Documentation about the controller and it's protocol can be found at
  486. * http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf
  487. * http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf
  488. */
  489. #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
  490. /* supported data rates. currently using 130 */
  491. #define TSC10_RATE_POINT 0x50
  492. #define TSC10_RATE_30 0x40
  493. #define TSC10_RATE_50 0x41
  494. #define TSC10_RATE_80 0x42
  495. #define TSC10_RATE_100 0x43
  496. #define TSC10_RATE_130 0x44
  497. #define TSC10_RATE_150 0x45
  498. /* commands */
  499. #define TSC10_CMD_RESET 0x55
  500. #define TSC10_CMD_RATE 0x05
  501. #define TSC10_CMD_DATA1 0x01
  502. static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
  503. {
  504. struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
  505. int ret = -ENOMEM;
  506. unsigned char *buf;
  507. buf = kmalloc(2, GFP_NOIO);
  508. if (!buf)
  509. goto err_nobuf;
  510. /* reset */
  511. buf[0] = buf[1] = 0xFF;
  512. ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
  513. TSC10_CMD_RESET,
  514. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  515. 0, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
  516. if (ret < 0)
  517. goto err_out;
  518. if (buf[0] != 0x06) {
  519. ret = -ENODEV;
  520. goto err_out;
  521. }
  522. /* TSC-25 data sheet specifies a delay after the RESET command */
  523. msleep(150);
  524. /* set coordinate output rate */
  525. buf[0] = buf[1] = 0xFF;
  526. ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
  527. TSC10_CMD_RATE,
  528. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  529. TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
  530. if (ret < 0)
  531. goto err_out;
  532. if ((buf[0] != 0x06) && (buf[0] != 0x15 || buf[1] != 0x01)) {
  533. ret = -ENODEV;
  534. goto err_out;
  535. }
  536. /* start sending data */
  537. ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
  538. TSC10_CMD_DATA1,
  539. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  540. 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
  541. err_out:
  542. kfree(buf);
  543. err_nobuf:
  544. return ret;
  545. }
  546. static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  547. {
  548. dev->x = ((pkt[2] & 0x03) << 8) | pkt[1];
  549. dev->y = ((pkt[4] & 0x03) << 8) | pkt[3];
  550. dev->touch = pkt[0] & 0x01;
  551. return 1;
  552. }
  553. #endif
  554. /*****************************************************************************
  555. * IRTOUCH Part
  556. */
  557. #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
  558. static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  559. {
  560. dev->x = (pkt[3] << 8) | pkt[2];
  561. dev->y = (pkt[5] << 8) | pkt[4];
  562. dev->touch = (pkt[1] & 0x03) ? 1 : 0;
  563. return 1;
  564. }
  565. #endif
  566. /*****************************************************************************
  567. * ET&T TC5UH/TC4UM part
  568. */
  569. #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB
  570. static int tc45usb_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  571. {
  572. dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1];
  573. dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3];
  574. dev->touch = pkt[0] & 0x01;
  575. return 1;
  576. }
  577. #endif
  578. /*****************************************************************************
  579. * IdealTEK URTC1000 Part
  580. */
  581. #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
  582. #ifndef MULTI_PACKET
  583. #define MULTI_PACKET
  584. #endif
  585. static int idealtek_get_pkt_len(unsigned char *buf, int len)
  586. {
  587. if (buf[0] & 0x80)
  588. return 5;
  589. if (buf[0] == 0x01)
  590. return len;
  591. return 0;
  592. }
  593. static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  594. {
  595. switch (pkt[0] & 0x98) {
  596. case 0x88:
  597. /* touch data in IdealTEK mode */
  598. dev->x = (pkt[1] << 5) | (pkt[2] >> 2);
  599. dev->y = (pkt[3] << 5) | (pkt[4] >> 2);
  600. dev->touch = (pkt[0] & 0x40) ? 1 : 0;
  601. return 1;
  602. case 0x98:
  603. /* touch data in MT emulation mode */
  604. dev->x = (pkt[2] << 5) | (pkt[1] >> 2);
  605. dev->y = (pkt[4] << 5) | (pkt[3] >> 2);
  606. dev->touch = (pkt[0] & 0x40) ? 1 : 0;
  607. return 1;
  608. default:
  609. return 0;
  610. }
  611. }
  612. #endif
  613. /*****************************************************************************
  614. * General Touch Part
  615. */
  616. #ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
  617. static int general_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  618. {
  619. dev->x = (pkt[2] << 8) | pkt[1];
  620. dev->y = (pkt[4] << 8) | pkt[3];
  621. dev->press = pkt[5] & 0xff;
  622. dev->touch = pkt[0] & 0x01;
  623. return 1;
  624. }
  625. #endif
  626. /*****************************************************************************
  627. * GoTop Part
  628. */
  629. #ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
  630. static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  631. {
  632. dev->x = ((pkt[1] & 0x38) << 4) | pkt[2];
  633. dev->y = ((pkt[1] & 0x07) << 7) | pkt[3];
  634. dev->touch = pkt[0] & 0x01;
  635. return 1;
  636. }
  637. #endif
  638. /*****************************************************************************
  639. * JASTEC Part
  640. */
  641. #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
  642. static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  643. {
  644. dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f);
  645. dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f);
  646. dev->touch = (pkt[0] & 0x40) >> 6;
  647. return 1;
  648. }
  649. #endif
  650. /*****************************************************************************
  651. * Zytronic Part
  652. */
  653. #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
  654. static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  655. {
  656. struct usb_interface *intf = dev->interface;
  657. switch (pkt[0]) {
  658. case 0x3A: /* command response */
  659. dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]);
  660. break;
  661. case 0xC0: /* down */
  662. dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
  663. dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
  664. dev->touch = 1;
  665. dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y);
  666. return 1;
  667. case 0x80: /* up */
  668. dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
  669. dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
  670. dev->touch = 0;
  671. dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y);
  672. return 1;
  673. default:
  674. dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]);
  675. break;
  676. }
  677. return 0;
  678. }
  679. #endif
  680. /*****************************************************************************
  681. * NEXIO Part
  682. */
  683. #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
  684. #define NEXIO_TIMEOUT 5000
  685. #define NEXIO_BUFSIZE 1024
  686. #define NEXIO_THRESHOLD 50
  687. struct nexio_priv {
  688. struct urb *ack;
  689. unsigned char *ack_buf;
  690. };
  691. struct nexio_touch_packet {
  692. u8 flags; /* 0xe1 = touch, 0xe1 = release */
  693. __be16 data_len; /* total bytes of touch data */
  694. __be16 x_len; /* bytes for X axis */
  695. __be16 y_len; /* bytes for Y axis */
  696. u8 data[];
  697. } __attribute__ ((packed));
  698. static unsigned char nexio_ack_pkt[2] = { 0xaa, 0x02 };
  699. static unsigned char nexio_init_pkt[4] = { 0x82, 0x04, 0x0a, 0x0f };
  700. static void nexio_ack_complete(struct urb *urb)
  701. {
  702. }
  703. static int nexio_alloc(struct usbtouch_usb *usbtouch)
  704. {
  705. struct nexio_priv *priv;
  706. int ret = -ENOMEM;
  707. usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL);
  708. if (!usbtouch->priv)
  709. goto out_buf;
  710. priv = usbtouch->priv;
  711. priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt),
  712. GFP_KERNEL);
  713. if (!priv->ack_buf)
  714. goto err_priv;
  715. priv->ack = usb_alloc_urb(0, GFP_KERNEL);
  716. if (!priv->ack) {
  717. dev_dbg(&usbtouch->interface->dev,
  718. "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__);
  719. goto err_ack_buf;
  720. }
  721. return 0;
  722. err_ack_buf:
  723. kfree(priv->ack_buf);
  724. err_priv:
  725. kfree(priv);
  726. out_buf:
  727. return ret;
  728. }
  729. static int nexio_init(struct usbtouch_usb *usbtouch)
  730. {
  731. struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
  732. struct usb_host_interface *interface = usbtouch->interface->cur_altsetting;
  733. struct nexio_priv *priv = usbtouch->priv;
  734. int ret = -ENOMEM;
  735. int actual_len, i;
  736. unsigned char *buf;
  737. char *firmware_ver = NULL, *device_name = NULL;
  738. int input_ep = 0, output_ep = 0;
  739. /* find first input and output endpoint */
  740. for (i = 0; i < interface->desc.bNumEndpoints; i++) {
  741. if (!input_ep &&
  742. usb_endpoint_dir_in(&interface->endpoint[i].desc))
  743. input_ep = interface->endpoint[i].desc.bEndpointAddress;
  744. if (!output_ep &&
  745. usb_endpoint_dir_out(&interface->endpoint[i].desc))
  746. output_ep = interface->endpoint[i].desc.bEndpointAddress;
  747. }
  748. if (!input_ep || !output_ep)
  749. return -ENXIO;
  750. buf = kmalloc(NEXIO_BUFSIZE, GFP_NOIO);
  751. if (!buf)
  752. goto out_buf;
  753. /* two empty reads */
  754. for (i = 0; i < 2; i++) {
  755. ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
  756. buf, NEXIO_BUFSIZE, &actual_len,
  757. NEXIO_TIMEOUT);
  758. if (ret < 0)
  759. goto out_buf;
  760. }
  761. /* send init command */
  762. memcpy(buf, nexio_init_pkt, sizeof(nexio_init_pkt));
  763. ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, output_ep),
  764. buf, sizeof(nexio_init_pkt), &actual_len,
  765. NEXIO_TIMEOUT);
  766. if (ret < 0)
  767. goto out_buf;
  768. /* read replies */
  769. for (i = 0; i < 3; i++) {
  770. memset(buf, 0, NEXIO_BUFSIZE);
  771. ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
  772. buf, NEXIO_BUFSIZE, &actual_len,
  773. NEXIO_TIMEOUT);
  774. if (ret < 0 || actual_len < 1 || buf[1] != actual_len)
  775. continue;
  776. switch (buf[0]) {
  777. case 0x83: /* firmware version */
  778. if (!firmware_ver)
  779. firmware_ver = kstrdup(&buf[2], GFP_NOIO);
  780. break;
  781. case 0x84: /* device name */
  782. if (!device_name)
  783. device_name = kstrdup(&buf[2], GFP_NOIO);
  784. break;
  785. }
  786. }
  787. printk(KERN_INFO "Nexio device: %s, firmware version: %s\n",
  788. device_name, firmware_ver);
  789. kfree(firmware_ver);
  790. kfree(device_name);
  791. usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep),
  792. priv->ack_buf, sizeof(nexio_ack_pkt),
  793. nexio_ack_complete, usbtouch);
  794. ret = 0;
  795. out_buf:
  796. kfree(buf);
  797. return ret;
  798. }
  799. static void nexio_exit(struct usbtouch_usb *usbtouch)
  800. {
  801. struct nexio_priv *priv = usbtouch->priv;
  802. usb_kill_urb(priv->ack);
  803. usb_free_urb(priv->ack);
  804. kfree(priv->ack_buf);
  805. kfree(priv);
  806. }
  807. static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
  808. {
  809. struct nexio_touch_packet *packet = (void *) pkt;
  810. struct nexio_priv *priv = usbtouch->priv;
  811. unsigned int data_len = be16_to_cpu(packet->data_len);
  812. unsigned int x_len = be16_to_cpu(packet->x_len);
  813. unsigned int y_len = be16_to_cpu(packet->y_len);
  814. int x, y, begin_x, begin_y, end_x, end_y, w, h, ret;
  815. /* got touch data? */
  816. if ((pkt[0] & 0xe0) != 0xe0)
  817. return 0;
  818. if (data_len > 0xff)
  819. data_len -= 0x100;
  820. if (x_len > 0xff)
  821. x_len -= 0x80;
  822. /* send ACK */
  823. ret = usb_submit_urb(priv->ack, GFP_ATOMIC);
  824. if (!usbtouch->type->max_xc) {
  825. usbtouch->type->max_xc = 2 * x_len;
  826. input_set_abs_params(usbtouch->input, ABS_X,
  827. 0, usbtouch->type->max_xc, 0, 0);
  828. usbtouch->type->max_yc = 2 * y_len;
  829. input_set_abs_params(usbtouch->input, ABS_Y,
  830. 0, usbtouch->type->max_yc, 0, 0);
  831. }
  832. /*
  833. * The device reports state of IR sensors on X and Y axes.
  834. * Each byte represents "darkness" percentage (0-100) of one element.
  835. * 17" touchscreen reports only 64 x 52 bytes so the resolution is low.
  836. * This also means that there's a limited multi-touch capability but
  837. * it's disabled (and untested) here as there's no X driver for that.
  838. */
  839. begin_x = end_x = begin_y = end_y = -1;
  840. for (x = 0; x < x_len; x++) {
  841. if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) {
  842. begin_x = x;
  843. continue;
  844. }
  845. if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) {
  846. end_x = x - 1;
  847. for (y = x_len; y < data_len; y++) {
  848. if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) {
  849. begin_y = y - x_len;
  850. continue;
  851. }
  852. if (end_y == -1 &&
  853. begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) {
  854. end_y = y - 1 - x_len;
  855. w = end_x - begin_x;
  856. h = end_y - begin_y;
  857. #if 0
  858. /* multi-touch */
  859. input_report_abs(usbtouch->input,
  860. ABS_MT_TOUCH_MAJOR, max(w,h));
  861. input_report_abs(usbtouch->input,
  862. ABS_MT_TOUCH_MINOR, min(x,h));
  863. input_report_abs(usbtouch->input,
  864. ABS_MT_POSITION_X, 2*begin_x+w);
  865. input_report_abs(usbtouch->input,
  866. ABS_MT_POSITION_Y, 2*begin_y+h);
  867. input_report_abs(usbtouch->input,
  868. ABS_MT_ORIENTATION, w > h);
  869. input_mt_sync(usbtouch->input);
  870. #endif
  871. /* single touch */
  872. usbtouch->x = 2 * begin_x + w;
  873. usbtouch->y = 2 * begin_y + h;
  874. usbtouch->touch = packet->flags & 0x01;
  875. begin_y = end_y = -1;
  876. return 1;
  877. }
  878. }
  879. begin_x = end_x = -1;
  880. }
  881. }
  882. return 0;
  883. }
  884. #endif
  885. /*****************************************************************************
  886. * ELO part
  887. */
  888. #ifdef CONFIG_TOUCHSCREEN_USB_ELO
  889. static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  890. {
  891. dev->x = (pkt[3] << 8) | pkt[2];
  892. dev->y = (pkt[5] << 8) | pkt[4];
  893. dev->touch = pkt[6] > 0;
  894. dev->press = pkt[6];
  895. return 1;
  896. }
  897. #endif
  898. /*****************************************************************************
  899. * the different device descriptors
  900. */
  901. #ifdef MULTI_PACKET
  902. static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
  903. unsigned char *pkt, int len);
  904. #endif
  905. static struct usbtouch_device_info usbtouch_dev_info[] = {
  906. #ifdef CONFIG_TOUCHSCREEN_USB_ELO
  907. [DEVTYPE_ELO] = {
  908. .min_xc = 0x0,
  909. .max_xc = 0x0fff,
  910. .min_yc = 0x0,
  911. .max_yc = 0x0fff,
  912. .max_press = 0xff,
  913. .rept_size = 8,
  914. .read_data = elo_read_data,
  915. },
  916. #endif
  917. #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
  918. [DEVTYPE_EGALAX] = {
  919. .min_xc = 0x0,
  920. .max_xc = 0x07ff,
  921. .min_yc = 0x0,
  922. .max_yc = 0x07ff,
  923. .rept_size = 16,
  924. .process_pkt = usbtouch_process_multi,
  925. .get_pkt_len = egalax_get_pkt_len,
  926. .read_data = egalax_read_data,
  927. .init = egalax_init,
  928. },
  929. #endif
  930. #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
  931. [DEVTYPE_PANJIT] = {
  932. .min_xc = 0x0,
  933. .max_xc = 0x0fff,
  934. .min_yc = 0x0,
  935. .max_yc = 0x0fff,
  936. .rept_size = 8,
  937. .read_data = panjit_read_data,
  938. },
  939. #endif
  940. #ifdef CONFIG_TOUCHSCREEN_USB_3M
  941. [DEVTYPE_3M] = {
  942. .min_xc = 0x0,
  943. .max_xc = 0x4000,
  944. .min_yc = 0x0,
  945. .max_yc = 0x4000,
  946. .rept_size = 11,
  947. .read_data = mtouch_read_data,
  948. .init = mtouch_init,
  949. },
  950. #endif
  951. #ifdef CONFIG_TOUCHSCREEN_USB_ITM
  952. [DEVTYPE_ITM] = {
  953. .min_xc = 0x0,
  954. .max_xc = 0x0fff,
  955. .min_yc = 0x0,
  956. .max_yc = 0x0fff,
  957. .max_press = 0xff,
  958. .rept_size = 8,
  959. .read_data = itm_read_data,
  960. },
  961. #endif
  962. #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
  963. [DEVTYPE_ETURBO] = {
  964. .min_xc = 0x0,
  965. .max_xc = 0x07ff,
  966. .min_yc = 0x0,
  967. .max_yc = 0x07ff,
  968. .rept_size = 8,
  969. .process_pkt = usbtouch_process_multi,
  970. .get_pkt_len = eturbo_get_pkt_len,
  971. .read_data = eturbo_read_data,
  972. },
  973. #endif
  974. #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
  975. [DEVTYPE_GUNZE] = {
  976. .min_xc = 0x0,
  977. .max_xc = 0x0fff,
  978. .min_yc = 0x0,
  979. .max_yc = 0x0fff,
  980. .rept_size = 4,
  981. .read_data = gunze_read_data,
  982. },
  983. #endif
  984. #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
  985. [DEVTYPE_DMC_TSC10] = {
  986. .min_xc = 0x0,
  987. .max_xc = 0x03ff,
  988. .min_yc = 0x0,
  989. .max_yc = 0x03ff,
  990. .rept_size = 5,
  991. .init = dmc_tsc10_init,
  992. .read_data = dmc_tsc10_read_data,
  993. },
  994. #endif
  995. #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
  996. [DEVTYPE_IRTOUCH] = {
  997. .min_xc = 0x0,
  998. .max_xc = 0x0fff,
  999. .min_yc = 0x0,
  1000. .max_yc = 0x0fff,
  1001. .rept_size = 8,
  1002. .read_data = irtouch_read_data,
  1003. },
  1004. [DEVTYPE_IRTOUCH_HIRES] = {
  1005. .min_xc = 0x0,
  1006. .max_xc = 0x7fff,
  1007. .min_yc = 0x0,
  1008. .max_yc = 0x7fff,
  1009. .rept_size = 8,
  1010. .read_data = irtouch_read_data,
  1011. },
  1012. #endif
  1013. #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
  1014. [DEVTYPE_IDEALTEK] = {
  1015. .min_xc = 0x0,
  1016. .max_xc = 0x0fff,
  1017. .min_yc = 0x0,
  1018. .max_yc = 0x0fff,
  1019. .rept_size = 8,
  1020. .process_pkt = usbtouch_process_multi,
  1021. .get_pkt_len = idealtek_get_pkt_len,
  1022. .read_data = idealtek_read_data,
  1023. },
  1024. #endif
  1025. #ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
  1026. [DEVTYPE_GENERAL_TOUCH] = {
  1027. .min_xc = 0x0,
  1028. .max_xc = 0x7fff,
  1029. .min_yc = 0x0,
  1030. .max_yc = 0x7fff,
  1031. .rept_size = 7,
  1032. .read_data = general_touch_read_data,
  1033. },
  1034. #endif
  1035. #ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
  1036. [DEVTYPE_GOTOP] = {
  1037. .min_xc = 0x0,
  1038. .max_xc = 0x03ff,
  1039. .min_yc = 0x0,
  1040. .max_yc = 0x03ff,
  1041. .rept_size = 4,
  1042. .read_data = gotop_read_data,
  1043. },
  1044. #endif
  1045. #ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
  1046. [DEVTYPE_JASTEC] = {
  1047. .min_xc = 0x0,
  1048. .max_xc = 0x0fff,
  1049. .min_yc = 0x0,
  1050. .max_yc = 0x0fff,
  1051. .rept_size = 4,
  1052. .read_data = jastec_read_data,
  1053. },
  1054. #endif
  1055. #ifdef CONFIG_TOUCHSCREEN_USB_E2I
  1056. [DEVTYPE_E2I] = {
  1057. .min_xc = 0x0,
  1058. .max_xc = 0x7fff,
  1059. .min_yc = 0x0,
  1060. .max_yc = 0x7fff,
  1061. .rept_size = 6,
  1062. .init = e2i_init,
  1063. .read_data = e2i_read_data,
  1064. },
  1065. #endif
  1066. #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
  1067. [DEVTYPE_ZYTRONIC] = {
  1068. .min_xc = 0x0,
  1069. .max_xc = 0x03ff,
  1070. .min_yc = 0x0,
  1071. .max_yc = 0x03ff,
  1072. .rept_size = 5,
  1073. .read_data = zytronic_read_data,
  1074. .irq_always = true,
  1075. },
  1076. #endif
  1077. #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB
  1078. [DEVTYPE_TC45USB] = {
  1079. .min_xc = 0x0,
  1080. .max_xc = 0x0fff,
  1081. .min_yc = 0x0,
  1082. .max_yc = 0x0fff,
  1083. .rept_size = 5,
  1084. .read_data = tc45usb_read_data,
  1085. },
  1086. #endif
  1087. #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
  1088. [DEVTYPE_NEXIO] = {
  1089. .rept_size = 1024,
  1090. .irq_always = true,
  1091. .read_data = nexio_read_data,
  1092. .alloc = nexio_alloc,
  1093. .init = nexio_init,
  1094. .exit = nexio_exit,
  1095. },
  1096. #endif
  1097. #ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
  1098. [DEVTYPE_ETOUCH] = {
  1099. .min_xc = 0x0,
  1100. .max_xc = 0x07ff,
  1101. .min_yc = 0x0,
  1102. .max_yc = 0x07ff,
  1103. .rept_size = 16,
  1104. .process_pkt = usbtouch_process_multi,
  1105. .get_pkt_len = etouch_get_pkt_len,
  1106. .read_data = etouch_read_data,
  1107. },
  1108. #endif
  1109. };
  1110. /*****************************************************************************
  1111. * Generic Part
  1112. */
  1113. static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
  1114. unsigned char *pkt, int len)
  1115. {
  1116. struct usbtouch_device_info *type = usbtouch->type;
  1117. if (!type->read_data(usbtouch, pkt))
  1118. return;
  1119. input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
  1120. if (swap_xy) {
  1121. input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
  1122. input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
  1123. } else {
  1124. input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
  1125. input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
  1126. }
  1127. if (type->max_press)
  1128. input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press);
  1129. input_sync(usbtouch->input);
  1130. }
  1131. #ifdef MULTI_PACKET
  1132. static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
  1133. unsigned char *pkt, int len)
  1134. {
  1135. unsigned char *buffer;
  1136. int pkt_len, pos, buf_len, tmp;
  1137. /* process buffer */
  1138. if (unlikely(usbtouch->buf_len)) {
  1139. /* try to get size */
  1140. pkt_len = usbtouch->type->get_pkt_len(
  1141. usbtouch->buffer, usbtouch->buf_len);
  1142. /* drop? */
  1143. if (unlikely(!pkt_len))
  1144. goto out_flush_buf;
  1145. /* need to append -pkt_len bytes before able to get size */
  1146. if (unlikely(pkt_len < 0)) {
  1147. int append = -pkt_len;
  1148. if (unlikely(append > len))
  1149. append = len;
  1150. if (usbtouch->buf_len + append >= usbtouch->type->rept_size)
  1151. goto out_flush_buf;
  1152. memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append);
  1153. usbtouch->buf_len += append;
  1154. pkt_len = usbtouch->type->get_pkt_len(
  1155. usbtouch->buffer, usbtouch->buf_len);
  1156. if (pkt_len < 0)
  1157. return;
  1158. }
  1159. /* append */
  1160. tmp = pkt_len - usbtouch->buf_len;
  1161. if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size)
  1162. goto out_flush_buf;
  1163. memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp);
  1164. usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len);
  1165. buffer = pkt + tmp;
  1166. buf_len = len - tmp;
  1167. } else {
  1168. buffer = pkt;
  1169. buf_len = len;
  1170. }
  1171. /* loop over the received packet, process */
  1172. pos = 0;
  1173. while (pos < buf_len) {
  1174. /* get packet len */
  1175. pkt_len = usbtouch->type->get_pkt_len(buffer + pos,
  1176. buf_len - pos);
  1177. /* unknown packet: skip one byte */
  1178. if (unlikely(!pkt_len)) {
  1179. pos++;
  1180. continue;
  1181. }
  1182. /* full packet: process */
  1183. if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) {
  1184. usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len);
  1185. } else {
  1186. /* incomplete packet: save in buffer */
  1187. memcpy(usbtouch->buffer, buffer + pos, buf_len - pos);
  1188. usbtouch->buf_len = buf_len - pos;
  1189. return;
  1190. }
  1191. pos += pkt_len;
  1192. }
  1193. out_flush_buf:
  1194. usbtouch->buf_len = 0;
  1195. return;
  1196. }
  1197. #endif
  1198. static void usbtouch_irq(struct urb *urb)
  1199. {
  1200. struct usbtouch_usb *usbtouch = urb->context;
  1201. struct device *dev = &usbtouch->interface->dev;
  1202. int retval;
  1203. switch (urb->status) {
  1204. case 0:
  1205. /* success */
  1206. break;
  1207. case -ETIME:
  1208. /* this urb is timing out */
  1209. dev_dbg(dev,
  1210. "%s - urb timed out - was the device unplugged?\n",
  1211. __func__);
  1212. return;
  1213. case -ECONNRESET:
  1214. case -ENOENT:
  1215. case -ESHUTDOWN:
  1216. case -EPIPE:
  1217. /* this urb is terminated, clean up */
  1218. dev_dbg(dev, "%s - urb shutting down with status: %d\n",
  1219. __func__, urb->status);
  1220. return;
  1221. default:
  1222. dev_dbg(dev, "%s - nonzero urb status received: %d\n",
  1223. __func__, urb->status);
  1224. goto exit;
  1225. }
  1226. usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length);
  1227. exit:
  1228. usb_mark_last_busy(interface_to_usbdev(usbtouch->interface));
  1229. retval = usb_submit_urb(urb, GFP_ATOMIC);
  1230. if (retval)
  1231. dev_err(dev, "%s - usb_submit_urb failed with result: %d\n",
  1232. __func__, retval);
  1233. }
  1234. static int usbtouch_open(struct input_dev *input)
  1235. {
  1236. struct usbtouch_usb *usbtouch = input_get_drvdata(input);
  1237. int r;
  1238. usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface);
  1239. r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0;
  1240. if (r < 0)
  1241. goto out;
  1242. if (!usbtouch->type->irq_always) {
  1243. if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) {
  1244. r = -EIO;
  1245. goto out_put;
  1246. }
  1247. }
  1248. usbtouch->interface->needs_remote_wakeup = 1;
  1249. out_put:
  1250. usb_autopm_put_interface(usbtouch->interface);
  1251. out:
  1252. return r;
  1253. }
  1254. static void usbtouch_close(struct input_dev *input)
  1255. {
  1256. struct usbtouch_usb *usbtouch = input_get_drvdata(input);
  1257. int r;
  1258. if (!usbtouch->type->irq_always)
  1259. usb_kill_urb(usbtouch->irq);
  1260. r = usb_autopm_get_interface(usbtouch->interface);
  1261. usbtouch->interface->needs_remote_wakeup = 0;
  1262. if (!r)
  1263. usb_autopm_put_interface(usbtouch->interface);
  1264. }
  1265. static int usbtouch_suspend
  1266. (struct usb_interface *intf, pm_message_t message)
  1267. {
  1268. struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
  1269. usb_kill_urb(usbtouch->irq);
  1270. return 0;
  1271. }
  1272. static int usbtouch_resume(struct usb_interface *intf)
  1273. {
  1274. struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
  1275. struct input_dev *input = usbtouch->input;
  1276. int result = 0;
  1277. mutex_lock(&input->mutex);
  1278. if (input->users || usbtouch->type->irq_always)
  1279. result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
  1280. mutex_unlock(&input->mutex);
  1281. return result;
  1282. }
  1283. static int usbtouch_reset_resume(struct usb_interface *intf)
  1284. {
  1285. struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
  1286. struct input_dev *input = usbtouch->input;
  1287. int err = 0;
  1288. /* reinit the device */
  1289. if (usbtouch->type->init) {
  1290. err = usbtouch->type->init(usbtouch);
  1291. if (err) {
  1292. dev_dbg(&intf->dev,
  1293. "%s - type->init() failed, err: %d\n",
  1294. __func__, err);
  1295. return err;
  1296. }
  1297. }
  1298. /* restart IO if needed */
  1299. mutex_lock(&input->mutex);
  1300. if (input->users)
  1301. err = usb_submit_urb(usbtouch->irq, GFP_NOIO);
  1302. mutex_unlock(&input->mutex);
  1303. return err;
  1304. }
  1305. static void usbtouch_free_buffers(struct usb_device *udev,
  1306. struct usbtouch_usb *usbtouch)
  1307. {
  1308. usb_free_coherent(udev, usbtouch->data_size,
  1309. usbtouch->data, usbtouch->data_dma);
  1310. kfree(usbtouch->buffer);
  1311. }
  1312. static struct usb_endpoint_descriptor *
  1313. usbtouch_get_input_endpoint(struct usb_host_interface *interface)
  1314. {
  1315. int i;
  1316. for (i = 0; i < interface->desc.bNumEndpoints; i++)
  1317. if (usb_endpoint_dir_in(&interface->endpoint[i].desc))
  1318. return &interface->endpoint[i].desc;
  1319. return NULL;
  1320. }
  1321. static int usbtouch_probe(struct usb_interface *intf,
  1322. const struct usb_device_id *id)
  1323. {
  1324. struct usbtouch_usb *usbtouch;
  1325. struct input_dev *input_dev;
  1326. struct usb_endpoint_descriptor *endpoint;
  1327. struct usb_device *udev = interface_to_usbdev(intf);
  1328. struct usbtouch_device_info *type;
  1329. int err = -ENOMEM;
  1330. /* some devices are ignored */
  1331. if (id->driver_info == DEVTYPE_IGNORE)
  1332. return -ENODEV;
  1333. endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting);
  1334. if (!endpoint)
  1335. return -ENXIO;
  1336. usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
  1337. input_dev = input_allocate_device();
  1338. if (!usbtouch || !input_dev)
  1339. goto out_free;
  1340. type = &usbtouch_dev_info[id->driver_info];
  1341. usbtouch->type = type;
  1342. if (!type->process_pkt)
  1343. type->process_pkt = usbtouch_process_pkt;
  1344. usbtouch->data_size = type->rept_size;
  1345. if (type->get_pkt_len) {
  1346. /*
  1347. * When dealing with variable-length packets we should
  1348. * not request more than wMaxPacketSize bytes at once
  1349. * as we do not know if there is more data coming or
  1350. * we filled exactly wMaxPacketSize bytes and there is
  1351. * nothing else.
  1352. */
  1353. usbtouch->data_size = min(usbtouch->data_size,
  1354. usb_endpoint_maxp(endpoint));
  1355. }
  1356. usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size,
  1357. GFP_KERNEL, &usbtouch->data_dma);
  1358. if (!usbtouch->data)
  1359. goto out_free;
  1360. if (type->get_pkt_len) {
  1361. usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
  1362. if (!usbtouch->buffer)
  1363. goto out_free_buffers;
  1364. }
  1365. usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL);
  1366. if (!usbtouch->irq) {
  1367. dev_dbg(&intf->dev,
  1368. "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__);
  1369. goto out_free_buffers;
  1370. }
  1371. usbtouch->interface = intf;
  1372. usbtouch->input = input_dev;
  1373. if (udev->manufacturer)
  1374. strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name));
  1375. if (udev->product) {
  1376. if (udev->manufacturer)
  1377. strlcat(usbtouch->name, " ", sizeof(usbtouch->name));
  1378. strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name));
  1379. }
  1380. if (!strlen(usbtouch->name))
  1381. snprintf(usbtouch->name, sizeof(usbtouch->name),
  1382. "USB Touchscreen %04x:%04x",
  1383. le16_to_cpu(udev->descriptor.idVendor),
  1384. le16_to_cpu(udev->descriptor.idProduct));
  1385. usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys));
  1386. strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys));
  1387. input_dev->name = usbtouch->name;
  1388. input_dev->phys = usbtouch->phys;
  1389. usb_to_input_id(udev, &input_dev->id);
  1390. input_dev->dev.parent = &intf->dev;
  1391. input_set_drvdata(input_dev, usbtouch);
  1392. input_dev->open = usbtouch_open;
  1393. input_dev->close = usbtouch_close;
  1394. input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
  1395. input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
  1396. input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0);
  1397. input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0);
  1398. if (type->max_press)
  1399. input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
  1400. type->max_press, 0, 0);
  1401. if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
  1402. usb_fill_int_urb(usbtouch->irq, udev,
  1403. usb_rcvintpipe(udev, endpoint->bEndpointAddress),
  1404. usbtouch->data, usbtouch->data_size,
  1405. usbtouch_irq, usbtouch, endpoint->bInterval);
  1406. else
  1407. usb_fill_bulk_urb(usbtouch->irq, udev,
  1408. usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
  1409. usbtouch->data, usbtouch->data_size,
  1410. usbtouch_irq, usbtouch);
  1411. usbtouch->irq->dev = udev;
  1412. usbtouch->irq->transfer_dma = usbtouch->data_dma;
  1413. usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
  1414. /* device specific allocations */
  1415. if (type->alloc) {
  1416. err = type->alloc(usbtouch);
  1417. if (err) {
  1418. dev_dbg(&intf->dev,
  1419. "%s - type->alloc() failed, err: %d\n",
  1420. __func__, err);
  1421. goto out_free_urb;
  1422. }
  1423. }
  1424. /* device specific initialisation*/
  1425. if (type->init) {
  1426. err = type->init(usbtouch);
  1427. if (err) {
  1428. dev_dbg(&intf->dev,
  1429. "%s - type->init() failed, err: %d\n",
  1430. __func__, err);
  1431. goto out_do_exit;
  1432. }
  1433. }
  1434. err = input_register_device(usbtouch->input);
  1435. if (err) {
  1436. dev_dbg(&intf->dev,
  1437. "%s - input_register_device failed, err: %d\n",
  1438. __func__, err);
  1439. goto out_do_exit;
  1440. }
  1441. usb_set_intfdata(intf, usbtouch);
  1442. if (usbtouch->type->irq_always) {
  1443. /* this can't fail */
  1444. usb_autopm_get_interface(intf);
  1445. err = usb_submit_urb(usbtouch->irq, GFP_KERNEL);
  1446. if (err) {
  1447. usb_autopm_put_interface(intf);
  1448. dev_err(&intf->dev,
  1449. "%s - usb_submit_urb failed with result: %d\n",
  1450. __func__, err);
  1451. goto out_unregister_input;
  1452. }
  1453. }
  1454. return 0;
  1455. out_unregister_input:
  1456. input_unregister_device(input_dev);
  1457. input_dev = NULL;
  1458. out_do_exit:
  1459. if (type->exit)
  1460. type->exit(usbtouch);
  1461. out_free_urb:
  1462. usb_free_urb(usbtouch->irq);
  1463. out_free_buffers:
  1464. usbtouch_free_buffers(udev, usbtouch);
  1465. out_free:
  1466. input_free_device(input_dev);
  1467. kfree(usbtouch);
  1468. return err;
  1469. }
  1470. static void usbtouch_disconnect(struct usb_interface *intf)
  1471. {
  1472. struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
  1473. if (!usbtouch)
  1474. return;
  1475. dev_dbg(&intf->dev,
  1476. "%s - usbtouch is initialized, cleaning up\n", __func__);
  1477. usb_set_intfdata(intf, NULL);
  1478. /* this will stop IO via close */
  1479. input_unregister_device(usbtouch->input);
  1480. usb_free_urb(usbtouch->irq);
  1481. if (usbtouch->type->exit)
  1482. usbtouch->type->exit(usbtouch);
  1483. usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
  1484. kfree(usbtouch);
  1485. }
  1486. MODULE_DEVICE_TABLE(usb, usbtouch_devices);
  1487. static struct usb_driver usbtouch_driver = {
  1488. .name = "usbtouchscreen",
  1489. .probe = usbtouch_probe,
  1490. .disconnect = usbtouch_disconnect,
  1491. .suspend = usbtouch_suspend,
  1492. .resume = usbtouch_resume,
  1493. .reset_resume = usbtouch_reset_resume,
  1494. .id_table = usbtouch_devices,
  1495. .supports_autosuspend = 1,
  1496. };
  1497. module_usb_driver(usbtouch_driver);
  1498. MODULE_AUTHOR(DRIVER_AUTHOR);
  1499. MODULE_DESCRIPTION(DRIVER_DESC);
  1500. MODULE_LICENSE("GPL");
  1501. MODULE_ALIAS("touchkitusb");
  1502. MODULE_ALIAS("itmtouch");
  1503. MODULE_ALIAS("mtouchusb");