usbtouchscreen.c (722232bcd8086b37cd3af7d9e94e7e10b231979e) | usbtouchscreen.c (2330ed18b27a8f4f10e48e0a1c65ede56e03825c) |
---|---|
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 | 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 |
|
17 * 18 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 19 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 20 * 21 * This program is free software; you can redistribute it and/or 22 * modify it under the terms of the GNU General Public License as 23 * published by the Free Software Foundation; either version 2 of the 24 * License, or (at your option) any later version. --- 43 unchanged lines hidden (view full) --- 68/* device specifc data/functions */ 69struct usbtouch_usb; 70struct usbtouch_device_info { 71 int min_xc, max_xc; 72 int min_yc, max_yc; 73 int min_press, max_press; 74 int rept_size; 75 | 18 * 19 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 20 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 21 * 22 * This program is free software; you can redistribute it and/or 23 * modify it under the terms of the GNU General Public License as 24 * published by the Free Software Foundation; either version 2 of the 25 * License, or (at your option) any later version. --- 43 unchanged lines hidden (view full) --- 69/* device specifc data/functions */ 70struct usbtouch_usb; 71struct usbtouch_device_info { 72 int min_xc, max_xc; 73 int min_yc, max_yc; 74 int min_press, max_press; 75 int rept_size; 76 |
77 /* 78 * Always service the USB devices irq not just when the input device is 79 * open. This is useful when devices have a watchdog which prevents us 80 * from periodically polling the device. Leave this unset unless your 81 * touchscreen device requires it, as it does consume more of the USB 82 * bandwidth. 83 */ 84 bool irq_always; 85 |
|
76 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 77 78 /* 79 * used to get the packet len. possible return values: 80 * > 0: packet len 81 * = 0: skip one byte 82 * < 0: -return value more bytes needed 83 */ --- 32 unchanged lines hidden (view full) --- 116 DEVTYPE_GUNZE, 117 DEVTYPE_DMC_TSC10, 118 DEVTYPE_IRTOUCH, 119 DEVTYPE_IDEALTEK, 120 DEVTYPE_GENERAL_TOUCH, 121 DEVTYPE_GOTOP, 122 DEVTYPE_JASTEC, 123 DEVTYPE_E2I, | 86 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 87 88 /* 89 * used to get the packet len. possible return values: 90 * > 0: packet len 91 * = 0: skip one byte 92 * < 0: -return value more bytes needed 93 */ --- 32 unchanged lines hidden (view full) --- 126 DEVTYPE_GUNZE, 127 DEVTYPE_DMC_TSC10, 128 DEVTYPE_IRTOUCH, 129 DEVTYPE_IDEALTEK, 130 DEVTYPE_GENERAL_TOUCH, 131 DEVTYPE_GOTOP, 132 DEVTYPE_JASTEC, 133 DEVTYPE_E2I, |
134 DEVTYPE_ZYTRONIC, |
|
124}; 125 126#define USB_DEVICE_HID_CLASS(vend, prod) \ 127 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ 128 | USB_DEVICE_ID_MATCH_INT_PROTOCOL \ 129 | USB_DEVICE_ID_MATCH_DEVICE, \ 130 .idVendor = (vend), \ 131 .idProduct = (prod), \ --- 64 unchanged lines hidden (view full) --- 196 197#ifdef CONFIG_TOUCHSCREEN_USB_JASTEC 198 {USB_DEVICE(0x0f92, 0x0001), .driver_info = DEVTYPE_JASTEC}, 199#endif 200 201#ifdef CONFIG_TOUCHSCREEN_USB_E2I 202 {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, 203#endif | 135}; 136 137#define USB_DEVICE_HID_CLASS(vend, prod) \ 138 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ 139 | USB_DEVICE_ID_MATCH_INT_PROTOCOL \ 140 | USB_DEVICE_ID_MATCH_DEVICE, \ 141 .idVendor = (vend), \ 142 .idProduct = (prod), \ --- 64 unchanged lines hidden (view full) --- 207 208#ifdef CONFIG_TOUCHSCREEN_USB_JASTEC 209 {USB_DEVICE(0x0f92, 0x0001), .driver_info = DEVTYPE_JASTEC}, 210#endif 211 212#ifdef CONFIG_TOUCHSCREEN_USB_E2I 213 {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, 214#endif |
215 216#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 217 {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, 218#endif 219 |
|
204 {} 205}; 206 207 208/***************************************************************************** 209 * e2i Part 210 */ 211 --- 404 unchanged lines hidden (view full) --- 616 dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f); 617 dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f); 618 dev->touch = (pkt[0] & 0x40) >> 6; 619 620 return 1; 621} 622#endif 623 | 220 {} 221}; 222 223 224/***************************************************************************** 225 * e2i Part 226 */ 227 --- 404 unchanged lines hidden (view full) --- 632 dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f); 633 dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f); 634 dev->touch = (pkt[0] & 0x40) >> 6; 635 636 return 1; 637} 638#endif 639 |
640/***************************************************************************** 641 * Zytronic Part 642 */ 643#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 644static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 645{ 646 switch (pkt[0]) { 647 case 0x3A: /* command response */ 648 dbg("%s: Command response %d", __func__, pkt[1]); 649 break; |
|
624 | 650 |
651 case 0xC0: /* down */ 652 dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); 653 dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); 654 dev->touch = 1; 655 dbg("%s: down %d,%d", __func__, dev->x, dev->y); 656 return 1; 657 658 case 0x80: /* up */ 659 dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); 660 dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); 661 dev->touch = 0; 662 dbg("%s: up %d,%d", __func__, dev->x, dev->y); 663 return 1; 664 665 default: 666 dbg("%s: Unknown return %d", __func__, pkt[0]); 667 break; 668 } 669 670 return 0; 671} 672#endif 673 |
|
625/***************************************************************************** 626 * the different device descriptors 627 */ 628#ifdef MULTI_PACKET 629static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, 630 unsigned char *pkt, int len); 631#endif 632 --- 145 unchanged lines hidden (view full) --- 778 .max_xc = 0x7fff, 779 .min_yc = 0x0, 780 .max_yc = 0x7fff, 781 .rept_size = 6, 782 .init = e2i_init, 783 .read_data = e2i_read_data, 784 }, 785#endif | 674/***************************************************************************** 675 * the different device descriptors 676 */ 677#ifdef MULTI_PACKET 678static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, 679 unsigned char *pkt, int len); 680#endif 681 --- 145 unchanged lines hidden (view full) --- 827 .max_xc = 0x7fff, 828 .min_yc = 0x0, 829 .max_yc = 0x7fff, 830 .rept_size = 6, 831 .init = e2i_init, 832 .read_data = e2i_read_data, 833 }, 834#endif |
835 836#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 837 [DEVTYPE_ZYTRONIC] = { 838 .min_xc = 0x0, 839 .max_xc = 0x03ff, 840 .min_yc = 0x0, 841 .max_yc = 0x03ff, 842 .rept_size = 5, 843 .read_data = zytronic_read_data, 844 .irq_always = true, 845 }, 846#endif |
|
786}; 787 788 789/***************************************************************************** 790 * Generic Part 791 */ 792static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, 793 unsigned char *pkt, int len) --- 134 unchanged lines hidden (view full) --- 928} 929 930static int usbtouch_open(struct input_dev *input) 931{ 932 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 933 934 usbtouch->irq->dev = usbtouch->udev; 935 | 847}; 848 849 850/***************************************************************************** 851 * Generic Part 852 */ 853static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, 854 unsigned char *pkt, int len) --- 134 unchanged lines hidden (view full) --- 989} 990 991static int usbtouch_open(struct input_dev *input) 992{ 993 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 994 995 usbtouch->irq->dev = usbtouch->udev; 996 |
936 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) 937 return -EIO; | 997 if (!usbtouch->type->irq_always) { 998 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) 999 return -EIO; 1000 } |
938 939 return 0; 940} 941 942static void usbtouch_close(struct input_dev *input) 943{ 944 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 945 | 1001 1002 return 0; 1003} 1004 1005static void usbtouch_close(struct input_dev *input) 1006{ 1007 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 1008 |
946 usb_kill_urb(usbtouch->irq); | 1009 if (!usbtouch->type->irq_always) 1010 usb_kill_urb(usbtouch->irq); |
947} 948 949 950static void usbtouch_free_buffers(struct usb_device *udev, 951 struct usbtouch_usb *usbtouch) 952{ 953 usb_buffer_free(udev, usbtouch->type->rept_size, 954 usbtouch->data, usbtouch->data_dma); --- 106 unchanged lines hidden (view full) --- 1061 err = input_register_device(usbtouch->input); 1062 if (err) { 1063 dbg("%s - input_register_device failed, err: %d", __func__, err); 1064 goto out_free_buffers; 1065 } 1066 1067 usb_set_intfdata(intf, usbtouch); 1068 | 1011} 1012 1013 1014static void usbtouch_free_buffers(struct usb_device *udev, 1015 struct usbtouch_usb *usbtouch) 1016{ 1017 usb_buffer_free(udev, usbtouch->type->rept_size, 1018 usbtouch->data, usbtouch->data_dma); --- 106 unchanged lines hidden (view full) --- 1125 err = input_register_device(usbtouch->input); 1126 if (err) { 1127 dbg("%s - input_register_device failed, err: %d", __func__, err); 1128 goto out_free_buffers; 1129 } 1130 1131 usb_set_intfdata(intf, usbtouch); 1132 |
1133 if (usbtouch->type->irq_always) 1134 usb_submit_urb(usbtouch->irq, GFP_KERNEL); 1135 |
|
1069 return 0; 1070 1071out_free_buffers: 1072 usbtouch_free_buffers(udev, usbtouch); 1073out_free: 1074 input_free_device(input_dev); 1075 kfree(usbtouch); 1076 return err; --- 49 unchanged lines hidden --- | 1136 return 0; 1137 1138out_free_buffers: 1139 usbtouch_free_buffers(udev, usbtouch); 1140out_free: 1141 input_free_device(input_dev); 1142 kfree(usbtouch); 1143 return err; --- 49 unchanged lines hidden --- |