1 /******************************************************************************
3 * Driver for USB Touchscreens, supporting those devices:
5 * includes eTurboTouch CT-410/510/700
6 * - 3M/Microtouch EX II series
12 * - IRTOUCHSYSTEMS/UNITOP
15 * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch>
16 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of the
21 * License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 * Driver is based on touchkitusb.c
33 * - ITM parts are from itmtouch.c
34 * - 3M parts are from mtouchusb.c
35 * - PanJit parts are from an unmerged driver by Lanslott Gish
36 * - DMC TSC 10/25 are from Holger Schurig, with ideas from an unmerged
37 * driver from Marius Vollmer
39 *****************************************************************************/
43 #include <linux/kernel.h>
44 #include <linux/slab.h>
45 #include <linux/input.h>
46 #include <linux/module.h>
47 #include <linux/init.h>
48 #include <linux/usb.h>
49 #include <linux/usb/input.h>
52 #define DRIVER_VERSION "v0.5"
53 #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
54 #define DRIVER_DESC "USB Touchscreen Driver"
57 module_param(swap_xy, bool, 0644);
58 MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
60 /* device specifc data/functions */
62 struct usbtouch_device_info {
65 int min_press, max_press;
69 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
70 int (*get_pkt_len) (unsigned char *pkt, int len);
71 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
72 int (*init) (struct usbtouch_usb *usbtouch);
75 #define USBTOUCH_FLG_BUFFER 0x01
78 /* a usbtouch device */
82 unsigned char *buffer;
85 struct usb_device *udev;
86 struct input_dev *input;
87 struct usbtouch_device_info *type;
96 #if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK)
101 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
102 unsigned char *pkt, int len);
119 static struct usb_device_id usbtouch_devices[] = {
120 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
121 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
122 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
123 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
124 {USB_DEVICE(0x0eef, 0x0001), .driver_info = DEVTYPE_EGALAX},
125 {USB_DEVICE(0x0eef, 0x0002), .driver_info = DEVTYPE_EGALAX},
126 {USB_DEVICE(0x1234, 0x0001), .driver_info = DEVTYPE_EGALAX},
127 {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX},
130 #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
131 {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
132 {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
133 {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
134 {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
137 #ifdef CONFIG_TOUCHSCREEN_USB_3M
138 {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
141 #ifdef CONFIG_TOUCHSCREEN_USB_ITM
142 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
145 #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
146 {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO},
149 #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
150 {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE},
153 #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
154 {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10},
157 #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
158 {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
159 {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
162 #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
163 {USB_DEVICE(0x1391, 0x1000), .driver_info = DEVTYPE_IDEALTEK},
170 /*****************************************************************************
174 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
176 #define EGALAX_PKT_TYPE_MASK 0xFE
177 #define EGALAX_PKT_TYPE_REPT 0x80
178 #define EGALAX_PKT_TYPE_DIAG 0x0A
180 static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
182 if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
185 dev->x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F);
186 dev->y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F);
187 dev->touch = pkt[0] & 0x01;
192 static int egalax_get_pkt_len(unsigned char *buf, int len)
194 switch (buf[0] & EGALAX_PKT_TYPE_MASK) {
195 case EGALAX_PKT_TYPE_REPT:
198 case EGALAX_PKT_TYPE_DIAG:
210 /*****************************************************************************
213 #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
214 static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
216 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1];
217 dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3];
218 dev->touch = pkt[0] & 0x01;
225 /*****************************************************************************
228 #ifdef CONFIG_TOUCHSCREEN_USB_3M
230 #define MTOUCHUSB_ASYNC_REPORT 1
231 #define MTOUCHUSB_RESET 7
232 #define MTOUCHUSB_REQ_CTRLLR_ID 10
234 static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
236 dev->x = (pkt[8] << 8) | pkt[7];
237 dev->y = (pkt[10] << 8) | pkt[9];
238 dev->touch = (pkt[2] & 0x40) ? 1 : 0;
243 static int mtouch_init(struct usbtouch_usb *usbtouch)
247 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
249 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
250 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
251 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
257 for (i = 0; i < 3; i++) {
258 ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
259 MTOUCHUSB_ASYNC_REPORT,
260 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
261 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
262 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
275 /*****************************************************************************
278 #ifdef CONFIG_TOUCHSCREEN_USB_ITM
279 static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
283 * ITM devices report invalid x/y data if not touched.
284 * if the screen was touched before but is not touched any more
285 * report touch as 0 with the last valid x/y data once. then stop
286 * reporting data until touched again.
288 dev->press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F);
290 touch = ~pkt[7] & 0x20;
300 dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
301 dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
309 /*****************************************************************************
312 #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
313 static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
317 /* packets should start with sync */
318 if (!(pkt[0] & 0x80))
321 shift = (6 - (pkt[0] & 0x03));
322 dev->x = ((pkt[3] << 7) | pkt[4]) >> shift;
323 dev->y = ((pkt[1] << 7) | pkt[2]) >> shift;
324 dev->touch = (pkt[0] & 0x10) ? 1 : 0;
329 static int eturbo_get_pkt_len(unsigned char *buf, int len)
340 /*****************************************************************************
343 #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
344 static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
346 if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80))
349 dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[2] & 0x7F);
350 dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[3] & 0x7F);
351 dev->touch = pkt[0] & 0x20;
357 /*****************************************************************************
360 * Documentation about the controller and it's protocol can be found at
361 * http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf
362 * http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf
364 #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
366 /* supported data rates. currently using 130 */
367 #define TSC10_RATE_POINT 0x50
368 #define TSC10_RATE_30 0x40
369 #define TSC10_RATE_50 0x41
370 #define TSC10_RATE_80 0x42
371 #define TSC10_RATE_100 0x43
372 #define TSC10_RATE_130 0x44
373 #define TSC10_RATE_150 0x45
376 #define TSC10_CMD_RESET 0x55
377 #define TSC10_CMD_RATE 0x05
378 #define TSC10_CMD_DATA1 0x01
380 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
382 struct usb_device *dev = usbtouch->udev;
384 unsigned char buf[2];
387 buf[0] = buf[1] = 0xFF;
388 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
390 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
391 0, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
394 if (buf[0] != 0x06 || buf[1] != 0x00)
397 /* set coordinate output rate */
398 buf[0] = buf[1] = 0xFF;
399 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
401 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
402 TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
405 if (buf[0] != 0x06 || buf[1] != 0x00)
408 /* start sending data */
409 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
411 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
412 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
420 static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
422 dev->x = ((pkt[2] & 0x03) << 8) | pkt[1];
423 dev->y = ((pkt[4] & 0x03) << 8) | pkt[3];
424 dev->touch = pkt[0] & 0x01;
431 /*****************************************************************************
434 #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
435 static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
437 dev->x = (pkt[3] << 8) | pkt[2];
438 dev->y = (pkt[5] << 8) | pkt[4];
439 dev->touch = (pkt[1] & 0x03) ? 1 : 0;
446 /*****************************************************************************
447 * IdealTEK URTC1000 Part
449 #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
450 static int idealtek_get_pkt_len(unsigned char *buf, int len)
459 static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
461 switch (pkt[0] & 0x98) {
463 /* touch data in IdealTEK mode */
464 dev->x = (pkt[1] << 5) | (pkt[2] >> 2);
465 dev->y = (pkt[3] << 5) | (pkt[4] >> 2);
466 dev->touch = (pkt[0] & 0x40) ? 1 : 0;
470 /* touch data in MT emulation mode */
471 dev->x = (pkt[2] << 5) | (pkt[1] >> 2);
472 dev->y = (pkt[4] << 5) | (pkt[3] >> 2);
473 dev->touch = (pkt[0] & 0x40) ? 1 : 0;
483 /*****************************************************************************
484 * the different device descriptors
486 static struct usbtouch_device_info usbtouch_dev_info[] = {
487 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
494 .flags = USBTOUCH_FLG_BUFFER,
495 .process_pkt = usbtouch_process_multi,
496 .get_pkt_len = egalax_get_pkt_len,
497 .read_data = egalax_read_data,
501 #ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
508 .read_data = panjit_read_data,
512 #ifdef CONFIG_TOUCHSCREEN_USB_3M
519 .read_data = mtouch_read_data,
524 #ifdef CONFIG_TOUCHSCREEN_USB_ITM
532 .read_data = itm_read_data,
536 #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
543 .flags = USBTOUCH_FLG_BUFFER,
544 .process_pkt = usbtouch_process_multi,
545 .get_pkt_len = eturbo_get_pkt_len,
546 .read_data = eturbo_read_data,
550 #ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
557 .read_data = gunze_read_data,
561 #ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
562 [DEVTYPE_DMC_TSC10] = {
568 .init = dmc_tsc10_init,
569 .read_data = dmc_tsc10_read_data,
573 #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
574 [DEVTYPE_IRTOUCH] = {
580 .read_data = irtouch_read_data,
584 #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
585 [DEVTYPE_IDEALTEK] = {
591 .flags = USBTOUCH_FLG_BUFFER,
592 .process_pkt = usbtouch_process_multi,
593 .get_pkt_len = idealtek_get_pkt_len,
594 .read_data = idealtek_read_data,
600 /*****************************************************************************
603 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
604 unsigned char *pkt, int len)
606 struct usbtouch_device_info *type = usbtouch->type;
608 if (!type->read_data(usbtouch, pkt))
611 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
614 input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
615 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
617 input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
618 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
621 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press);
622 input_sync(usbtouch->input);
627 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
628 unsigned char *pkt, int len)
630 unsigned char *buffer;
631 int pkt_len, pos, buf_len, tmp;
634 if (unlikely(usbtouch->buf_len)) {
635 /* try to get size */
636 pkt_len = usbtouch->type->get_pkt_len(
637 usbtouch->buffer, usbtouch->buf_len);
640 if (unlikely(!pkt_len))
643 /* need to append -pkt_len bytes before able to get size */
644 if (unlikely(pkt_len < 0)) {
645 int append = -pkt_len;
646 if (unlikely(append > len))
648 if (usbtouch->buf_len + append >= usbtouch->type->rept_size)
650 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append);
651 usbtouch->buf_len += append;
653 pkt_len = usbtouch->type->get_pkt_len(
654 usbtouch->buffer, usbtouch->buf_len);
660 tmp = pkt_len - usbtouch->buf_len;
661 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size)
663 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp);
664 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len);
673 /* loop over the received packet, process */
675 while (pos < buf_len) {
677 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, len);
679 /* unknown packet: drop everything */
680 if (unlikely(!pkt_len))
683 /* full packet: process */
684 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) {
685 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len);
687 /* incomplete packet: save in buffer */
688 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos);
689 usbtouch->buf_len = buf_len - pos;
696 usbtouch->buf_len = 0;
702 static void usbtouch_irq(struct urb *urb)
704 struct usbtouch_usb *usbtouch = urb->context;
707 switch (urb->status) {
712 /* this urb is timing out */
713 dbg("%s - urb timed out - was the device unplugged?",
719 /* this urb is terminated, clean up */
720 dbg("%s - urb shutting down with status: %d",
721 __FUNCTION__, urb->status);
724 dbg("%s - nonzero urb status received: %d",
725 __FUNCTION__, urb->status);
729 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length);
732 retval = usb_submit_urb(urb, GFP_ATOMIC);
734 err("%s - usb_submit_urb failed with result: %d",
735 __FUNCTION__, retval);
738 static int usbtouch_open(struct input_dev *input)
740 struct usbtouch_usb *usbtouch = input_get_drvdata(input);
742 usbtouch->irq->dev = usbtouch->udev;
744 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
750 static void usbtouch_close(struct input_dev *input)
752 struct usbtouch_usb *usbtouch = input_get_drvdata(input);
754 usb_kill_urb(usbtouch->irq);
758 static void usbtouch_free_buffers(struct usb_device *udev,
759 struct usbtouch_usb *usbtouch)
761 usb_buffer_free(udev, usbtouch->type->rept_size,
762 usbtouch->data, usbtouch->data_dma);
763 kfree(usbtouch->buffer);
767 static int usbtouch_probe(struct usb_interface *intf,
768 const struct usb_device_id *id)
770 struct usbtouch_usb *usbtouch;
771 struct input_dev *input_dev;
772 struct usb_host_interface *interface;
773 struct usb_endpoint_descriptor *endpoint;
774 struct usb_device *udev = interface_to_usbdev(intf);
775 struct usbtouch_device_info *type;
778 interface = intf->cur_altsetting;
779 endpoint = &interface->endpoint[0].desc;
781 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
782 input_dev = input_allocate_device();
783 if (!usbtouch || !input_dev)
786 type = &usbtouch_dev_info[id->driver_info];
787 usbtouch->type = type;
788 if (!type->process_pkt)
789 type->process_pkt = usbtouch_process_pkt;
791 usbtouch->data = usb_buffer_alloc(udev, type->rept_size,
792 GFP_KERNEL, &usbtouch->data_dma);
796 if (type->flags & USBTOUCH_FLG_BUFFER) {
797 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
798 if (!usbtouch->buffer)
799 goto out_free_buffers;
802 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL);
803 if (!usbtouch->irq) {
804 dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__);
805 goto out_free_buffers;
808 usbtouch->udev = udev;
809 usbtouch->input = input_dev;
811 if (udev->manufacturer)
812 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name));
815 if (udev->manufacturer)
816 strlcat(usbtouch->name, " ", sizeof(usbtouch->name));
817 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name));
820 if (!strlen(usbtouch->name))
821 snprintf(usbtouch->name, sizeof(usbtouch->name),
822 "USB Touchscreen %04x:%04x",
823 le16_to_cpu(udev->descriptor.idVendor),
824 le16_to_cpu(udev->descriptor.idProduct));
826 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys));
827 strlcpy(usbtouch->phys, "/input0", sizeof(usbtouch->phys));
829 input_dev->name = usbtouch->name;
830 input_dev->phys = usbtouch->phys;
831 usb_to_input_id(udev, &input_dev->id);
832 input_dev->dev.parent = &intf->dev;
834 input_set_drvdata(input_dev, usbtouch);
836 input_dev->open = usbtouch_open;
837 input_dev->close = usbtouch_close;
839 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
840 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
841 input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0);
842 input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0);
844 input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
845 type->max_press, 0, 0);
847 usb_fill_int_urb(usbtouch->irq, usbtouch->udev,
848 usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress),
849 usbtouch->data, type->rept_size,
850 usbtouch_irq, usbtouch, endpoint->bInterval);
852 usbtouch->irq->dev = usbtouch->udev;
853 usbtouch->irq->transfer_dma = usbtouch->data_dma;
854 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
856 /* device specific init */
858 err = type->init(usbtouch);
860 dbg("%s - type->init() failed, err: %d", __FUNCTION__, err);
861 goto out_free_buffers;
865 err = input_register_device(usbtouch->input);
867 dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err);
868 goto out_free_buffers;
871 usb_set_intfdata(intf, usbtouch);
876 usbtouch_free_buffers(udev, usbtouch);
878 input_free_device(input_dev);
883 static void usbtouch_disconnect(struct usb_interface *intf)
885 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
887 dbg("%s - called", __FUNCTION__);
892 dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
893 usb_set_intfdata(intf, NULL);
894 usb_kill_urb(usbtouch->irq);
895 input_unregister_device(usbtouch->input);
896 usb_free_urb(usbtouch->irq);
897 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
901 MODULE_DEVICE_TABLE(usb, usbtouch_devices);
903 static struct usb_driver usbtouch_driver = {
904 .name = "usbtouchscreen",
905 .probe = usbtouch_probe,
906 .disconnect = usbtouch_disconnect,
907 .id_table = usbtouch_devices,
910 static int __init usbtouch_init(void)
912 return usb_register(&usbtouch_driver);
915 static void __exit usbtouch_cleanup(void)
917 usb_deregister(&usbtouch_driver);
920 module_init(usbtouch_init);
921 module_exit(usbtouch_cleanup);
923 MODULE_AUTHOR(DRIVER_AUTHOR);
924 MODULE_DESCRIPTION(DRIVER_DESC);
925 MODULE_LICENSE("GPL");
927 MODULE_ALIAS("touchkitusb");
928 MODULE_ALIAS("itmtouch");
929 MODULE_ALIAS("mtouchusb");