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 __s8 inputmode
; /* InputMode HID feature, -1 if non-existent */
68 __u8 num_received
; /* how many contacts we received */
69 __u8 num_expected
; /* expected last contact index */
71 bool curvalid
; /* is the current contact valid? */
72 struct mt_slot
*slots
;
76 __s32 name
; /* MT_CLS */
78 __s32 sn_move
; /* Signal/noise ratio for move events */
79 __s32 sn_width
; /* Signal/noise ratio for width events */
80 __s32 sn_height
; /* Signal/noise ratio for height events */
81 __s32 sn_pressure
; /* Signal/noise ratio for pressure events */
85 /* classes of device behavior */
86 #define MT_CLS_DEFAULT 1
87 #define MT_CLS_DUAL_INRANGE_CONTACTID 2
88 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
89 #define MT_CLS_CYPRESS 4
90 #define MT_CLS_EGALAX 5
91 #define MT_CLS_STANTUM 6
93 #define MT_CLS_CONFIDENCE 8
94 #define MT_CLS_CONFIDENCE_MINUS_ONE 9
95 #define MT_CLS_DUAL_NSMU_CONTACTID 10
97 #define MT_DEFAULT_MAXCONTACT 10
100 * these device-dependent functions determine what slot corresponds
101 * to a valid contact that was just read.
104 static int cypress_compute_slot(struct mt_device
*td
)
106 if (td
->curdata
.contactid
!= 0 || td
->num_received
== 0)
107 return td
->curdata
.contactid
;
112 static int find_slot_from_contactid(struct mt_device
*td
)
115 for (i
= 0; i
< td
->maxcontacts
; ++i
) {
116 if (td
->slots
[i
].contactid
== td
->curdata
.contactid
&&
117 td
->slots
[i
].touch_state
)
120 for (i
= 0; i
< td
->maxcontacts
; ++i
) {
121 if (!td
->slots
[i
].seen_in_this_frame
&&
122 !td
->slots
[i
].touch_state
)
125 /* should not occurs. If this happens that means
126 * that the device sent more touches that it says
127 * in the report descriptor. It is ignored then. */
131 struct mt_class mt_classes
[] = {
132 { .name
= MT_CLS_DEFAULT
,
133 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
},
134 { .name
= MT_CLS_DUAL_INRANGE_CONTACTID
,
135 .quirks
= MT_QUIRK_VALID_IS_INRANGE
|
136 MT_QUIRK_SLOT_IS_CONTACTID
,
138 { .name
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
139 .quirks
= MT_QUIRK_VALID_IS_INRANGE
|
140 MT_QUIRK_SLOT_IS_CONTACTNUMBER
,
142 { .name
= MT_CLS_CYPRESS
,
143 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
146 { .name
= MT_CLS_CONFIDENCE_MINUS_ONE
,
147 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
|
148 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
},
149 { .name
= MT_CLS_EGALAX
,
150 .quirks
= MT_QUIRK_SLOT_IS_CONTACTID
|
151 MT_QUIRK_VALID_IS_INRANGE
|
152 MT_QUIRK_EGALAX_XYZ_FIXUP
,
157 { .name
= MT_CLS_STANTUM
,
158 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
},
160 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
|
161 MT_QUIRK_SLOT_IS_CONTACTID
,
165 { .name
= MT_CLS_CONFIDENCE
,
166 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
},
167 { .name
= MT_CLS_DUAL_NSMU_CONTACTID
,
168 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
169 MT_QUIRK_SLOT_IS_CONTACTID
,
175 static void mt_feature_mapping(struct hid_device
*hdev
,
176 struct hid_field
*field
, struct hid_usage
*usage
)
178 struct mt_device
*td
= hid_get_drvdata(hdev
);
180 switch (usage
->hid
) {
181 case HID_DG_INPUTMODE
:
182 td
->inputmode
= field
->report
->id
;
184 case HID_DG_CONTACTMAX
:
185 td
->maxcontacts
= field
->value
[0];
186 if (td
->mtclass
->maxcontacts
)
187 /* check if the maxcontacts is given by the class */
188 td
->maxcontacts
= td
->mtclass
->maxcontacts
;
194 static void set_abs(struct input_dev
*input
, unsigned int code
,
195 struct hid_field
*field
, int snratio
)
197 int fmin
= field
->logical_minimum
;
198 int fmax
= field
->logical_maximum
;
199 int fuzz
= snratio
? (fmax
- fmin
) / snratio
: 0;
200 input_set_abs_params(input
, code
, fmin
, fmax
, fuzz
, 0);
203 static int mt_input_mapping(struct hid_device
*hdev
, struct hid_input
*hi
,
204 struct hid_field
*field
, struct hid_usage
*usage
,
205 unsigned long **bit
, int *max
)
207 struct mt_device
*td
= hid_get_drvdata(hdev
);
208 struct mt_class
*cls
= td
->mtclass
;
209 __s32 quirks
= cls
->quirks
;
211 switch (usage
->hid
& HID_USAGE_PAGE
) {
214 switch (usage
->hid
) {
216 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
217 field
->logical_maximum
= 32760;
218 hid_map_usage(hi
, usage
, bit
, max
,
219 EV_ABS
, ABS_MT_POSITION_X
);
220 set_abs(hi
->input
, ABS_MT_POSITION_X
, field
,
222 /* touchscreen emulation */
223 set_abs(hi
->input
, ABS_X
, field
, cls
->sn_move
);
224 td
->last_slot_field
= usage
->hid
;
225 td
->last_field_index
= field
->index
;
228 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
229 field
->logical_maximum
= 32760;
230 hid_map_usage(hi
, usage
, bit
, max
,
231 EV_ABS
, ABS_MT_POSITION_Y
);
232 set_abs(hi
->input
, ABS_MT_POSITION_Y
, field
,
234 /* touchscreen emulation */
235 set_abs(hi
->input
, ABS_Y
, field
, cls
->sn_move
);
236 td
->last_slot_field
= usage
->hid
;
237 td
->last_field_index
= field
->index
;
242 case HID_UP_DIGITIZER
:
243 switch (usage
->hid
) {
245 td
->last_slot_field
= usage
->hid
;
246 td
->last_field_index
= field
->index
;
248 case HID_DG_CONFIDENCE
:
249 td
->last_slot_field
= usage
->hid
;
250 td
->last_field_index
= field
->index
;
252 case HID_DG_TIPSWITCH
:
253 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, BTN_TOUCH
);
254 input_set_capability(hi
->input
, EV_KEY
, BTN_TOUCH
);
255 td
->last_slot_field
= usage
->hid
;
256 td
->last_field_index
= field
->index
;
258 case HID_DG_CONTACTID
:
259 input_mt_init_slots(hi
->input
, td
->maxcontacts
);
260 td
->last_slot_field
= usage
->hid
;
261 td
->last_field_index
= field
->index
;
264 hid_map_usage(hi
, usage
, bit
, max
,
265 EV_ABS
, ABS_MT_TOUCH_MAJOR
);
266 set_abs(hi
->input
, ABS_MT_TOUCH_MAJOR
, field
,
268 td
->last_slot_field
= usage
->hid
;
269 td
->last_field_index
= field
->index
;
272 hid_map_usage(hi
, usage
, bit
, max
,
273 EV_ABS
, ABS_MT_TOUCH_MINOR
);
274 set_abs(hi
->input
, ABS_MT_TOUCH_MINOR
, field
,
276 input_set_abs_params(hi
->input
,
277 ABS_MT_ORIENTATION
, 0, 1, 0, 0);
278 td
->last_slot_field
= usage
->hid
;
279 td
->last_field_index
= field
->index
;
281 case HID_DG_TIPPRESSURE
:
282 if (quirks
& MT_QUIRK_EGALAX_XYZ_FIXUP
)
283 field
->logical_minimum
= 0;
284 hid_map_usage(hi
, usage
, bit
, max
,
285 EV_ABS
, ABS_MT_PRESSURE
);
286 set_abs(hi
->input
, ABS_MT_PRESSURE
, field
,
288 /* touchscreen emulation */
289 set_abs(hi
->input
, ABS_PRESSURE
, field
,
291 td
->last_slot_field
= usage
->hid
;
292 td
->last_field_index
= field
->index
;
294 case HID_DG_CONTACTCOUNT
:
295 td
->last_field_index
= field
->index
;
297 case HID_DG_CONTACTMAX
:
298 /* we don't set td->last_slot_field as contactcount and
299 * contact max are global to the report */
300 td
->last_field_index
= field
->index
;
303 /* let hid-input decide for the others */
307 /* we do not want to map these: no input-oriented meaning */
314 static int mt_input_mapped(struct hid_device
*hdev
, struct hid_input
*hi
,
315 struct hid_field
*field
, struct hid_usage
*usage
,
316 unsigned long **bit
, int *max
)
318 if (usage
->type
== EV_KEY
|| usage
->type
== EV_ABS
)
319 set_bit(usage
->type
, hi
->input
->evbit
);
324 static int mt_compute_slot(struct mt_device
*td
)
326 __s32 quirks
= td
->mtclass
->quirks
;
328 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID
)
329 return td
->curdata
.contactid
;
331 if (quirks
& MT_QUIRK_CYPRESS
)
332 return cypress_compute_slot(td
);
334 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTNUMBER
)
335 return td
->num_received
;
337 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
)
338 return td
->curdata
.contactid
- 1;
340 return find_slot_from_contactid(td
);
344 * this function is called when a whole contact has been processed,
345 * so that it can assign it to a slot and store the data there
347 static void mt_complete_slot(struct mt_device
*td
)
349 td
->curdata
.seen_in_this_frame
= true;
351 int slotnum
= mt_compute_slot(td
);
353 if (slotnum
>= 0 && slotnum
< td
->maxcontacts
)
354 td
->slots
[slotnum
] = td
->curdata
;
361 * this function is called when a whole packet has been received and processed,
362 * so that it can decide what to send to the input layer.
364 static void mt_emit_event(struct mt_device
*td
, struct input_dev
*input
)
368 for (i
= 0; i
< td
->maxcontacts
; ++i
) {
369 struct mt_slot
*s
= &(td
->slots
[i
]);
370 if ((td
->mtclass
->quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
) &&
371 !s
->seen_in_this_frame
) {
372 s
->touch_state
= false;
375 input_mt_slot(input
, i
);
376 input_mt_report_slot_state(input
, MT_TOOL_FINGER
,
378 if (s
->touch_state
) {
379 /* this finger is on the screen */
380 int wide
= (s
->w
> s
->h
);
381 /* divided by two to match visual scale of touch */
382 int major
= max(s
->w
, s
->h
) >> 1;
383 int minor
= min(s
->w
, s
->h
) >> 1;
385 input_event(input
, EV_ABS
, ABS_MT_POSITION_X
, s
->x
);
386 input_event(input
, EV_ABS
, ABS_MT_POSITION_Y
, s
->y
);
387 input_event(input
, EV_ABS
, ABS_MT_ORIENTATION
, wide
);
388 input_event(input
, EV_ABS
, ABS_MT_PRESSURE
, s
->p
);
389 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, major
);
390 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MINOR
, minor
);
392 s
->seen_in_this_frame
= false;
396 input_mt_report_pointer_emulation(input
, true);
398 td
->num_received
= 0;
403 static int mt_event(struct hid_device
*hid
, struct hid_field
*field
,
404 struct hid_usage
*usage
, __s32 value
)
406 struct mt_device
*td
= hid_get_drvdata(hid
);
407 __s32 quirks
= td
->mtclass
->quirks
;
409 if (hid
->claimed
& HID_CLAIMED_INPUT
&& td
->slots
) {
410 switch (usage
->hid
) {
412 if (quirks
& MT_QUIRK_VALID_IS_INRANGE
)
413 td
->curvalid
= value
;
415 case HID_DG_TIPSWITCH
:
416 if (quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
)
417 td
->curvalid
= value
;
418 td
->curdata
.touch_state
= value
;
420 case HID_DG_CONFIDENCE
:
421 if (quirks
& MT_QUIRK_VALID_IS_CONFIDENCE
)
422 td
->curvalid
= value
;
424 case HID_DG_CONTACTID
:
425 td
->curdata
.contactid
= value
;
427 case HID_DG_TIPPRESSURE
:
428 td
->curdata
.p
= value
;
431 td
->curdata
.x
= value
;
434 td
->curdata
.y
= value
;
437 td
->curdata
.w
= value
;
440 td
->curdata
.h
= value
;
442 case HID_DG_CONTACTCOUNT
:
444 * Includes multi-packet support where subsequent
445 * packets are sent with zero contactcount.
448 td
->num_expected
= value
;
452 /* fallback to the generic hidinput handling */
456 if (usage
->hid
== td
->last_slot_field
) {
457 mt_complete_slot(td
);
460 if (field
->index
== td
->last_field_index
461 && td
->num_received
>= td
->num_expected
)
462 mt_emit_event(td
, field
->hidinput
->input
);
466 /* we have handled the hidinput part, now remains hiddev */
467 if (hid
->claimed
& HID_CLAIMED_HIDDEV
&& hid
->hiddev_hid_event
)
468 hid
->hiddev_hid_event(hid
, field
, usage
, value
);
473 static void mt_set_input_mode(struct hid_device
*hdev
)
475 struct mt_device
*td
= hid_get_drvdata(hdev
);
476 struct hid_report
*r
;
477 struct hid_report_enum
*re
;
479 if (td
->inputmode
< 0)
482 re
= &(hdev
->report_enum
[HID_FEATURE_REPORT
]);
483 r
= re
->report_id_hash
[td
->inputmode
];
485 r
->field
[0]->value
[0] = 0x02;
486 usbhid_submit_report(hdev
, r
, USB_DIR_OUT
);
490 static int mt_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
493 struct mt_device
*td
;
494 struct mt_class
*mtclass
= mt_classes
; /* MT_CLS_DEFAULT */
496 for (i
= 0; mt_classes
[i
].name
; i
++) {
497 if (id
->driver_data
== mt_classes
[i
].name
) {
498 mtclass
= &(mt_classes
[i
]);
503 /* This allows the driver to correctly support devices
504 * that emit events over several HID messages.
506 hdev
->quirks
|= HID_QUIRK_NO_INPUT_SYNC
;
508 td
= kzalloc(sizeof(struct mt_device
), GFP_KERNEL
);
510 dev_err(&hdev
->dev
, "cannot allocate multitouch data\n");
513 td
->mtclass
= mtclass
;
515 hid_set_drvdata(hdev
, td
);
517 ret
= hid_parse(hdev
);
521 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
525 if (!td
->maxcontacts
)
526 td
->maxcontacts
= MT_DEFAULT_MAXCONTACT
;
528 td
->slots
= kzalloc(td
->maxcontacts
* sizeof(struct mt_slot
),
531 dev_err(&hdev
->dev
, "cannot allocate multitouch slots\n");
537 mt_set_input_mode(hdev
);
547 static int mt_reset_resume(struct hid_device
*hdev
)
549 mt_set_input_mode(hdev
);
554 static void mt_remove(struct hid_device
*hdev
)
556 struct mt_device
*td
= hid_get_drvdata(hdev
);
560 hid_set_drvdata(hdev
, NULL
);
563 static const struct hid_device_id mt_devices
[] = {
566 { .driver_data
= MT_CLS_3M
,
567 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
568 USB_DEVICE_ID_3M1968
) },
569 { .driver_data
= MT_CLS_3M
,
570 HID_USB_DEVICE(USB_VENDOR_ID_3M
,
571 USB_DEVICE_ID_3M2256
) },
573 /* ActionStar panels */
574 { .driver_data
= MT_CLS_DEFAULT
,
575 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR
,
576 USB_DEVICE_ID_ACTIONSTAR_1011
) },
579 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
580 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
581 USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
582 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
583 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
584 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1
) },
585 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
586 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
587 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
588 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
589 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
590 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
593 { .driver_data
= MT_CLS_DEFAULT
,
594 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH
,
595 USB_DEVICE_ID_CVTOUCH_SCREEN
) },
598 { .driver_data
= MT_CLS_CYPRESS
,
599 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
,
600 USB_DEVICE_ID_CYPRESS_TRUETOUCH
) },
602 /* Elo TouchSystems IntelliTouch Plus panel */
603 { .driver_data
= MT_CLS_DUAL_NSMU_CONTACTID
,
604 HID_USB_DEVICE(USB_VENDOR_ID_ELO
,
605 USB_DEVICE_ID_ELO_TS2515
) },
607 /* GeneralTouch panel */
608 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
609 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
,
610 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS
) },
612 /* Ilitek dual touch panel */
613 { .driver_data
= MT_CLS_DEFAULT
,
614 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK
,
615 USB_DEVICE_ID_ILITEK_MULTITOUCH
) },
618 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
619 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS
,
620 USB_DEVICE_ID_IRTOUCH_INFRARED_USB
) },
623 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
624 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
625 USB_DEVICE_ID_CRYSTALTOUCH
) },
628 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
629 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
630 USB_DEVICE_ID_ASUS_T91MT
)},
631 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
632 HID_USB_DEVICE(USB_VENDOR_ID_ASUS
,
633 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
634 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
635 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX
,
636 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART
) },
638 /* PenMount panels */
639 { .driver_data
= MT_CLS_CONFIDENCE
,
640 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT
,
641 USB_DEVICE_ID_PENMOUNT_PCI
) },
643 /* PixCir-based panels */
644 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
645 HID_USB_DEVICE(USB_VENDOR_ID_HANVON
,
646 USB_DEVICE_ID_HANVON_MULTITOUCH
) },
647 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
648 HID_USB_DEVICE(USB_VENDOR_ID_CANDO
,
649 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH
) },
651 /* Resistive eGalax devices */
652 { .driver_data
= MT_CLS_EGALAX
,
653 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
654 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH
) },
655 { .driver_data
= MT_CLS_EGALAX
,
656 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
657 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3
) },
659 /* Capacitive eGalax devices */
660 { .driver_data
= MT_CLS_EGALAX
,
661 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
662 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1
) },
663 { .driver_data
= MT_CLS_EGALAX
,
664 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
665 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2
) },
666 { .driver_data
= MT_CLS_EGALAX
,
667 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
668 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4
) },
671 { .driver_data
= MT_CLS_STANTUM
,
672 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
674 { .driver_data
= MT_CLS_STANTUM
,
675 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
676 USB_DEVICE_ID_MTP_STM
)},
677 { .driver_data
= MT_CLS_STANTUM
,
678 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
679 USB_DEVICE_ID_MTP_SITRONIX
)},
683 MODULE_DEVICE_TABLE(hid
, mt_devices
);
685 static const struct hid_usage_id mt_grabbed_usages
[] = {
686 { HID_ANY_ID
, HID_ANY_ID
, HID_ANY_ID
},
687 { HID_ANY_ID
- 1, HID_ANY_ID
- 1, HID_ANY_ID
- 1}
690 static struct hid_driver mt_driver
= {
691 .name
= "hid-multitouch",
692 .id_table
= mt_devices
,
695 .input_mapping
= mt_input_mapping
,
696 .input_mapped
= mt_input_mapped
,
697 .feature_mapping
= mt_feature_mapping
,
698 .usage_table
= mt_grabbed_usages
,
701 .reset_resume
= mt_reset_resume
,
705 static int __init
mt_init(void)
707 return hid_register_driver(&mt_driver
);
710 static void __exit
mt_exit(void)
712 hid_unregister_driver(&mt_driver
);
715 module_init(mt_init
);
716 module_exit(mt_exit
);