usbtouchscreen.c 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772
  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");