2 * HID driver for multitouch panels
4 * Copyright (c) 2010-2011 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
8 * This code is partly based on hid-egalax.c:
10 * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
11 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
12 * Copyright (c) 2010 Canonical, Ltd.
14 * This code is partly based on hid-3m-pct.c:
16 * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
17 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
18 * Copyright (c) 2010 Canonical, Ltd.
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License as published by the Free
25 * Software Foundation; either version 2 of the License, or (at your option)
29 #include <linux/device.h>
30 #include <linux/hid.h>
31 #include <linux/module.h>
32 #include <linux/slab.h>
33 #include <linux/usb.h>
34 #include <linux/input/mt.h>
35 #include "usbhid/usbhid.h"
38 MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
39 MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
40 MODULE_DESCRIPTION("HID multitouch panels");
41 MODULE_LICENSE("GPL");
45 /* quirks to control the device */
46 #define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
47 #define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
48 #define MT_QUIRK_CYPRESS (1 << 2)
49 #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
50 #define MT_QUIRK_ALWAYS_VALID (1 << 4)
51 #define MT_QUIRK_VALID_IS_INRANGE (1 << 5)
52 #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)
53 #define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 7)
54 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
58 __s32 contactid; /* the device ContactID assigned to this slot */
59 bool touch_state; /* is the touch valid? */
60 bool seen_in_this_frame;/* has this slot been updated */
64 struct mt_slot curdata; /* placeholder of incoming data */
65 struct mt_class *mtclass; /* our mt device class */
66 unsigned last_field_index; /* last field index of the report */
67 unsigned last_slot_field; /* the last field of a slot */
68 int last_mt_collection; /* last known mt-related collection */
69 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
70 __u8 num_received; /* how many contacts we received */
71 __u8 num_expected; /* expected last contact index */
73 bool curvalid; /* is the current contact valid? */
74 struct mt_slot *slots;
78 __s32 name; /* MT_CLS */
80 __s32 sn_move; /* Signal/noise ratio for move events */
81 __s32 sn_width; /* Signal/noise ratio for width events */
82 __s32 sn_height; /* Signal/noise ratio for height events */
83 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
87 /* classes of device behavior */
88 #define MT_CLS_DEFAULT 0x0001
90 #define MT_CLS_SERIAL 0x0002
91 #define MT_CLS_CONFIDENCE 0x0003
92 #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0004
93 #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0005
94 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0006
95 #define MT_CLS_DUAL_NSMU_CONTACTID 0x0007
96 #define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
98 /* vendor specific classes */
99 #define MT_CLS_3M 0x0101
100 #define MT_CLS_CYPRESS 0x0102
101 #define MT_CLS_EGALAX 0x0103
103 #define MT_DEFAULT_MAXCONTACT 10
106 * these device-dependent functions determine what slot corresponds
107 * to a valid contact that was just read.
110 static int cypress_compute_slot(struct mt_device *td)
112 if (td->curdata.contactid != 0 || td->num_received == 0)
113 return td->curdata.contactid;
118 static int find_slot_from_contactid(struct mt_device *td)
121 for (i = 0; i < td->maxcontacts; ++i) {
122 if (td->slots[i].contactid == td->curdata.contactid &&
123 td->slots[i].touch_state)
126 for (i = 0; i < td->maxcontacts; ++i) {
127 if (!td->slots[i].seen_in_this_frame &&
128 !td->slots[i].touch_state)
131 /* should not occurs. If this happens that means
132 * that the device sent more touches that it says
133 * in the report descriptor. It is ignored then. */
137 struct mt_class mt_classes[] = {
138 { .name = MT_CLS_DEFAULT,
139 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
140 { .name = MT_CLS_SERIAL,
141 .quirks = MT_QUIRK_ALWAYS_VALID},
142 { .name = MT_CLS_CONFIDENCE,
143 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
144 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
145 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
146 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
147 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
148 .quirks = MT_QUIRK_VALID_IS_INRANGE |
149 MT_QUIRK_SLOT_IS_CONTACTID,
151 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
152 .quirks = MT_QUIRK_VALID_IS_INRANGE |
153 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
155 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
156 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
157 MT_QUIRK_SLOT_IS_CONTACTID,
159 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
160 .quirks = MT_QUIRK_VALID_IS_INRANGE |
161 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
164 * vendor specific classes
167 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
168 MT_QUIRK_SLOT_IS_CONTACTID,
172 { .name = MT_CLS_CYPRESS,
173 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
176 { .name = MT_CLS_EGALAX,
177 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
178 MT_QUIRK_VALID_IS_INRANGE |
179 MT_QUIRK_EGALAX_XYZ_FIXUP,
188 static void mt_feature_mapping(struct hid_device *hdev,
189 struct hid_field *field, struct hid_usage *usage)
191 struct mt_device *td = hid_get_drvdata(hdev);
193 switch (usage->hid) {
194 case HID_DG_INPUTMODE:
195 td->inputmode = field->report->id;
197 case HID_DG_CONTACTMAX:
198 td->maxcontacts = field->value[0];
199 if (td->mtclass->maxcontacts)
200 /* check if the maxcontacts is given by the class */
201 td->maxcontacts = td->mtclass->maxcontacts;
207 static void set_abs(struct input_dev *input, unsigned int code,
208 struct hid_field *field, int snratio)
210 int fmin = field->logical_minimum;
211 int fmax = field->logical_maximum;
212 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
213 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
216 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
217 struct hid_field *field, struct hid_usage *usage,
218 unsigned long **bit, int *max)
220 struct mt_device *td = hid_get_drvdata(hdev);
221 struct mt_class *cls = td->mtclass;
222 __s32 quirks = cls->quirks;
224 /* Only map fields from TouchScreen or TouchPad collections.
225 * We need to ignore fields that belong to other collections
226 * such as Mouse that might have the same GenericDesktop usages. */
227 if (field->application == HID_DG_TOUCHSCREEN)
228 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
229 else if (field->application == HID_DG_TOUCHPAD)
230 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
234 switch (usage->hid & HID_USAGE_PAGE) {
237 switch (usage->hid) {
239 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
240 field->logical_maximum = 32760;
241 hid_map_usage(hi, usage, bit, max,
242 EV_ABS, ABS_MT_POSITION_X);
243 set_abs(hi->input, ABS_MT_POSITION_X, field,
245 /* touchscreen emulation */
246 set_abs(hi->input, ABS_X, field, cls->sn_move);
247 if (td->last_mt_collection == usage->collection_index) {
248 td->last_slot_field = usage->hid;
249 td->last_field_index = field->index;
253 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
254 field->logical_maximum = 32760;
255 hid_map_usage(hi, usage, bit, max,
256 EV_ABS, ABS_MT_POSITION_Y);
257 set_abs(hi->input, ABS_MT_POSITION_Y, field,
259 /* touchscreen emulation */
260 set_abs(hi->input, ABS_Y, field, cls->sn_move);
261 if (td->last_mt_collection == usage->collection_index) {
262 td->last_slot_field = usage->hid;
263 td->last_field_index = field->index;
269 case HID_UP_DIGITIZER:
270 switch (usage->hid) {
272 if (td->last_mt_collection == usage->collection_index) {
273 td->last_slot_field = usage->hid;
274 td->last_field_index = field->index;
277 case HID_DG_CONFIDENCE:
278 if (td->last_mt_collection == usage->collection_index) {
279 td->last_slot_field = usage->hid;
280 td->last_field_index = field->index;
283 case HID_DG_TIPSWITCH:
284 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
285 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
286 if (td->last_mt_collection == usage->collection_index) {
287 td->last_slot_field = usage->hid;
288 td->last_field_index = field->index;
291 case HID_DG_CONTACTID:
292 if (!td->maxcontacts)
293 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
294 input_mt_init_slots(hi->input, td->maxcontacts);
295 td->last_slot_field = usage->hid;
296 td->last_field_index = field->index;
297 td->last_mt_collection = usage->collection_index;
300 hid_map_usage(hi, usage, bit, max,
301 EV_ABS, ABS_MT_TOUCH_MAJOR);
302 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
304 if (td->last_mt_collection == usage->collection_index) {
305 td->last_slot_field = usage->hid;
306 td->last_field_index = field->index;
310 hid_map_usage(hi, usage, bit, max,
311 EV_ABS, ABS_MT_TOUCH_MINOR);
312 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
314 input_set_abs_params(hi->input,
315 ABS_MT_ORIENTATION, 0, 1, 0, 0);
316 if (td->last_mt_collection == usage->collection_index) {
317 td->last_slot_field = usage->hid;
318 td->last_field_index = field->index;
321 case HID_DG_TIPPRESSURE:
322 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
323 field->logical_minimum = 0;
324 hid_map_usage(hi, usage, bit, max,
325 EV_ABS, ABS_MT_PRESSURE);
326 set_abs(hi->input, ABS_MT_PRESSURE, field,
328 /* touchscreen emulation */
329 set_abs(hi->input, ABS_PRESSURE, field,
331 if (td->last_mt_collection == usage->collection_index) {
332 td->last_slot_field = usage->hid;
333 td->last_field_index = field->index;
336 case HID_DG_CONTACTCOUNT:
337 if (td->last_mt_collection == usage->collection_index)
338 td->last_field_index = field->index;
340 case HID_DG_CONTACTMAX:
341 /* we don't set td->last_slot_field as contactcount and
342 * contact max are global to the report */
343 if (td->last_mt_collection == usage->collection_index)
344 td->last_field_index = field->index;
347 /* let hid-input decide for the others */
351 /* we do not want to map these: no input-oriented meaning */
358 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
359 struct hid_field *field, struct hid_usage *usage,
360 unsigned long **bit, int *max)
362 if (usage->type == EV_KEY || usage->type == EV_ABS)
363 set_bit(usage->type, hi->input->evbit);
368 static int mt_compute_slot(struct mt_device *td)
370 __s32 quirks = td->mtclass->quirks;
372 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
373 return td->curdata.contactid;
375 if (quirks & MT_QUIRK_CYPRESS)
376 return cypress_compute_slot(td);
378 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
379 return td->num_received;
381 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
382 return td->curdata.contactid - 1;
384 return find_slot_from_contactid(td);
388 * this function is called when a whole contact has been processed,
389 * so that it can assign it to a slot and store the data there
391 static void mt_complete_slot(struct mt_device *td)
393 td->curdata.seen_in_this_frame = true;
395 int slotnum = mt_compute_slot(td);
397 if (slotnum >= 0 && slotnum < td->maxcontacts)
398 td->slots[slotnum] = td->curdata;
405 * this function is called when a whole packet has been received and processed,
406 * so that it can decide what to send to the input layer.
408 static void mt_emit_event(struct mt_device *td, struct input_dev *input)
412 for (i = 0; i < td->maxcontacts; ++i) {
413 struct mt_slot *s = &(td->slots[i]);
414 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
415 !s->seen_in_this_frame) {
416 s->touch_state = false;
419 input_mt_slot(input, i);
420 input_mt_report_slot_state(input, MT_TOOL_FINGER,
422 if (s->touch_state) {
423 /* this finger is on the screen */
424 int wide = (s->w > s->h);
425 /* divided by two to match visual scale of touch */
426 int major = max(s->w, s->h) >> 1;
427 int minor = min(s->w, s->h) >> 1;
429 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
430 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
431 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
432 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
433 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
434 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
436 s->seen_in_this_frame = false;
440 input_mt_report_pointer_emulation(input, true);
442 td->num_received = 0;
447 static int mt_event(struct hid_device *hid, struct hid_field *field,
448 struct hid_usage *usage, __s32 value)
450 struct mt_device *td = hid_get_drvdata(hid);
451 __s32 quirks = td->mtclass->quirks;
453 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
454 switch (usage->hid) {
456 if (quirks & MT_QUIRK_ALWAYS_VALID)
458 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
459 td->curvalid = value;
461 case HID_DG_TIPSWITCH:
462 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
463 td->curvalid = value;
464 td->curdata.touch_state = value;
466 case HID_DG_CONFIDENCE:
467 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
468 td->curvalid = value;
470 case HID_DG_CONTACTID:
471 td->curdata.contactid = value;
473 case HID_DG_TIPPRESSURE:
474 td->curdata.p = value;
477 td->curdata.x = value;
480 td->curdata.y = value;
483 td->curdata.w = value;
486 td->curdata.h = value;
488 case HID_DG_CONTACTCOUNT:
490 * Includes multi-packet support where subsequent
491 * packets are sent with zero contactcount.
494 td->num_expected = value;
498 /* fallback to the generic hidinput handling */
502 if (usage->hid == td->last_slot_field) {
503 mt_complete_slot(td);
506 if (field->index == td->last_field_index
507 && td->num_received >= td->num_expected)
508 mt_emit_event(td, field->hidinput->input);
512 /* we have handled the hidinput part, now remains hiddev */
513 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
514 hid->hiddev_hid_event(hid, field, usage, value);
519 static void mt_set_input_mode(struct hid_device *hdev)
521 struct mt_device *td = hid_get_drvdata(hdev);
522 struct hid_report *r;
523 struct hid_report_enum *re;
525 if (td->inputmode < 0)
528 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
529 r = re->report_id_hash[td->inputmode];
531 r->field[0]->value[0] = 0x02;
532 usbhid_submit_report(hdev, r, USB_DIR_OUT);
536 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
539 struct mt_device *td;
540 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
542 for (i = 0; mt_classes[i].name ; i++) {
543 if (id->driver_data == mt_classes[i].name) {
544 mtclass = &(mt_classes[i]);
549 /* This allows the driver to correctly support devices
550 * that emit events over several HID messages.
552 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
554 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
556 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
559 td->mtclass = mtclass;
561 td->last_mt_collection = -1;
562 hid_set_drvdata(hdev, td);
564 ret = hid_parse(hdev);
568 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
572 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
575 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
581 mt_set_input_mode(hdev);
591 static int mt_reset_resume(struct hid_device *hdev)
593 mt_set_input_mode(hdev);
598 static void mt_remove(struct hid_device *hdev)
600 struct mt_device *td = hid_get_drvdata(hdev);
604 hid_set_drvdata(hdev, NULL);
607 static const struct hid_device_id mt_devices[] = {
610 { .driver_data = MT_CLS_3M,
611 HID_USB_DEVICE(USB_VENDOR_ID_3M,
612 USB_DEVICE_ID_3M1968) },
613 { .driver_data = MT_CLS_3M,
614 HID_USB_DEVICE(USB_VENDOR_ID_3M,
615 USB_DEVICE_ID_3M2256) },
616 { .driver_data = MT_CLS_3M,
617 HID_USB_DEVICE(USB_VENDOR_ID_3M,
618 USB_DEVICE_ID_3M3266) },
620 /* ActionStar panels */
621 { .driver_data = MT_CLS_DEFAULT,
622 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
623 USB_DEVICE_ID_ACTIONSTAR_1011) },
626 { .driver_data = MT_CLS_SERIAL,
627 HID_USB_DEVICE(USB_VENDOR_ID_ATMEL,
628 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
631 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
632 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
633 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
634 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
635 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
636 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
637 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
638 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
639 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
640 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
641 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
642 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
644 /* Chunghwa Telecom touch panels */
645 { .driver_data = MT_CLS_DEFAULT,
646 HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
647 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
650 { .driver_data = MT_CLS_DEFAULT,
651 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
652 USB_DEVICE_ID_CVTOUCH_SCREEN) },
655 { .driver_data = MT_CLS_CYPRESS,
656 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
657 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
659 /* eGalax devices (resistive) */
660 { .driver_data = MT_CLS_EGALAX,
661 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
662 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
663 { .driver_data = MT_CLS_EGALAX,
664 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
665 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
667 /* eGalax devices (capacitive) */
668 { .driver_data = MT_CLS_EGALAX,
669 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
670 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
671 { .driver_data = MT_CLS_EGALAX,
672 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
673 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
674 { .driver_data = MT_CLS_EGALAX,
675 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
676 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
677 { .driver_data = MT_CLS_EGALAX,
678 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
679 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
680 { .driver_data = MT_CLS_EGALAX,
681 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
682 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
683 { .driver_data = MT_CLS_EGALAX,
684 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
685 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
687 /* Elo TouchSystems IntelliTouch Plus panel */
688 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
689 HID_USB_DEVICE(USB_VENDOR_ID_ELO,
690 USB_DEVICE_ID_ELO_TS2515) },
692 /* GeneralTouch panel */
693 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
694 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
695 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
697 /* GoodTouch panels */
698 { .driver_data = MT_CLS_DEFAULT,
699 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
700 USB_DEVICE_ID_GOODTOUCH_000f) },
703 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
704 HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
705 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
708 { .driver_data = MT_CLS_SERIAL,
709 HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
710 USB_DEVICE_ID_IDEACOM_IDC6650) },
712 /* Ilitek dual touch panel */
713 { .driver_data = MT_CLS_DEFAULT,
714 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK,
715 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
718 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
719 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
720 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
722 /* LG Display panels */
723 { .driver_data = MT_CLS_DEFAULT,
724 HID_USB_DEVICE(USB_VENDOR_ID_LG,
725 USB_DEVICE_ID_LG_MULTITOUCH) },
728 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
729 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
730 USB_DEVICE_ID_CRYSTALTOUCH) },
731 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
732 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
733 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
736 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
737 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
738 USB_DEVICE_ID_ASUS_T91MT)},
739 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
740 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
741 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
742 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
743 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX,
744 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
746 /* PenMount panels */
747 { .driver_data = MT_CLS_CONFIDENCE,
748 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
749 USB_DEVICE_ID_PENMOUNT_PCI) },
751 /* PixArt optical touch screen */
752 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
753 HID_USB_DEVICE(USB_VENDOR_ID_PIXART,
754 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
755 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
756 HID_USB_DEVICE(USB_VENDOR_ID_PIXART,
757 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
758 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
759 HID_USB_DEVICE(USB_VENDOR_ID_PIXART,
760 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
762 /* PixCir-based panels */
763 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
764 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
765 USB_DEVICE_ID_HANVON_MULTITOUCH) },
766 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
767 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
768 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
771 { .driver_data = MT_CLS_CONFIDENCE,
772 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
774 { .driver_data = MT_CLS_CONFIDENCE,
775 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
776 USB_DEVICE_ID_MTP_STM)},
777 { .driver_data = MT_CLS_CONFIDENCE,
778 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
779 USB_DEVICE_ID_MTP_SITRONIX)},
781 /* Touch International panels */
782 { .driver_data = MT_CLS_DEFAULT,
783 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
784 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
787 { .driver_data = MT_CLS_DEFAULT,
788 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
789 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
790 { .driver_data = MT_CLS_DEFAULT,
791 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
792 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
794 { .driver_data = MT_CLS_DEFAULT,
795 HID_USB_DEVICE(USB_VENDOR_ID_XAT,
796 USB_DEVICE_ID_XAT_CSR) },
799 { .driver_data = MT_CLS_DEFAULT,
800 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
801 USB_DEVICE_ID_XIROKU_SPX) },
802 { .driver_data = MT_CLS_DEFAULT,
803 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
804 USB_DEVICE_ID_XIROKU_MPX) },
805 { .driver_data = MT_CLS_DEFAULT,
806 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
807 USB_DEVICE_ID_XIROKU_CSR) },
808 { .driver_data = MT_CLS_DEFAULT,
809 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
810 USB_DEVICE_ID_XIROKU_SPX1) },
811 { .driver_data = MT_CLS_DEFAULT,
812 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
813 USB_DEVICE_ID_XIROKU_MPX1) },
814 { .driver_data = MT_CLS_DEFAULT,
815 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
816 USB_DEVICE_ID_XIROKU_CSR1) },
817 { .driver_data = MT_CLS_DEFAULT,
818 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
819 USB_DEVICE_ID_XIROKU_SPX2) },
820 { .driver_data = MT_CLS_DEFAULT,
821 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
822 USB_DEVICE_ID_XIROKU_MPX2) },
823 { .driver_data = MT_CLS_DEFAULT,
824 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
825 USB_DEVICE_ID_XIROKU_CSR2) },
829 MODULE_DEVICE_TABLE(hid, mt_devices);
831 static const struct hid_usage_id mt_grabbed_usages[] = {
832 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
833 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
836 static struct hid_driver mt_driver = {
837 .name = "hid-multitouch",
838 .id_table = mt_devices,
841 .input_mapping = mt_input_mapping,
842 .input_mapped = mt_input_mapped,
843 .feature_mapping = mt_feature_mapping,
844 .usage_table = mt_grabbed_usages,
847 .reset_resume = mt_reset_resume,
851 static int __init mt_init(void)
853 return hid_register_driver(&mt_driver);
856 static void __exit mt_exit(void)
858 hid_unregister_driver(&mt_driver);
861 module_init(mt_init);
862 module_exit(mt_exit);