@@ -812,6 +812,11 @@ config TOUCHSCREEN_USB_NEXIO
bool "NEXIO/iNexio device support" if EXPERT
depends on TOUCHSCREEN_USB_COMPOSITE
+config TOUCHSCREEN_USB_CJTOUCH
+ default y
+ bool "CJTouch Touchscreen device support" if EXPERT
+ depends on TOUCHSCREEN_USB_COMPOSITE
+
config TOUCHSCREEN_USB_EASYTOUCH
default y
bool "EasyTouch USB Touch controller device support" if EMBEDDED
@@ -18,6 +18,7 @@
* - NEXIO/iNexio
* - Elo TouchSystems 2700 IntelliTouch
* - EasyTouch USB Dual/Multi touch controller from Data Modul
+ * - CJTouch
*
* Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
* Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -142,6 +143,8 @@ enum {
DEVTYPE_NEXIO,
DEVTYPE_ELO,
DEVTYPE_ETOUCH,
+ DEVTYPE_CJTOUCH,
+ DEVTYPE_CJMTOUCH,
};
#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -251,6 +254,11 @@ static const struct usb_device_id usbtouch_devices[] = {
{USB_DEVICE(0x7374, 0x0001), .driver_info = DEVTYPE_ETOUCH},
#endif
+#ifdef CONFIG_TOUCHSCREEN_USB_CJTOUCH
+ {USB_DEVICE(0x24b8, 0x0001), .driver_info = DEVTYPE_CJTOUCH},
+ {USB_DEVICE(0x24b8, 0x0004), .driver_info = DEVTYPE_CJTOUCH},
+ {USB_DEVICE(0x24b8, 0x000f), .driver_info = DEVTYPE_CJMTOUCH},
+#endif
{}
};
@@ -1065,6 +1073,78 @@ static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
/*****************************************************************************
+ * CJTouch part
+ */
+
+#ifdef CONFIG_TOUCHSCREEN_USB_CJTOUCH
+static int x = 1;
+static int y = 1;
+static int old2State = 1;
+
+
+static int cjtouch_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
+{
+ dev->x = ((pkt[2] & 0x00FF) << 8) | (pkt[1] & 0x00FF);
+ dev->y = ((pkt[4] & 0x00FF) << 8) | (pkt[3] & 0x00FF);
+ dev->press = pkt[0];
+ dev->touch = pkt[0];
+
+ return 1;
+}
+
+static void cjmtouch_touch_process_pkt(struct usbtouch_usb *usbtouch,
+ unsigned char *pkt, int len)
+{
+ int touch1 = pkt[1] & 0x01;
+ int touch2 = pkt[7] & 0x01;
+
+ if (touch1)
+ input_report_abs(usbtouch->input, ABS_MT_TOUCH_MAJOR, 1);
+ else
+ input_report_abs(usbtouch->input, ABS_MT_TOUCH_MAJOR, 0);
+
+ {
+ x = ((pkt[4] << 8) | pkt[3]);
+ y = ((pkt[6] << 8) | pkt[5]);
+
+ input_report_abs(usbtouch->input, ABS_MT_WIDTH_MAJOR, 1);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_X, x);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_Y, y);
+
+ input_mt_sync(usbtouch->input);
+ }
+
+ if (touch2) {
+ old2State = 1;
+ input_report_abs(usbtouch->input, ABS_MT_TOUCH_MAJOR, 1);
+
+ input_report_abs(usbtouch->input, ABS_MT_WIDTH_MAJOR, 1);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_X, x);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_Y, y);
+
+ input_mt_sync(usbtouch->input);
+ } else {
+ if (old2State == 1) {
+ old2State = 0;
+ input_report_abs(usbtouch->input, ABS_MT_TOUCH_MAJOR, 0);
+
+ x = (x * 800) / 0xfff;
+ y = (y * 600) / 0xfff;
+
+ input_report_abs(usbtouch->input, ABS_MT_WIDTH_MAJOR, 1);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_X, x);
+ input_report_abs(usbtouch->input, ABS_MT_POSITION_Y, y);
+
+ input_mt_sync(usbtouch->input);
+ }
+ }
+
+ input_sync(usbtouch->input);
+
+}
+#endif
+
+/*****************************************************************************
* the different device descriptors
*/
#ifdef MULTI_PACKET
@@ -1284,6 +1364,25 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
.read_data = etouch_read_data,
},
#endif
+#ifdef CONFIG_TOUCHSCREEN_USB_CJTOUCH
+ [DEVTYPE_CJTOUCH] = {
+ .min_xc = 0x0,
+ .max_xc = 0x0fff,
+ .min_yc = 0x0,
+ .max_yc = 0x0fff,
+ .rept_size = 7,
+ .read_data = cjtouch_touch_read_data,
+ },
+
+ [DEVTYPE_CJMTOUCH] = {
+ .min_xc = 0x0,
+ .max_xc = 0x0fff,
+ .min_yc = 0x0,
+ .max_yc = 0x0fff,
+ .rept_size = 14,
+ .process_pkt = cjmtouch_touch_process_pkt,
+ },
+#endif
};