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_VALID_IS_INRANGE (1 << 4)
51 #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
52 #define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
53 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 7)
57 __s32 contactid; /* the device ContactID assigned to this slot */
58 bool touch_state; /* is the touch valid? */
59 bool seen_in_this_frame;/* has this slot been updated */
63 struct mt_slot curdata; /* placeholder of incoming data */
64 struct mt_class *mtclass; /* our mt device class */
65 unsigned last_field_index; /* last field index of the report */
66 unsigned last_slot_field; /* the last field of a slot */
67 int last_mt_collection; /* the last mt-collection */
68 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
69 __u8 num_received; /* how many contacts we received */
70 __u8 num_expected; /* expected last contact index */
72 bool curvalid; /* is the current contact valid? */
73 struct mt_slot *slots;
77 __s32 name; /* MT_CLS */
79 __s32 sn_move; /* Signal/noise ratio for move events */
80 __s32 sn_width; /* Signal/noise ratio for width events */
81 __s32 sn_height; /* Signal/noise ratio for height events */
82 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
86 /* classes of device behavior */
87 #define MT_CLS_DEFAULT 0x0001
89 #define MT_CLS_CONFIDENCE 0x0002
90 #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0003
91 #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0004
92 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0005
93 #define MT_CLS_DUAL_NSMU_CONTACTID 0x0006
95 /* vendor specific classes */
96 #define MT_CLS_3M 0x0101
97 #define MT_CLS_CYPRESS 0x0102
98 #define MT_CLS_EGALAX 0x0103
100 #define MT_DEFAULT_MAXCONTACT 10
103 * these device-dependent functions determine what slot corresponds
104 * to a valid contact that was just read.
107 static int cypress_compute_slot(struct mt_device *td)
109 if (td->curdata.contactid != 0 || td->num_received == 0)
110 return td->curdata.contactid;
115 static int find_slot_from_contactid(struct mt_device *td)
118 for (i = 0; i < td->maxcontacts; ++i) {
119 if (td->slots[i].contactid == td->curdata.contactid &&
120 td->slots[i].touch_state)
123 for (i = 0; i < td->maxcontacts; ++i) {
124 if (!td->slots[i].seen_in_this_frame &&
125 !td->slots[i].touch_state)
128 /* should not occurs. If this happens that means
129 * that the device sent more touches that it says
130 * in the report descriptor. It is ignored then. */
134 struct mt_class mt_classes[] = {
135 { .name = MT_CLS_DEFAULT,
136 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
137 { .name = MT_CLS_CONFIDENCE,
138 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
139 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
140 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
141 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
142 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
143 .quirks = MT_QUIRK_VALID_IS_INRANGE |
144 MT_QUIRK_SLOT_IS_CONTACTID,
146 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
147 .quirks = MT_QUIRK_VALID_IS_INRANGE |
148 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
150 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
151 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
152 MT_QUIRK_SLOT_IS_CONTACTID,
156 * vendor specific classes
159 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
160 MT_QUIRK_SLOT_IS_CONTACTID,
164 { .name = MT_CLS_CYPRESS,
165 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
168 { .name = MT_CLS_EGALAX,
169 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
170 MT_QUIRK_VALID_IS_INRANGE |
171 MT_QUIRK_EGALAX_XYZ_FIXUP,
180 static void mt_feature_mapping(struct hid_device *hdev,
181 struct hid_field *field, struct hid_usage *usage)
183 struct mt_device *td = hid_get_drvdata(hdev);
185 switch (usage->hid) {
186 case HID_DG_INPUTMODE:
187 td->inputmode = field->report->id;
189 case HID_DG_CONTACTMAX:
190 td->maxcontacts = field->value[0];
191 if (td->mtclass->maxcontacts)
192 /* check if the maxcontacts is given by the class */
193 td->maxcontacts = td->mtclass->maxcontacts;
199 static void set_abs(struct input_dev *input, unsigned int code,
200 struct hid_field *field, int snratio)
202 int fmin = field->logical_minimum;
203 int fmax = field->logical_maximum;
204 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
205 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
208 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
209 struct hid_field *field, struct hid_usage *usage,
210 unsigned long **bit, int *max)
212 struct mt_device *td = hid_get_drvdata(hdev);
213 struct mt_class *cls = td->mtclass;
214 __s32 quirks = cls->quirks;
216 /* Only map fields from TouchScreen or TouchPad collections.
217 * We need to ignore fields that belong to other collections
218 * such as Mouse that might have the same GenericDesktop usages. */
219 if (field->application == HID_DG_TOUCHSCREEN)
220 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
221 else if (field->application == HID_DG_TOUCHPAD)
222 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
226 switch (usage->hid & HID_USAGE_PAGE) {
229 switch (usage->hid) {
231 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
232 field->logical_maximum = 32760;
233 hid_map_usage(hi, usage, bit, max,
234 EV_ABS, ABS_MT_POSITION_X);
235 set_abs(hi->input, ABS_MT_POSITION_X, field,
237 if (td->last_mt_collection == usage->collection_index) {
238 td->last_slot_field = usage->hid;
239 td->last_field_index = field->index;
243 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
244 field->logical_maximum = 32760;
245 hid_map_usage(hi, usage, bit, max,
246 EV_ABS, ABS_MT_POSITION_Y);
247 set_abs(hi->input, ABS_MT_POSITION_Y, field,
249 if (td->last_mt_collection == usage->collection_index) {
250 td->last_slot_field = usage->hid;
251 td->last_field_index = field->index;
257 case HID_UP_DIGITIZER:
258 switch (usage->hid) {
260 hid_map_usage(hi, usage, bit, max, EV_KEY,
262 input_set_capability(hi->input, EV_KEY,
264 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, 0);
265 if (td->last_mt_collection == usage->collection_index) {
266 td->last_slot_field = usage->hid;
267 td->last_field_index = field->index;
270 case HID_DG_CONFIDENCE:
271 hid_map_usage(hi, usage, bit, max, EV_KEY,
273 input_set_capability(hi->input, EV_KEY,
275 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, 0);
276 if (td->last_mt_collection == usage->collection_index) {
277 td->last_slot_field = usage->hid;
278 td->last_field_index = field->index;
281 case HID_DG_TIPSWITCH:
282 hid_map_usage(hi, usage, bit, max, EV_KEY,
284 input_set_capability(hi->input, EV_KEY,
286 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, 0);
287 if (td->last_mt_collection == usage->collection_index) {
288 td->last_slot_field = usage->hid;
289 td->last_field_index = field->index;
292 case HID_DG_CONTACTID:
293 hid_map_usage(hi, usage, bit, max, EV_KEY,
295 input_set_capability(hi->input, EV_KEY,
297 set_abs(hi->input, ABS_MT_TRACKING_ID, field, 0);
298 td->last_slot_field = usage->hid;
299 td->last_field_index = field->index;
300 td->last_mt_collection = usage->collection_index;
303 hid_map_usage(hi, usage, bit, max, EV_KEY,
305 input_set_capability(hi->input, EV_KEY,
307 set_abs(hi->input, ABS_MT_WIDTH_MAJOR, field, 0);
308 if (td->last_mt_collection == usage->collection_index) {
309 td->last_slot_field = usage->hid;
310 td->last_field_index = field->index;
314 hid_map_usage(hi, usage, bit, max,
315 EV_ABS, ABS_MT_WIDTH_MINOR);
316 input_set_capability(hi->input, EV_KEY,
318 set_abs(hi->input, ABS_MT_WIDTH_MINOR, field, 0);
319 if (td->last_mt_collection == usage->collection_index) {
320 td->last_slot_field = usage->hid;
321 td->last_field_index = field->index;
324 case HID_DG_TIPPRESSURE:
325 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
326 field->logical_minimum = 0;
327 hid_map_usage(hi, usage, bit, max,
328 EV_ABS, ABS_MT_PRESSURE);
329 set_abs(hi->input, ABS_MT_PRESSURE, field,
331 /* touchscreen emulation */
332 set_abs(hi->input, ABS_PRESSURE, field,
334 if (td->last_mt_collection == usage->collection_index) {
335 td->last_slot_field = usage->hid;
336 td->last_field_index = field->index;
339 case HID_DG_CONTACTCOUNT:
340 if (td->last_mt_collection == usage->collection_index)
341 td->last_field_index = field->index;
343 case HID_DG_CONTACTMAX:
344 /* we don't set td->last_slot_field as contactcount and
345 * contact max are global to the report */
346 if (td->last_mt_collection == usage->collection_index)
347 td->last_field_index = field->index;
350 /* let hid-input decide for the others */
354 /* we do not want to map these: no input-oriented meaning */
361 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
362 struct hid_field *field, struct hid_usage *usage,
363 unsigned long **bit, int *max)
365 if (usage->type == EV_KEY || usage->type == EV_ABS)
366 set_bit(usage->type, hi->input->evbit);
371 static int mt_compute_slot(struct mt_device *td)
373 __s32 quirks = td->mtclass->quirks;
375 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
376 return td->curdata.contactid;
378 if (quirks & MT_QUIRK_CYPRESS)
379 return cypress_compute_slot(td);
381 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
382 return td->num_received;
384 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
385 return td->curdata.contactid - 1;
387 return find_slot_from_contactid(td);
391 * this function is called when a whole contact has been processed,
392 * so that it can assign it to a slot and store the data there
394 static void mt_complete_slot(struct mt_device *td)
396 td->curdata.seen_in_this_frame = true;
398 int slotnum = mt_compute_slot(td);
400 if (slotnum >= 0 && slotnum < td->maxcontacts)
401 td->slots[slotnum] = td->curdata;
408 * this function is called when a whole packet has been received and processed,
409 * so that it can decide what to send to the input layer.
411 static void mt_emit_event(struct mt_device *td, struct input_dev *input)
415 for (i = 0; i < td->maxcontacts; ++i) {
416 struct mt_slot *s = &(td->slots[i]);
417 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
418 !s->seen_in_this_frame) {
419 if (s->touch_state) {
420 s->touch_state = false;
421 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->touch_state);
422 input_mt_sync(input);
424 s->seen_in_this_frame = false;
428 if (!s->seen_in_this_frame)
431 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->touch_state);
432 if (s->touch_state) {
433 /* this finger is on the screen */
434 int wide = (s->w > s->h);
435 /* divided by two to match visual scale of touch */
436 int major = max(s->w, s->h) >> 1;
437 int minor = min(s->w, s->h) >> 1;
439 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, s->contactid);
440 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
441 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
442 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
443 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
444 input_event(input, EV_ABS, ABS_MT_WIDTH_MAJOR, major);
445 input_event(input, EV_ABS, ABS_MT_WIDTH_MINOR, minor);
447 input_mt_sync(input);
448 s->seen_in_this_frame = false;
453 td->num_received = 0;
458 static int mt_event(struct hid_device *hid, struct hid_field *field,
459 struct hid_usage *usage, __s32 value)
461 struct mt_device *td = hid_get_drvdata(hid);
462 __s32 quirks = td->mtclass->quirks;
464 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
465 switch (usage->hid) {
467 if (quirks & MT_QUIRK_VALID_IS_INRANGE)
468 td->curvalid = value;
470 case HID_DG_TIPSWITCH:
471 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
472 td->curvalid = value;
473 td->curdata.touch_state = value;
475 case HID_DG_CONFIDENCE:
476 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
477 td->curvalid = value;
479 case HID_DG_CONTACTID:
480 td->curdata.contactid = value;
482 case HID_DG_TIPPRESSURE:
483 td->curdata.p = value;
486 td->curdata.x = value;
489 td->curdata.y = value;
492 td->curdata.w = value;
495 td->curdata.h = value;
497 case HID_DG_CONTACTCOUNT:
499 * Includes multi-packet support where subsequent
500 * packets are sent with zero contactcount.
503 td->num_expected = value;
507 /* fallback to the generic hidinput handling */
511 if (usage->hid == td->last_slot_field) {
512 mt_complete_slot(td);
515 if (field->index == td->last_field_index
516 && td->num_received >= td->num_expected)
517 mt_emit_event(td, field->hidinput->input);
521 /* we have handled the hidinput part, now remains hiddev */
522 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
523 hid->hiddev_hid_event(hid, field, usage, value);
528 static void mt_set_input_mode(struct hid_device *hdev)
530 struct mt_device *td = hid_get_drvdata(hdev);
531 struct hid_report *r;
532 struct hid_report_enum *re;
534 if (td->inputmode < 0)
537 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
538 r = re->report_id_hash[td->inputmode];
540 r->field[0]->value[0] = 0x02;
541 usbhid_submit_report(hdev, r, USB_DIR_OUT);
545 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
548 struct mt_device *td;
549 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
551 for (i = 0; mt_classes[i].name ; i++) {
552 if (id->driver_data == mt_classes[i].name) {
553 mtclass = &(mt_classes[i]);
558 /* This allows the driver to correctly support devices
559 * that emit events over several HID messages.
561 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
563 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
565 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
568 td->mtclass = mtclass;
570 td->last_mt_collection = -1;
571 hid_set_drvdata(hdev, td);
573 ret = hid_parse(hdev);
577 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
581 if (!td->maxcontacts)
582 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
584 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
587 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
593 mt_set_input_mode(hdev);
603 static int mt_reset_resume(struct hid_device *hdev)
605 mt_set_input_mode(hdev);
610 static void mt_remove(struct hid_device *hdev)
612 struct mt_device *td = hid_get_drvdata(hdev);
616 hid_set_drvdata(hdev, NULL);
619 static const struct hid_device_id mt_devices[] = {
622 { .driver_data = MT_CLS_3M,
623 HID_USB_DEVICE(USB_VENDOR_ID_3M,
624 USB_DEVICE_ID_3M1968) },
625 { .driver_data = MT_CLS_3M,
626 HID_USB_DEVICE(USB_VENDOR_ID_3M,
627 USB_DEVICE_ID_3M2256) },
629 /* ActionStar panels */
630 { .driver_data = MT_CLS_DEFAULT,
631 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
632 USB_DEVICE_ID_ACTIONSTAR_1011) },
635 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
636 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
637 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
638 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
639 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
640 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
641 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
642 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
643 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
644 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
645 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
646 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
649 { .driver_data = MT_CLS_DEFAULT,
650 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
651 USB_DEVICE_ID_CVTOUCH_SCREEN) },
654 { .driver_data = MT_CLS_CYPRESS,
655 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
656 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
658 /* eGalax devices (resistive) */
659 { .driver_data = MT_CLS_EGALAX,
660 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
661 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
662 { .driver_data = MT_CLS_EGALAX,
663 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
664 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
666 /* eGalax devices (capacitive) */
667 { .driver_data = MT_CLS_EGALAX,
668 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
669 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
670 { .driver_data = MT_CLS_EGALAX,
671 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
672 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
673 { .driver_data = MT_CLS_EGALAX,
674 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
675 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
676 { .driver_data = MT_CLS_EGALAX,
677 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
678 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5) },
680 /* Elo TouchSystems IntelliTouch Plus panel */
681 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
682 HID_USB_DEVICE(USB_VENDOR_ID_ELO,
683 USB_DEVICE_ID_ELO_TS2515) },
685 /* GeneralTouch panel */
686 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
687 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
688 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
690 /* GoodTouch panels */
691 { .driver_data = MT_CLS_DEFAULT,
692 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
693 USB_DEVICE_ID_GOODTOUCH_000f) },
695 /* Ilitek dual touch panel */
696 { .driver_data = MT_CLS_DEFAULT,
697 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK,
698 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
701 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
702 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
703 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
705 /* LG Display panels */
706 { .driver_data = MT_CLS_DEFAULT,
707 HID_USB_DEVICE(USB_VENDOR_ID_LG,
708 USB_DEVICE_ID_LG_MULTITOUCH) },
711 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
712 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
713 USB_DEVICE_ID_CRYSTALTOUCH) },
714 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
715 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
716 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
719 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
720 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
721 USB_DEVICE_ID_ASUS_T91MT)},
722 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
723 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
724 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
725 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
726 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX,
727 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
729 /* PenMount panels */
730 { .driver_data = MT_CLS_CONFIDENCE,
731 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
732 USB_DEVICE_ID_PENMOUNT_PCI) },
734 /* PixCir-based panels */
735 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
736 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
737 USB_DEVICE_ID_HANVON_MULTITOUCH) },
738 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
739 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
740 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
743 { .driver_data = MT_CLS_CONFIDENCE,
744 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
746 { .driver_data = MT_CLS_CONFIDENCE,
747 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
748 USB_DEVICE_ID_MTP_STM)},
749 { .driver_data = MT_CLS_CONFIDENCE,
750 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
751 USB_DEVICE_ID_MTP_SITRONIX)},
753 /* Touch International panels */
754 { .driver_data = MT_CLS_DEFAULT,
755 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
756 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
759 { .driver_data = MT_CLS_DEFAULT,
760 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
761 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
762 { .driver_data = MT_CLS_DEFAULT,
763 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
764 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
768 MODULE_DEVICE_TABLE(hid, mt_devices);
770 static const struct hid_usage_id mt_grabbed_usages[] = {
771 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
772 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
775 static struct hid_driver mt_driver = {
776 .name = "hid-multitouch",
777 .id_table = mt_devices,
780 .input_mapping = mt_input_mapping,
781 .input_mapped = mt_input_mapped,
782 .feature_mapping = mt_feature_mapping,
783 .usage_table = mt_grabbed_usages,
786 .reset_resume = mt_reset_resume,
790 static int __init mt_init(void)
792 return hid_register_driver(&mt_driver);
795 static void __exit mt_exit(void)
797 hid_unregister_driver(&mt_driver);
800 module_init(mt_init);
801 module_exit(mt_exit);