aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/usbtouchscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 9dbd8b4d9a6e..22cd96f58c99 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -17,6 +17,7 @@
17 * - Zytronic capacitive touchscreen 17 * - Zytronic capacitive touchscreen
18 * - NEXIO/iNexio 18 * - NEXIO/iNexio
19 * - Elo TouchSystems 2700 IntelliTouch 19 * - Elo TouchSystems 2700 IntelliTouch
20 * - EasyTouch USB Dual/Multi touch controller from Data Modul
20 * 21 *
21 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 22 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
22 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 23 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -60,11 +61,11 @@
60#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 61#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
61#define DRIVER_DESC "USB Touchscreen Driver" 62#define DRIVER_DESC "USB Touchscreen Driver"
62 63
63static int swap_xy; 64static bool swap_xy;
64module_param(swap_xy, bool, 0644); 65module_param(swap_xy, bool, 0644);
65MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); 66MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
66 67
67static int hwcalib_xy; 68static bool hwcalib_xy;
68module_param(hwcalib_xy, bool, 0644); 69module_param(hwcalib_xy, bool, 0644);
69MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available"); 70MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
70 71
@@ -140,6 +141,7 @@ enum {
140 DEVTYPE_TC45USB, 141 DEVTYPE_TC45USB,
141 DEVTYPE_NEXIO, 142 DEVTYPE_NEXIO,
142 DEVTYPE_ELO, 143 DEVTYPE_ELO,
144 DEVTYPE_ETOUCH,
143}; 145};
144 146
145#define USB_DEVICE_HID_CLASS(vend, prod) \ 147#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -245,6 +247,10 @@ static const struct usb_device_id usbtouch_devices[] = {
245 {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO}, 247 {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO},
246#endif 248#endif
247 249
250#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
251 {USB_DEVICE(0x7374, 0x0001), .driver_info = DEVTYPE_ETOUCH},
252#endif
253
248 {} 254 {}
249}; 255};
250 256
@@ -326,6 +332,51 @@ static int egalax_get_pkt_len(unsigned char *buf, int len)
326} 332}
327#endif 333#endif
328 334
335/*****************************************************************************
336 * EasyTouch part
337 */
338
339#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
340
341#ifndef MULTI_PACKET
342#define MULTI_PACKET
343#endif
344
345#define ETOUCH_PKT_TYPE_MASK 0xFE
346#define ETOUCH_PKT_TYPE_REPT 0x80
347#define ETOUCH_PKT_TYPE_REPT2 0xB0
348#define ETOUCH_PKT_TYPE_DIAG 0x0A
349
350static int etouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
351{
352 if ((pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT &&
353 (pkt[0] & ETOUCH_PKT_TYPE_MASK) != ETOUCH_PKT_TYPE_REPT2)
354 return 0;
355
356 dev->x = ((pkt[1] & 0x1F) << 7) | (pkt[2] & 0x7F);
357 dev->y = ((pkt[3] & 0x1F) << 7) | (pkt[4] & 0x7F);
358 dev->touch = pkt[0] & 0x01;
359
360 return 1;
361}
362
363static int etouch_get_pkt_len(unsigned char *buf, int len)
364{
365 switch (buf[0] & ETOUCH_PKT_TYPE_MASK) {
366 case ETOUCH_PKT_TYPE_REPT:
367 case ETOUCH_PKT_TYPE_REPT2:
368 return 5;
369
370 case ETOUCH_PKT_TYPE_DIAG:
371 if (len < 2)
372 return -1;
373
374 return buf[1] + 2;
375 }
376
377 return 0;
378}
379#endif
329 380
330/***************************************************************************** 381/*****************************************************************************
331 * PanJit Part 382 * PanJit Part
@@ -1175,6 +1226,18 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
1175 .exit = nexio_exit, 1226 .exit = nexio_exit,
1176 }, 1227 },
1177#endif 1228#endif
1229#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH
1230 [DEVTYPE_ETOUCH] = {
1231 .min_xc = 0x0,
1232 .max_xc = 0x07ff,
1233 .min_yc = 0x0,
1234 .max_yc = 0x07ff,
1235 .rept_size = 16,
1236 .process_pkt = usbtouch_process_multi,
1237 .get_pkt_len = etouch_get_pkt_len,
1238 .read_data = etouch_read_data,
1239 },
1240#endif
1178}; 1241};
1179 1242
1180 1243
@@ -1616,18 +1679,7 @@ static struct usb_driver usbtouch_driver = {
1616 .supports_autosuspend = 1, 1679 .supports_autosuspend = 1,
1617}; 1680};
1618 1681
1619static int __init usbtouch_init(void) 1682module_usb_driver(usbtouch_driver);
1620{
1621 return usb_register(&usbtouch_driver);
1622}
1623
1624static void __exit usbtouch_cleanup(void)
1625{
1626 usb_deregister(&usbtouch_driver);
1627}
1628
1629module_init(usbtouch_init);
1630module_exit(usbtouch_cleanup);
1631 1683
1632MODULE_AUTHOR(DRIVER_AUTHOR); 1684MODULE_AUTHOR(DRIVER_AUTHOR);
1633MODULE_DESCRIPTION(DRIVER_DESC); 1685MODULE_DESCRIPTION(DRIVER_DESC);