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
;
294 hdev
->quirks
&= ~HID_QUIRK_MULTITOUCH
;
297 hid_map_usage(hi
, usage
, bit
, max
,
298 EV_ABS
, ABS_MT_TOUCH_MAJOR
);
299 set_abs(hi
->input
, ABS_MT_TOUCH_MAJOR
, field
,
301 if (td
->last_mt_collection
== usage
->collection_index
) {
302 td
->last_slot_field
= usage
->hid
;
303 td
->last_field_index
= field
->index
;
307 hid_map_usage(hi
, usage
, bit
, max
,
308 EV_ABS
, ABS_MT_TOUCH_MINOR
);
309 set_abs(hi
->input
, ABS_MT_TOUCH_MINOR
, field
,
311 input_set_abs_params(hi
->input
,
312 ABS_MT_ORIENTATION
, 0, 1, 0, 0);
313 if (td
->last_mt_collection
== usage
->collection_index
) {
314 td
->last_slot_field
= usage
->hid
;
315 td
->last_field_index
= field
->index
;
318 case HID_DG_TIPPRESSURE
:
319 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
320 field
->logical_minimum
= 0;
321 hid_map_usage(hi
, usage
, bit
, max
,
322 EV_ABS
, ABS_MT_PRESSURE
);
323 set_abs(hi
->input
, ABS_MT_PRESSURE
, field
,
325 /* touchscreen emulation */
326 set_abs(hi
->input
, ABS_PRESSURE
, field
,
328 if (td
->last_mt_collection
== usage
->collection_index
) {
329 td
->last_slot_field
= usage
->hid
;
330 td
->last_field_index
= field
->index
;
333 case HID_DG_CONTACTCOUNT
:
334 if (td
->last_mt_collection
== usage
->collection_index
)
335 td
->last_field_index
= field
->index
;
337 case HID_DG_CONTACTMAX
:
338 /* we don't set td->last_slot_field as contactcount and
339 * contact max are global to the report */
340 if (td
->last_mt_collection
== usage
->collection_index
)
341 td
->last_field_index
= field
->index
;
344 /* let hid-input decide for the others */
348 /* we do not want to map these: no input-oriented meaning */
355 static int mt_input_mapped(struct hid_device
*hdev
, struct hid_input
*hi
,
356 struct hid_field
*field
, struct hid_usage
*usage
,
357 unsigned long **bit
, int *max
)
359 if (usage
->type
== EV_KEY
|| usage
->type
== EV_ABS
)
360 set_bit(usage
->type
, hi
->input
->evbit
);
365 static int mt_compute_slot(struct mt_device
*td
)
367 __s32 quirks
= td
->mtclass
->quirks
;
369 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID
)
370 return td
->curdata
.contactid
;
372 if (quirks
& MT_QUIRK_CYPRESS
)
373 return cypress_compute_slot(td
);
375 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTNUMBER
)
376 return td
->num_received
;
378 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
)
379 return td
->curdata
.contactid
- 1;
381 return find_slot_from_contactid(td
);
385 * this function is called when a whole contact has been processed,
386 * so that it can assign it to a slot and store the data there
388 static void mt_complete_slot(struct mt_device
*td
)
390 td
->curdata
.seen_in_this_frame
= true;
392 int slotnum
= mt_compute_slot(td
);
394 if (slotnum
>= 0 && slotnum
< td
->maxcontacts
)
395 td
->slots
[slotnum
] = td
->curdata
;
402 * this function is called when a whole packet has been received and processed,
403 * so that it can decide what to send to the input layer.
405 static void mt_emit_event(struct mt_device
*td
, struct input_dev
*input
)
409 for (i
= 0; i
< td
->maxcontacts
; ++i
) {
410 struct mt_slot
*s
= &(td
->slots
[i
]);
411 if ((td
->mtclass
->quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
) &&
412 !s
->seen_in_this_frame
) {
413 s
->touch_state
= false;
416 input_mt_slot(input
, i
);
417 input_mt_report_slot_state(input
, MT_TOOL_FINGER
,
419 if (s
->touch_state
) {
420 /* this finger is on the screen */
421 int wide
= (s
->w
> s
->h
);
422 /* divided by two to match visual scale of touch */
423 int major
= max(s
->w
, s
->h
) >> 1;
424 int minor
= min(s
->w
, s
->h
) >> 1;
426 input_event(input
, EV_ABS
, ABS_MT_POSITION_X
, s
->x
);
427 input_event(input
, EV_ABS
, ABS_MT_POSITION_Y
, s
->y
);
428 input_event(input
, EV_ABS
, ABS_MT_ORIENTATION
, wide
);
429 input_event(input
, EV_ABS
, ABS_MT_PRESSURE
, s
->p
);
430 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, major
);
431 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MINOR
, minor
);
433 s
->seen_in_this_frame
= false;
437 input_mt_report_pointer_emulation(input
, true);
439 td
->num_received
= 0;
444 static int mt_event(struct hid_device
*hid
, struct hid_field
*field
,
445 struct hid_usage
*usage
, __s32 value
)
447 struct mt_device
*td
= hid_get_drvdata(hid
);
448 __s32 quirks
= td
->mtclass
->quirks
;
450 if (hid
->claimed
& HID_CLAIMED_INPUT
&& td
->slots
) {
451 switch (usage
->hid
) {
453 if (quirks
& MT_QUIRK_ALWAYS_VALID
)
455 else if (quirks
& MT_QUIRK_VALID_IS_INRANGE
)
456 td
->curvalid
= value
;
458 case HID_DG_TIPSWITCH
:
459 if (quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
)
460 td
->curvalid
= value
;
461 td
->curdata
.touch_state
= value
;
463 case HID_DG_CONFIDENCE
:
464 if (quirks
& MT_QUIRK_VALID_IS_CONFIDENCE
)
465 td
->curvalid
= value
;
467 case HID_DG_CONTACTID
:
468 td
->curdata
.contactid
= value
;
470 case HID_DG_TIPPRESSURE
:
471 td
->curdata
.p
= value
;
474 td
->curdata
.x
= value
;
477 td
->curdata
.y
= value
;
480 td
->curdata
.w
= value
;
483 td
->curdata
.h
= value
;
485 case HID_DG_CONTACTCOUNT
:
487 * Includes multi-packet support where subsequent
488 * packets are sent with zero contactcount.
491 td
->num_expected
= value
;
495 /* fallback to the generic hidinput handling */
499 if (usage
->hid
== td
->last_slot_field
) {
500 mt_complete_slot(td
);
503 if (field
->index
== td
->last_field_index
504 && td
->num_received
>= td
->num_expected
)
505 mt_emit_event(td
, field
->hidinput
->input
);
509 /* we have handled the hidinput part, now remains hiddev */
510 if (hid
->claimed
& HID_CLAIMED_HIDDEV
&& hid
->hiddev_hid_event
)
511 hid
->hiddev_hid_event(hid
, field
, usage
, value
);
516 static void mt_set_input_mode(struct hid_device
*hdev
)
518 struct mt_device
*td
= hid_get_drvdata(hdev
);
519 struct hid_report
*r
;
520 struct hid_report_enum
*re
;
522 if (td
->inputmode
< 0)
525 re
= &(hdev
->report_enum
[HID_FEATURE_REPORT
]);
526 r
= re
->report_id_hash
[td
->inputmode
];
528 r
->field
[0]->value
[0] = 0x02;
529 usbhid_submit_report(hdev
, r
, USB_DIR_OUT
);
533 /* a list of devices for which there is a specialized multitouch driver */
534 static const struct hid_device_id mt_have_special_driver
[] = {
535 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, 0x0001) },
536 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, 0x0006) },
537 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
,
538 USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN
) },
539 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
,
540 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH
) },
544 static bool mt_match_one_id(struct hid_device
*hdev
,
545 const struct hid_device_id
*id
)
547 return id
->bus
== hdev
->bus
&&
548 (id
->vendor
== HID_ANY_ID
|| id
->vendor
== hdev
->vendor
) &&
549 (id
->product
== HID_ANY_ID
|| id
->product
== hdev
->product
);
552 static const struct hid_device_id
*mt_match_id(struct hid_device
*hdev
,
553 const struct hid_device_id
*id
)
555 for (; id
->bus
; id
++)
556 if (mt_match_one_id(hdev
, id
))
562 static int mt_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
565 struct mt_device
*td
;
566 struct mt_class
*mtclass
= mt_classes
; /* MT_CLS_DEFAULT */
568 if (mt_match_id(hdev
, mt_have_special_driver
))
571 for (i
= 0; mt_classes
[i
].name
; i
++) {
572 if (id
->driver_data
== mt_classes
[i
].name
) {
573 mtclass
= &(mt_classes
[i
]);
579 td
= kzalloc(sizeof(struct mt_device
), GFP_KERNEL
);
581 dev_err(&hdev
->dev
, "cannot allocate multitouch data\n");
584 td
->mtclass
= mtclass
;
586 td
->last_mt_collection
= -1;
587 hid_set_drvdata(hdev
, td
);
589 ret
= hid_parse(hdev
);
593 hdev
->quirks
|= HID_QUIRK_MULTITOUCH
;
594 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
598 /* This allows the driver to correctly support devices
599 * that emit events over several HID messages.
601 hdev
->quirks
|= HID_QUIRK_NO_INPUT_SYNC
;
603 td
->slots
= kzalloc(td
->maxcontacts
* sizeof(struct mt_slot
),
606 dev_err(&hdev
->dev
, "cannot allocate multitouch slots\n");
612 mt_set_input_mode(hdev
);
622 static int mt_reset_resume(struct hid_device
*hdev
)
624 mt_set_input_mode(hdev
);
629 static void mt_remove(struct hid_device
*hdev
)
631 struct mt_device
*td
= hid_get_drvdata(hdev
);
635 hid_set_drvdata(hdev
, NULL
);
638 static const struct hid_device_id mt_devices
[] = {
641 { .driver_data
= MT_CLS_3M
,
642 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
643 USB_DEVICE_ID_3M1968
) },
644 { .driver_data
= MT_CLS_3M
,
645 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
646 USB_DEVICE_ID_3M2256
) },
648 /* ActionStar panels */
649 { .driver_data
= MT_CLS_DEFAULT
,
650 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR
,
651 USB_DEVICE_ID_ACTIONSTAR_1011
) },
654 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
655 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
656 USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
657 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
658 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
659 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1
) },
660 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
661 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
662 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
663 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
664 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
665 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
667 /* Chunghwa Telecom touch panels */
668 { .driver_data
= MT_CLS_DEFAULT
,
669 HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT
,
670 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH
) },
673 { .driver_data
= MT_CLS_DEFAULT
,
674 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH
,
675 USB_DEVICE_ID_CVTOUCH_SCREEN
) },
678 { .driver_data
= MT_CLS_CYPRESS
,
679 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
,
680 USB_DEVICE_ID_CYPRESS_TRUETOUCH
) },
682 /* eGalax devices (resistive) */
683 { .driver_data
= MT_CLS_EGALAX
,
684 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
685 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH
) },
686 { .driver_data
= MT_CLS_EGALAX
,
687 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
688 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3
) },
690 /* eGalax devices (capacitive) */
691 { .driver_data
= MT_CLS_EGALAX
,
692 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
693 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1
) },
694 { .driver_data
= MT_CLS_EGALAX
,
695 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
696 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2
) },
697 { .driver_data
= MT_CLS_EGALAX
,
698 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
699 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4
) },
701 /* Elo TouchSystems IntelliTouch Plus panel */
702 { .driver_data
= MT_CLS_DUAL_NSMU_CONTACTID
,
703 HID_USB_DEVICE(USB_VENDOR_ID_ELO
,
704 USB_DEVICE_ID_ELO_TS2515
) },
706 /* GeneralTouch panel */
707 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
708 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
,
709 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS
) },
711 /* GoodTouch panels */
712 { .driver_data
= MT_CLS_DEFAULT
,
713 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH
,
714 USB_DEVICE_ID_GOODTOUCH_000f
) },
717 { .driver_data
= MT_CLS_SERIAL
,
718 HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM
,
719 USB_DEVICE_ID_IDEACOM_IDC6650
) },
721 /* Ilitek dual touch panel */
722 { .driver_data
= MT_CLS_DEFAULT
,
723 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK
,
724 USB_DEVICE_ID_ILITEK_MULTITOUCH
) },
727 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
728 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS
,
729 USB_DEVICE_ID_IRTOUCH_INFRARED_USB
) },
731 /* LG Display panels */
732 { .driver_data
= MT_CLS_DEFAULT
,
733 HID_USB_DEVICE(USB_VENDOR_ID_LG
,
734 USB_DEVICE_ID_LG_MULTITOUCH
) },
737 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
738 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
739 USB_DEVICE_ID_CRYSTALTOUCH
) },
740 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
741 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
742 USB_DEVICE_ID_CRYSTALTOUCH_DUAL
) },
745 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
746 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
747 USB_DEVICE_ID_ASUS_T91MT
)},
748 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
749 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
750 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
751 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
752 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX
,
753 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART
) },
755 /* PenMount panels */
756 { .driver_data
= MT_CLS_CONFIDENCE
,
757 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT
,
758 USB_DEVICE_ID_PENMOUNT_PCI
) },
760 /* PixCir-based panels */
761 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
762 HID_USB_DEVICE(USB_VENDOR_ID_HANVON
,
763 USB_DEVICE_ID_HANVON_MULTITOUCH
) },
764 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
765 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
766 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH
) },
769 { .driver_data
= MT_CLS_CONFIDENCE
,
770 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
772 { .driver_data
= MT_CLS_CONFIDENCE
,
773 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM
,
774 USB_DEVICE_ID_MTP_STM
)},
775 { .driver_data
= MT_CLS_CONFIDENCE
,
776 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX
,
777 USB_DEVICE_ID_MTP_SITRONIX
)},
779 /* Touch International panels */
780 { .driver_data
= MT_CLS_DEFAULT
,
781 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL
,
782 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH
) },
785 { .driver_data
= MT_CLS_DEFAULT
,
786 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
787 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709
) },
788 { .driver_data
= MT_CLS_DEFAULT
,
789 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
790 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19
) },
792 { .driver_data
= MT_CLS_DEFAULT
,
793 HID_USB_DEVICE(USB_VENDOR_ID_XAT
,
794 USB_DEVICE_ID_XAT_CSR
) },
796 /* Rest of the world */
797 { .driver_data
= MT_CLS_DEFAULT
,
798 HID_USB_DEVICE(HID_ANY_ID
, HID_ANY_ID
) },
802 MODULE_DEVICE_TABLE(hid
, mt_devices
);
804 static const struct hid_usage_id mt_grabbed_usages
[] = {
805 { HID_ANY_ID
, HID_ANY_ID
, HID_ANY_ID
},
806 { HID_ANY_ID
- 1, HID_ANY_ID
- 1, HID_ANY_ID
- 1}
809 static struct hid_driver mt_driver
= {
810 .name
= "hid-multitouch",
811 .id_table
= mt_devices
,
814 .input_mapping
= mt_input_mapping
,
815 .input_mapped
= mt_input_mapped
,
816 .feature_mapping
= mt_feature_mapping
,
817 .usage_table
= mt_grabbed_usages
,
820 .reset_resume
= mt_reset_resume
,
824 static int __init
mt_init(void)
826 return hid_register_driver(&mt_driver
);
829 static void __exit
mt_exit(void)
831 hid_unregister_driver(&mt_driver
);
834 module_init(mt_init
);
835 module_exit(mt_exit
);