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
97 /* vendor specific classes */
98 #define MT_CLS_3M 0x0101
99 #define MT_CLS_CYPRESS 0x0102
100 #define MT_CLS_EGALAX 0x0103
102 #define MT_DEFAULT_MAXCONTACT 10
105 * these device-dependent functions determine what slot corresponds
106 * to a valid contact that was just read.
109 static int cypress_compute_slot(struct mt_device *td)
111 if (td->curdata.contactid != 0 || td->num_received == 0)
112 return td->curdata.contactid;
117 static int find_slot_from_contactid(struct mt_device *td)
120 for (i = 0; i < td->maxcontacts; ++i) {
121 if (td->slots[i].contactid == td->curdata.contactid &&
122 td->slots[i].touch_state)
125 for (i = 0; i < td->maxcontacts; ++i) {
126 if (!td->slots[i].seen_in_this_frame &&
127 !td->slots[i].touch_state)
130 /* should not occurs. If this happens that means
131 * that the device sent more touches that it says
132 * in the report descriptor. It is ignored then. */
136 struct mt_class mt_classes[] = {
137 { .name = MT_CLS_DEFAULT,
138 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
139 { .name = MT_CLS_SERIAL,
140 .quirks = MT_QUIRK_ALWAYS_VALID},
141 { .name = MT_CLS_CONFIDENCE,
142 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
143 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
144 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
145 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
146 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
147 .quirks = MT_QUIRK_VALID_IS_INRANGE |
148 MT_QUIRK_SLOT_IS_CONTACTID,
150 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
151 .quirks = MT_QUIRK_VALID_IS_INRANGE |
152 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
154 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
155 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
156 MT_QUIRK_SLOT_IS_CONTACTID,
160 * vendor specific classes
163 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
164 MT_QUIRK_SLOT_IS_CONTACTID,
168 { .name = MT_CLS_CYPRESS,
169 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
172 { .name = MT_CLS_EGALAX,
173 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
174 MT_QUIRK_VALID_IS_INRANGE |
175 MT_QUIRK_EGALAX_XYZ_FIXUP,
184 static void mt_feature_mapping(struct hid_device *hdev,
185 struct hid_field *field, struct hid_usage *usage)
187 struct mt_device *td = hid_get_drvdata(hdev);
189 switch (usage->hid) {
190 case HID_DG_INPUTMODE:
191 td->inputmode = field->report->id;
193 case HID_DG_CONTACTMAX:
194 td->maxcontacts = field->value[0];
195 if (td->mtclass->maxcontacts)
196 /* check if the maxcontacts is given by the class */
197 td->maxcontacts = td->mtclass->maxcontacts;
203 static void set_abs(struct input_dev *input, unsigned int code,
204 struct hid_field *field, int snratio)
206 int fmin = field->logical_minimum;
207 int fmax = field->logical_maximum;
208 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
209 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
212 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
213 struct hid_field *field, struct hid_usage *usage,
214 unsigned long **bit, int *max)
216 struct mt_device *td = hid_get_drvdata(hdev);
217 struct mt_class *cls = td->mtclass;
218 __s32 quirks = cls->quirks;
220 /* Only map fields from TouchScreen or TouchPad collections.
221 * We need to ignore fields that belong to other collections
222 * such as Mouse that might have the same GenericDesktop usages. */
223 if (field->application == HID_DG_TOUCHSCREEN)
224 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
225 else if (field->application == HID_DG_TOUCHPAD)
226 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
230 switch (usage->hid & HID_USAGE_PAGE) {
233 switch (usage->hid) {
235 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
236 field->logical_maximum = 32760;
237 hid_map_usage(hi, usage, bit, max,
238 EV_ABS, ABS_MT_POSITION_X);
239 set_abs(hi->input, ABS_MT_POSITION_X, field,
241 /* touchscreen emulation */
242 set_abs(hi->input, ABS_X, field, cls->sn_move);
243 if (td->last_mt_collection == usage->collection_index) {
244 td->last_slot_field = usage->hid;
245 td->last_field_index = field->index;
247 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
251 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
252 field->logical_maximum = 32760;
253 hid_map_usage(hi, usage, bit, max,
254 EV_ABS, ABS_MT_POSITION_Y);
255 set_abs(hi->input, ABS_MT_POSITION_Y, field,
257 /* touchscreen emulation */
258 set_abs(hi->input, ABS_Y, field, cls->sn_move);
259 if (td->last_mt_collection == usage->collection_index) {
260 td->last_slot_field = usage->hid;
261 td->last_field_index = field->index;
267 case HID_UP_DIGITIZER:
268 switch (usage->hid) {
270 if (td->last_mt_collection == usage->collection_index) {
271 td->last_slot_field = usage->hid;
272 td->last_field_index = field->index;
275 case HID_DG_CONFIDENCE:
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, BTN_TOUCH);
283 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
284 if (td->last_mt_collection == usage->collection_index) {
285 td->last_slot_field = usage->hid;
286 td->last_field_index = field->index;
289 case HID_DG_CONTACTID:
290 if (!td->maxcontacts)
291 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
292 input_mt_init_slots(hi->input, td->maxcontacts);
293 td->last_slot_field = usage->hid;
294 td->last_field_index = field->index;
295 td->last_mt_collection = usage->collection_index;
298 hid_map_usage(hi, usage, bit, max,
299 EV_ABS, ABS_MT_TOUCH_MAJOR);
300 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
302 if (td->last_mt_collection == usage->collection_index) {
303 td->last_slot_field = usage->hid;
304 td->last_field_index = field->index;
308 hid_map_usage(hi, usage, bit, max,
309 EV_ABS, ABS_MT_TOUCH_MINOR);
310 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
312 input_set_abs_params(hi->input,
313 ABS_MT_ORIENTATION, 0, 1, 0, 0);
314 if (td->last_mt_collection == usage->collection_index) {
315 td->last_slot_field = usage->hid;
316 td->last_field_index = field->index;
319 case HID_DG_TIPPRESSURE:
320 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
321 field->logical_minimum = 0;
322 hid_map_usage(hi, usage, bit, max,
323 EV_ABS, ABS_MT_PRESSURE);
324 set_abs(hi->input, ABS_MT_PRESSURE, field,
326 /* touchscreen emulation */
327 set_abs(hi->input, ABS_PRESSURE, field,
329 if (td->last_mt_collection == usage->collection_index) {
330 td->last_slot_field = usage->hid;
331 td->last_field_index = field->index;
334 case HID_DG_CONTACTCOUNT:
335 if (td->last_mt_collection == usage->collection_index)
336 td->last_field_index = field->index;
338 case HID_DG_CONTACTMAX:
339 /* we don't set td->last_slot_field as contactcount and
340 * contact max are global to the report */
341 if (td->last_mt_collection == usage->collection_index)
342 td->last_field_index = field->index;
345 /* let hid-input decide for the others */
349 /* we do not want to map these: no input-oriented meaning */
356 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
357 struct hid_field *field, struct hid_usage *usage,
358 unsigned long **bit, int *max)
360 if (usage->type == EV_KEY || usage->type == EV_ABS)
361 set_bit(usage->type, hi->input->evbit);
366 static int mt_compute_slot(struct mt_device *td)
368 __s32 quirks = td->mtclass->quirks;
370 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
371 return td->curdata.contactid;
373 if (quirks & MT_QUIRK_CYPRESS)
374 return cypress_compute_slot(td);
376 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
377 return td->num_received;
379 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
380 return td->curdata.contactid - 1;
382 return find_slot_from_contactid(td);
386 * this function is called when a whole contact has been processed,
387 * so that it can assign it to a slot and store the data there
389 static void mt_complete_slot(struct mt_device *td)
391 td->curdata.seen_in_this_frame = true;
393 int slotnum = mt_compute_slot(td);
395 if (slotnum >= 0 && slotnum < td->maxcontacts)
396 td->slots[slotnum] = td->curdata;
403 * this function is called when a whole packet has been received and processed,
404 * so that it can decide what to send to the input layer.
406 static void mt_emit_event(struct mt_device *td, struct input_dev *input)
410 for (i = 0; i < td->maxcontacts; ++i) {
411 struct mt_slot *s = &(td->slots[i]);
412 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
413 !s->seen_in_this_frame) {
414 s->touch_state = false;
417 input_mt_slot(input, i);
418 input_mt_report_slot_state(input, MT_TOOL_FINGER,
420 if (s->touch_state) {
421 /* this finger is on the screen */
422 int wide = (s->w > s->h);
423 /* divided by two to match visual scale of touch */
424 int major = max(s->w, s->h) >> 1;
425 int minor = min(s->w, s->h) >> 1;
427 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
428 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
429 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
430 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
431 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
432 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
434 s->seen_in_this_frame = false;
438 input_mt_report_pointer_emulation(input, true);
440 td->num_received = 0;
445 static int mt_event(struct hid_device *hid, struct hid_field *field,
446 struct hid_usage *usage, __s32 value)
448 struct mt_device *td = hid_get_drvdata(hid);
449 __s32 quirks = td->mtclass->quirks;
451 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
452 switch (usage->hid) {
454 if (quirks & MT_QUIRK_ALWAYS_VALID)
456 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
457 td->curvalid = value;
459 case HID_DG_TIPSWITCH:
460 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
461 td->curvalid = value;
462 td->curdata.touch_state = value;
464 case HID_DG_CONFIDENCE:
465 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
466 td->curvalid = value;
468 case HID_DG_CONTACTID:
469 td->curdata.contactid = value;
471 case HID_DG_TIPPRESSURE:
472 td->curdata.p = value;
475 td->curdata.x = value;
478 td->curdata.y = value;
481 td->curdata.w = value;
484 td->curdata.h = value;
486 case HID_DG_CONTACTCOUNT:
488 * Includes multi-packet support where subsequent
489 * packets are sent with zero contactcount.
492 td->num_expected = value;
496 /* fallback to the generic hidinput handling */
500 if (usage->hid == td->last_slot_field) {
501 mt_complete_slot(td);
504 if (field->index == td->last_field_index
505 && td->num_received >= td->num_expected)
506 mt_emit_event(td, field->hidinput->input);
510 /* we have handled the hidinput part, now remains hiddev */
511 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
512 hid->hiddev_hid_event(hid, field, usage, value);
517 static void mt_set_input_mode(struct hid_device *hdev)
519 struct mt_device *td = hid_get_drvdata(hdev);
520 struct hid_report *r;
521 struct hid_report_enum *re;
523 if (td->inputmode < 0)
526 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
527 r = re->report_id_hash[td->inputmode];
529 r->field[0]->value[0] = 0x02;
530 usbhid_submit_report(hdev, r, USB_DIR_OUT);
534 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
537 struct mt_device *td;
538 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
540 for (i = 0; mt_classes[i].name ; i++) {
541 if (id->driver_data == mt_classes[i].name) {
542 mtclass = &(mt_classes[i]);
547 /* This allows the driver to correctly support devices
548 * that emit events over several HID messages.
550 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
552 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
554 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
557 td->mtclass = mtclass;
559 td->last_mt_collection = -1;
560 hid_set_drvdata(hdev, td);
562 ret = hid_parse(hdev);
566 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
570 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
573 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
579 mt_set_input_mode(hdev);
589 static int mt_reset_resume(struct hid_device *hdev)
591 mt_set_input_mode(hdev);
596 static void mt_remove(struct hid_device *hdev)
598 struct mt_device *td = hid_get_drvdata(hdev);
602 hid_set_drvdata(hdev, NULL);
605 static const struct hid_device_id mt_devices[] = {
608 { .driver_data = MT_CLS_3M,
609 HID_USB_DEVICE(USB_VENDOR_ID_3M,
610 USB_DEVICE_ID_3M1968) },
611 { .driver_data = MT_CLS_3M,
612 HID_USB_DEVICE(USB_VENDOR_ID_3M,
613 USB_DEVICE_ID_3M2256) },
615 /* ActionStar panels */
616 { .driver_data = MT_CLS_DEFAULT,
617 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
618 USB_DEVICE_ID_ACTIONSTAR_1011) },
621 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
622 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
623 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
624 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
625 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
626 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
627 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
628 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
629 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
630 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
631 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
632 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
634 /* Chunghwa Telecom touch panels */
635 { .driver_data = MT_CLS_DEFAULT,
636 HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
637 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
640 { .driver_data = MT_CLS_DEFAULT,
641 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
642 USB_DEVICE_ID_CVTOUCH_SCREEN) },
645 { .driver_data = MT_CLS_CYPRESS,
646 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
647 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
649 /* eGalax devices (resistive) */
650 { .driver_data = MT_CLS_EGALAX,
651 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
652 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
653 { .driver_data = MT_CLS_EGALAX,
654 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
655 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
657 /* eGalax devices (capacitive) */
658 { .driver_data = MT_CLS_EGALAX,
659 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
660 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
661 { .driver_data = MT_CLS_EGALAX,
662 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
663 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
664 { .driver_data = MT_CLS_EGALAX,
665 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
666 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
668 /* Elo TouchSystems IntelliTouch Plus panel */
669 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
670 HID_USB_DEVICE(USB_VENDOR_ID_ELO,
671 USB_DEVICE_ID_ELO_TS2515) },
673 /* GeneralTouch panel */
674 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
675 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
676 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
678 /* GoodTouch panels */
679 { .driver_data = MT_CLS_DEFAULT,
680 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
681 USB_DEVICE_ID_GOODTOUCH_000f) },
684 { .driver_data = MT_CLS_SERIAL,
685 HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
686 USB_DEVICE_ID_IDEACOM_IDC6650) },
688 /* Ilitek dual touch panel */
689 { .driver_data = MT_CLS_DEFAULT,
690 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK,
691 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
694 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
695 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
696 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
698 /* LG Display panels */
699 { .driver_data = MT_CLS_DEFAULT,
700 HID_USB_DEVICE(USB_VENDOR_ID_LG,
701 USB_DEVICE_ID_LG_MULTITOUCH) },
704 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
705 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
706 USB_DEVICE_ID_CRYSTALTOUCH) },
707 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
708 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
709 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
712 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
713 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
714 USB_DEVICE_ID_ASUS_T91MT)},
715 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
716 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
717 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
718 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
719 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX,
720 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
722 /* PenMount panels */
723 { .driver_data = MT_CLS_CONFIDENCE,
724 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
725 USB_DEVICE_ID_PENMOUNT_PCI) },
727 /* PixCir-based panels */
728 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
729 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
730 USB_DEVICE_ID_HANVON_MULTITOUCH) },
731 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
732 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
733 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
736 { .driver_data = MT_CLS_CONFIDENCE,
737 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
739 { .driver_data = MT_CLS_CONFIDENCE,
740 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
741 USB_DEVICE_ID_MTP_STM)},
742 { .driver_data = MT_CLS_CONFIDENCE,
743 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
744 USB_DEVICE_ID_MTP_SITRONIX)},
746 /* Touch International panels */
747 { .driver_data = MT_CLS_DEFAULT,
748 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
749 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
752 { .driver_data = MT_CLS_DEFAULT,
753 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
754 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
755 { .driver_data = MT_CLS_DEFAULT,
756 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
757 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
759 { .driver_data = MT_CLS_DEFAULT,
760 HID_USB_DEVICE(USB_VENDOR_ID_XAT,
761 USB_DEVICE_ID_XAT_CSR) },
765 MODULE_DEVICE_TABLE(hid, mt_devices);
767 static const struct hid_usage_id mt_grabbed_usages[] = {
768 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
769 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
772 static struct hid_driver mt_driver = {
773 .name = "hid-multitouch",
774 .id_table = mt_devices,
777 .input_mapping = mt_input_mapping,
778 .input_mapped = mt_input_mapped,
779 .feature_mapping = mt_feature_mapping,
780 .usage_table = mt_grabbed_usages,
783 .reset_resume = mt_reset_resume,
787 static int __init mt_init(void)
789 return hid_register_driver(&mt_driver);
792 static void __exit mt_exit(void)
794 hid_unregister_driver(&mt_driver);
797 module_init(mt_init);
798 module_exit(mt_exit);