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
;
249 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
250 field
->logical_maximum
= 32760;
251 hid_map_usage(hi
, usage
, bit
, max
,
252 EV_ABS
, ABS_MT_POSITION_Y
);
253 set_abs(hi
->input
, ABS_MT_POSITION_Y
, field
,
255 /* touchscreen emulation */
256 set_abs(hi
->input
, ABS_Y
, field
, cls
->sn_move
);
257 if (td
->last_mt_collection
== usage
->collection_index
) {
258 td
->last_slot_field
= usage
->hid
;
259 td
->last_field_index
= field
->index
;
265 case HID_UP_DIGITIZER
:
266 switch (usage
->hid
) {
268 if (td
->last_mt_collection
== usage
->collection_index
) {
269 td
->last_slot_field
= usage
->hid
;
270 td
->last_field_index
= field
->index
;
273 case HID_DG_CONFIDENCE
:
274 if (td
->last_mt_collection
== usage
->collection_index
) {
275 td
->last_slot_field
= usage
->hid
;
276 td
->last_field_index
= field
->index
;
279 case HID_DG_TIPSWITCH
:
280 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, BTN_TOUCH
);
281 input_set_capability(hi
->input
, EV_KEY
, BTN_TOUCH
);
282 if (td
->last_mt_collection
== usage
->collection_index
) {
283 td
->last_slot_field
= usage
->hid
;
284 td
->last_field_index
= field
->index
;
287 case HID_DG_CONTACTID
:
288 if (!td
->maxcontacts
)
289 td
->maxcontacts
= MT_DEFAULT_MAXCONTACT
;
290 input_mt_init_slots(hi
->input
, td
->maxcontacts
);
291 td
->last_slot_field
= usage
->hid
;
292 td
->last_field_index
= field
->index
;
293 td
->last_mt_collection
= usage
->collection_index
;
296 hid_map_usage(hi
, usage
, bit
, max
,
297 EV_ABS
, ABS_MT_TOUCH_MAJOR
);
298 set_abs(hi
->input
, ABS_MT_TOUCH_MAJOR
, field
,
300 if (td
->last_mt_collection
== usage
->collection_index
) {
301 td
->last_slot_field
= usage
->hid
;
302 td
->last_field_index
= field
->index
;
306 hid_map_usage(hi
, usage
, bit
, max
,
307 EV_ABS
, ABS_MT_TOUCH_MINOR
);
308 set_abs(hi
->input
, ABS_MT_TOUCH_MINOR
, field
,
310 input_set_abs_params(hi
->input
,
311 ABS_MT_ORIENTATION
, 0, 1, 0, 0);
312 if (td
->last_mt_collection
== usage
->collection_index
) {
313 td
->last_slot_field
= usage
->hid
;
314 td
->last_field_index
= field
->index
;
317 case HID_DG_TIPPRESSURE
:
318 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
319 field
->logical_minimum
= 0;
320 hid_map_usage(hi
, usage
, bit
, max
,
321 EV_ABS
, ABS_MT_PRESSURE
);
322 set_abs(hi
->input
, ABS_MT_PRESSURE
, field
,
324 /* touchscreen emulation */
325 set_abs(hi
->input
, ABS_PRESSURE
, field
,
327 if (td
->last_mt_collection
== usage
->collection_index
) {
328 td
->last_slot_field
= usage
->hid
;
329 td
->last_field_index
= field
->index
;
332 case HID_DG_CONTACTCOUNT
:
333 if (td
->last_mt_collection
== usage
->collection_index
)
334 td
->last_field_index
= field
->index
;
336 case HID_DG_CONTACTMAX
:
337 /* we don't set td->last_slot_field as contactcount and
338 * contact max are global to the report */
339 if (td
->last_mt_collection
== usage
->collection_index
)
340 td
->last_field_index
= field
->index
;
343 /* let hid-input decide for the others */
347 /* we do not want to map these: no input-oriented meaning */
354 static int mt_input_mapped(struct hid_device
*hdev
, struct hid_input
*hi
,
355 struct hid_field
*field
, struct hid_usage
*usage
,
356 unsigned long **bit
, int *max
)
358 if (usage
->type
== EV_KEY
|| usage
->type
== EV_ABS
)
359 set_bit(usage
->type
, hi
->input
->evbit
);
364 static int mt_compute_slot(struct mt_device
*td
)
366 __s32 quirks
= td
->mtclass
->quirks
;
368 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID
)
369 return td
->curdata
.contactid
;
371 if (quirks
& MT_QUIRK_CYPRESS
)
372 return cypress_compute_slot(td
);
374 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTNUMBER
)
375 return td
->num_received
;
377 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
)
378 return td
->curdata
.contactid
- 1;
380 return find_slot_from_contactid(td
);
384 * this function is called when a whole contact has been processed,
385 * so that it can assign it to a slot and store the data there
387 static void mt_complete_slot(struct mt_device
*td
)
389 td
->curdata
.seen_in_this_frame
= true;
391 int slotnum
= mt_compute_slot(td
);
393 if (slotnum
>= 0 && slotnum
< td
->maxcontacts
)
394 td
->slots
[slotnum
] = td
->curdata
;
401 * this function is called when a whole packet has been received and processed,
402 * so that it can decide what to send to the input layer.
404 static void mt_emit_event(struct mt_device
*td
, struct input_dev
*input
)
408 for (i
= 0; i
< td
->maxcontacts
; ++i
) {
409 struct mt_slot
*s
= &(td
->slots
[i
]);
410 if ((td
->mtclass
->quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
) &&
411 !s
->seen_in_this_frame
) {
412 s
->touch_state
= false;
415 input_mt_slot(input
, i
);
416 input_mt_report_slot_state(input
, MT_TOOL_FINGER
,
418 if (s
->touch_state
) {
419 /* this finger is on the screen */
420 int wide
= (s
->w
> s
->h
);
421 /* divided by two to match visual scale of touch */
422 int major
= max(s
->w
, s
->h
) >> 1;
423 int minor
= min(s
->w
, s
->h
) >> 1;
425 input_event(input
, EV_ABS
, ABS_MT_POSITION_X
, s
->x
);
426 input_event(input
, EV_ABS
, ABS_MT_POSITION_Y
, s
->y
);
427 input_event(input
, EV_ABS
, ABS_MT_ORIENTATION
, wide
);
428 input_event(input
, EV_ABS
, ABS_MT_PRESSURE
, s
->p
);
429 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, major
);
430 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MINOR
, minor
);
432 s
->seen_in_this_frame
= false;
436 input_mt_report_pointer_emulation(input
, true);
438 td
->num_received
= 0;
443 static int mt_event(struct hid_device
*hid
, struct hid_field
*field
,
444 struct hid_usage
*usage
, __s32 value
)
446 struct mt_device
*td
= hid_get_drvdata(hid
);
447 __s32 quirks
= td
->mtclass
->quirks
;
449 if (hid
->claimed
& HID_CLAIMED_INPUT
&& td
->slots
) {
450 switch (usage
->hid
) {
452 if (quirks
& MT_QUIRK_ALWAYS_VALID
)
454 else if (quirks
& MT_QUIRK_VALID_IS_INRANGE
)
455 td
->curvalid
= value
;
457 case HID_DG_TIPSWITCH
:
458 if (quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
)
459 td
->curvalid
= value
;
460 td
->curdata
.touch_state
= value
;
462 case HID_DG_CONFIDENCE
:
463 if (quirks
& MT_QUIRK_VALID_IS_CONFIDENCE
)
464 td
->curvalid
= value
;
466 case HID_DG_CONTACTID
:
467 td
->curdata
.contactid
= value
;
469 case HID_DG_TIPPRESSURE
:
470 td
->curdata
.p
= value
;
473 td
->curdata
.x
= value
;
476 td
->curdata
.y
= value
;
479 td
->curdata
.w
= value
;
482 td
->curdata
.h
= value
;
484 case HID_DG_CONTACTCOUNT
:
486 * Includes multi-packet support where subsequent
487 * packets are sent with zero contactcount.
490 td
->num_expected
= value
;
494 /* fallback to the generic hidinput handling */
498 if (usage
->hid
== td
->last_slot_field
) {
499 mt_complete_slot(td
);
502 if (field
->index
== td
->last_field_index
503 && td
->num_received
>= td
->num_expected
)
504 mt_emit_event(td
, field
->hidinput
->input
);
508 /* we have handled the hidinput part, now remains hiddev */
509 if (hid
->claimed
& HID_CLAIMED_HIDDEV
&& hid
->hiddev_hid_event
)
510 hid
->hiddev_hid_event(hid
, field
, usage
, value
);
515 static void mt_set_input_mode(struct hid_device
*hdev
)
517 struct mt_device
*td
= hid_get_drvdata(hdev
);
518 struct hid_report
*r
;
519 struct hid_report_enum
*re
;
521 if (td
->inputmode
< 0)
524 re
= &(hdev
->report_enum
[HID_FEATURE_REPORT
]);
525 r
= re
->report_id_hash
[td
->inputmode
];
527 r
->field
[0]->value
[0] = 0x02;
528 usbhid_submit_report(hdev
, r
, USB_DIR_OUT
);
532 static int mt_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
535 struct mt_device
*td
;
536 struct mt_class
*mtclass
= mt_classes
; /* MT_CLS_DEFAULT */
538 for (i
= 0; mt_classes
[i
].name
; i
++) {
539 if (id
->driver_data
== mt_classes
[i
].name
) {
540 mtclass
= &(mt_classes
[i
]);
545 /* This allows the driver to correctly support devices
546 * that emit events over several HID messages.
548 hdev
->quirks
|= HID_QUIRK_NO_INPUT_SYNC
;
550 td
= kzalloc(sizeof(struct mt_device
), GFP_KERNEL
);
552 dev_err(&hdev
->dev
, "cannot allocate multitouch data\n");
555 td
->mtclass
= mtclass
;
557 td
->last_mt_collection
= -1;
558 hid_set_drvdata(hdev
, td
);
560 ret
= hid_parse(hdev
);
564 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
568 td
->slots
= kzalloc(td
->maxcontacts
* sizeof(struct mt_slot
),
571 dev_err(&hdev
->dev
, "cannot allocate multitouch slots\n");
577 mt_set_input_mode(hdev
);
587 static int mt_reset_resume(struct hid_device
*hdev
)
589 mt_set_input_mode(hdev
);
594 static void mt_remove(struct hid_device
*hdev
)
596 struct mt_device
*td
= hid_get_drvdata(hdev
);
600 hid_set_drvdata(hdev
, NULL
);
603 static const struct hid_device_id mt_devices
[] = {
606 { .driver_data
= MT_CLS_3M
,
607 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
608 USB_DEVICE_ID_3M1968
) },
609 { .driver_data
= MT_CLS_3M
,
610 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
611 USB_DEVICE_ID_3M2256
) },
613 /* ActionStar panels */
614 { .driver_data
= MT_CLS_DEFAULT
,
615 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR
,
616 USB_DEVICE_ID_ACTIONSTAR_1011
) },
619 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
620 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
621 USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
622 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
623 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
624 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1
) },
625 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
626 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
627 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
628 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
629 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
630 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
632 /* Chunghwa Telecom touch panels */
633 { .driver_data
= MT_CLS_DEFAULT
,
634 HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT
,
635 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH
) },
638 { .driver_data
= MT_CLS_DEFAULT
,
639 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH
,
640 USB_DEVICE_ID_CVTOUCH_SCREEN
) },
643 { .driver_data
= MT_CLS_CYPRESS
,
644 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
,
645 USB_DEVICE_ID_CYPRESS_TRUETOUCH
) },
647 /* eGalax devices (resistive) */
648 { .driver_data
= MT_CLS_EGALAX
,
649 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
650 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH
) },
651 { .driver_data
= MT_CLS_EGALAX
,
652 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
653 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3
) },
655 /* eGalax devices (capacitive) */
656 { .driver_data
= MT_CLS_EGALAX
,
657 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
658 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1
) },
659 { .driver_data
= MT_CLS_EGALAX
,
660 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
661 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2
) },
662 { .driver_data
= MT_CLS_EGALAX
,
663 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
664 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4
) },
666 /* Elo TouchSystems IntelliTouch Plus panel */
667 { .driver_data
= MT_CLS_DUAL_NSMU_CONTACTID
,
668 HID_USB_DEVICE(USB_VENDOR_ID_ELO
,
669 USB_DEVICE_ID_ELO_TS2515
) },
671 /* GeneralTouch panel */
672 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
673 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
,
674 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS
) },
676 /* GoodTouch panels */
677 { .driver_data
= MT_CLS_DEFAULT
,
678 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH
,
679 USB_DEVICE_ID_GOODTOUCH_000f
) },
682 { .driver_data
= MT_CLS_SERIAL
,
683 HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM
,
684 USB_DEVICE_ID_IDEACOM_IDC6650
) },
686 /* Ilitek dual touch panel */
687 { .driver_data
= MT_CLS_DEFAULT
,
688 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK
,
689 USB_DEVICE_ID_ILITEK_MULTITOUCH
) },
692 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
693 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS
,
694 USB_DEVICE_ID_IRTOUCH_INFRARED_USB
) },
696 /* LG Display panels */
697 { .driver_data
= MT_CLS_DEFAULT
,
698 HID_USB_DEVICE(USB_VENDOR_ID_LG
,
699 USB_DEVICE_ID_LG_MULTITOUCH
) },
702 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
703 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
704 USB_DEVICE_ID_CRYSTALTOUCH
) },
705 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
706 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
707 USB_DEVICE_ID_CRYSTALTOUCH_DUAL
) },
710 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
711 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
712 USB_DEVICE_ID_ASUS_T91MT
)},
713 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
714 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
715 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
716 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
717 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX
,
718 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART
) },
720 /* PenMount panels */
721 { .driver_data
= MT_CLS_CONFIDENCE
,
722 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT
,
723 USB_DEVICE_ID_PENMOUNT_PCI
) },
725 /* PixCir-based panels */
726 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
727 HID_USB_DEVICE(USB_VENDOR_ID_HANVON
,
728 USB_DEVICE_ID_HANVON_MULTITOUCH
) },
729 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
730 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
731 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH
) },
734 { .driver_data
= MT_CLS_CONFIDENCE
,
735 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
737 { .driver_data
= MT_CLS_CONFIDENCE
,
738 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM
,
739 USB_DEVICE_ID_MTP_STM
)},
740 { .driver_data
= MT_CLS_CONFIDENCE
,
741 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX
,
742 USB_DEVICE_ID_MTP_SITRONIX
)},
744 /* Touch International panels */
745 { .driver_data
= MT_CLS_DEFAULT
,
746 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL
,
747 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH
) },
750 { .driver_data
= MT_CLS_DEFAULT
,
751 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
752 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709
) },
753 { .driver_data
= MT_CLS_DEFAULT
,
754 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
755 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19
) },
757 { .driver_data
= MT_CLS_DEFAULT
,
758 HID_USB_DEVICE(USB_VENDOR_ID_XAT
,
759 USB_DEVICE_ID_XAT_CSR
) },
763 MODULE_DEVICE_TABLE(hid
, mt_devices
);
765 static const struct hid_usage_id mt_grabbed_usages
[] = {
766 { HID_ANY_ID
, HID_ANY_ID
, HID_ANY_ID
},
767 { HID_ANY_ID
- 1, HID_ANY_ID
- 1, HID_ANY_ID
- 1}
770 static struct hid_driver mt_driver
= {
771 .name
= "hid-multitouch",
772 .id_table
= mt_devices
,
775 .input_mapping
= mt_input_mapping
,
776 .input_mapped
= mt_input_mapped
,
777 .feature_mapping
= mt_feature_mapping
,
778 .usage_table
= mt_grabbed_usages
,
781 .reset_resume
= mt_reset_resume
,
785 static int __init
mt_init(void)
787 return hid_register_driver(&mt_driver
);
790 static void __exit
mt_exit(void)
792 hid_unregister_driver(&mt_driver
);
795 module_init(mt_init
);
796 module_exit(mt_exit
);