2 * HID driver for multitouch panels
4 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2012 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_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
54 #define MT_QUIRK_NO_AREA (1 << 9)
55 #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)
56 #define MT_QUIRK_HOVERING (1 << 11)
59 __s32 x
, y
, cx
, cy
, p
, w
, h
;
60 __s32 contactid
; /* the device ContactID assigned to this slot */
61 bool touch_state
; /* is the touch valid? */
62 bool inrange_state
; /* is the finger in proximity of the sensor? */
66 __s32 name
; /* MT_CLS */
68 __s32 sn_move
; /* Signal/noise ratio for move events */
69 __s32 sn_width
; /* Signal/noise ratio for width events */
70 __s32 sn_height
; /* Signal/noise ratio for height events */
71 __s32 sn_pressure
; /* Signal/noise ratio for pressure events */
73 bool is_indirect
; /* true for touchpads */
77 unsigned usages
[HID_MAX_FIELDS
];
82 struct mt_slot curdata
; /* placeholder of incoming data */
83 struct mt_class mtclass
; /* our mt device class */
84 struct mt_fields
*fields
; /* temporary placeholder for storing the
86 unsigned last_field_index
; /* last field index of the report */
87 unsigned last_slot_field
; /* the last field of a slot */
88 __s8 inputmode
; /* InputMode HID feature, -1 if non-existent */
89 __s8 inputmode_index
; /* InputMode HID feature index in the report */
90 __s8 maxcontact_report_id
; /* Maximum Contact Number HID feature,
92 __u8 num_received
; /* how many contacts we received */
93 __u8 num_expected
; /* expected last contact index */
95 __u8 touches_by_report
; /* how many touches are present in one report:
96 * 1 means we should use a serial protocol
97 * > 1 means hybrid (multitouch) protocol */
98 bool serial_maybe
; /* need to check for serial protocol */
99 bool curvalid
; /* is the current contact valid? */
100 unsigned mt_flags
; /* flags to pass to input-mt */
103 /* classes of device behavior */
104 #define MT_CLS_DEFAULT 0x0001
106 #define MT_CLS_SERIAL 0x0002
107 #define MT_CLS_CONFIDENCE 0x0003
108 #define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
109 #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
110 #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
111 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
112 #define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
113 #define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
115 /* vendor specific classes */
116 #define MT_CLS_3M 0x0101
117 #define MT_CLS_CYPRESS 0x0102
118 #define MT_CLS_EGALAX 0x0103
119 #define MT_CLS_EGALAX_SERIAL 0x0104
120 #define MT_CLS_TOPSEED 0x0105
121 #define MT_CLS_PANASONIC 0x0106
122 #define MT_CLS_FLATFROG 0x0107
123 #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
124 #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
126 #define MT_DEFAULT_MAXCONTACT 10
127 #define MT_MAX_MAXCONTACT 250
129 #define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
130 #define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
133 * these device-dependent functions determine what slot corresponds
134 * to a valid contact that was just read.
137 static int cypress_compute_slot(struct mt_device
*td
)
139 if (td
->curdata
.contactid
!= 0 || td
->num_received
== 0)
140 return td
->curdata
.contactid
;
145 static struct mt_class mt_classes
[] = {
146 { .name
= MT_CLS_DEFAULT
,
147 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
},
148 { .name
= MT_CLS_SERIAL
,
149 .quirks
= MT_QUIRK_ALWAYS_VALID
},
150 { .name
= MT_CLS_CONFIDENCE
,
151 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
},
152 { .name
= MT_CLS_CONFIDENCE_CONTACT_ID
,
153 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
|
154 MT_QUIRK_SLOT_IS_CONTACTID
},
155 { .name
= MT_CLS_CONFIDENCE_MINUS_ONE
,
156 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
|
157 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
},
158 { .name
= MT_CLS_DUAL_INRANGE_CONTACTID
,
159 .quirks
= MT_QUIRK_VALID_IS_INRANGE
|
160 MT_QUIRK_SLOT_IS_CONTACTID
,
162 { .name
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
163 .quirks
= MT_QUIRK_VALID_IS_INRANGE
|
164 MT_QUIRK_SLOT_IS_CONTACTNUMBER
,
166 { .name
= MT_CLS_DUAL_NSMU_CONTACTID
,
167 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
168 MT_QUIRK_SLOT_IS_CONTACTID
,
170 { .name
= MT_CLS_INRANGE_CONTACTNUMBER
,
171 .quirks
= MT_QUIRK_VALID_IS_INRANGE
|
172 MT_QUIRK_SLOT_IS_CONTACTNUMBER
},
175 * vendor specific classes
178 .quirks
= MT_QUIRK_VALID_IS_CONFIDENCE
|
179 MT_QUIRK_SLOT_IS_CONTACTID
,
185 { .name
= MT_CLS_CYPRESS
,
186 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
189 { .name
= MT_CLS_EGALAX
,
190 .quirks
= MT_QUIRK_SLOT_IS_CONTACTID
|
191 MT_QUIRK_VALID_IS_INRANGE
,
195 { .name
= MT_CLS_EGALAX_SERIAL
,
196 .quirks
= MT_QUIRK_SLOT_IS_CONTACTID
|
197 MT_QUIRK_ALWAYS_VALID
,
201 { .name
= MT_CLS_TOPSEED
,
202 .quirks
= MT_QUIRK_ALWAYS_VALID
,
206 { .name
= MT_CLS_PANASONIC
,
207 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
,
209 { .name
= MT_CLS_GENERALTOUCH_TWOFINGERS
,
210 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
211 MT_QUIRK_VALID_IS_INRANGE
|
212 MT_QUIRK_SLOT_IS_CONTACTNUMBER
,
215 { .name
= MT_CLS_GENERALTOUCH_PWT_TENFINGERS
,
216 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
217 MT_QUIRK_SLOT_IS_CONTACTNUMBER
220 { .name
= MT_CLS_FLATFROG
,
221 .quirks
= MT_QUIRK_NOT_SEEN_MEANS_UP
|
229 static ssize_t
mt_show_quirks(struct device
*dev
,
230 struct device_attribute
*attr
,
233 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
234 struct mt_device
*td
= hid_get_drvdata(hdev
);
236 return sprintf(buf
, "%u\n", td
->mtclass
.quirks
);
239 static ssize_t
mt_set_quirks(struct device
*dev
,
240 struct device_attribute
*attr
,
241 const char *buf
, size_t count
)
243 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
244 struct mt_device
*td
= hid_get_drvdata(hdev
);
248 if (kstrtoul(buf
, 0, &val
))
251 td
->mtclass
.quirks
= val
;
256 static DEVICE_ATTR(quirks
, S_IWUSR
| S_IRUGO
, mt_show_quirks
, mt_set_quirks
);
258 static struct attribute
*sysfs_attrs
[] = {
259 &dev_attr_quirks
.attr
,
263 static struct attribute_group mt_attribute_group
= {
267 static void mt_feature_mapping(struct hid_device
*hdev
,
268 struct hid_field
*field
, struct hid_usage
*usage
)
270 struct mt_device
*td
= hid_get_drvdata(hdev
);
273 switch (usage
->hid
) {
274 case HID_DG_INPUTMODE
:
275 td
->inputmode
= field
->report
->id
;
276 td
->inputmode_index
= 0; /* has to be updated below */
278 for (i
=0; i
< field
->maxusage
; i
++) {
279 if (field
->usage
[i
].hid
== usage
->hid
) {
280 td
->inputmode_index
= i
;
286 case HID_DG_CONTACTMAX
:
287 td
->maxcontact_report_id
= field
->report
->id
;
288 td
->maxcontacts
= field
->value
[0];
289 if (!td
->maxcontacts
&&
290 field
->logical_maximum
<= MT_MAX_MAXCONTACT
)
291 td
->maxcontacts
= field
->logical_maximum
;
292 if (td
->mtclass
.maxcontacts
)
293 /* check if the maxcontacts is given by the class */
294 td
->maxcontacts
= td
->mtclass
.maxcontacts
;
298 if (field
->report_count
== 256 && field
->report_size
== 8) {
299 /* Win 8 devices need special quirks */
300 __s32
*quirks
= &td
->mtclass
.quirks
;
301 *quirks
|= MT_QUIRK_ALWAYS_VALID
;
302 *quirks
|= MT_QUIRK_IGNORE_DUPLICATES
;
303 *quirks
|= MT_QUIRK_HOVERING
;
304 *quirks
&= ~MT_QUIRK_NOT_SEEN_MEANS_UP
;
305 *quirks
&= ~MT_QUIRK_VALID_IS_INRANGE
;
306 *quirks
&= ~MT_QUIRK_VALID_IS_CONFIDENCE
;
312 static void set_abs(struct input_dev
*input
, unsigned int code
,
313 struct hid_field
*field
, int snratio
)
315 int fmin
= field
->logical_minimum
;
316 int fmax
= field
->logical_maximum
;
317 int fuzz
= snratio
? (fmax
- fmin
) / snratio
: 0;
318 input_set_abs_params(input
, code
, fmin
, fmax
, fuzz
, 0);
319 input_abs_set_res(input
, code
, hidinput_calc_abs_res(field
, code
));
322 static void mt_store_field(struct hid_usage
*usage
, struct mt_device
*td
,
323 struct hid_input
*hi
)
325 struct mt_fields
*f
= td
->fields
;
327 if (f
->length
>= HID_MAX_FIELDS
)
330 f
->usages
[f
->length
++] = usage
->hid
;
333 static int mt_input_mapping(struct hid_device
*hdev
, struct hid_input
*hi
,
334 struct hid_field
*field
, struct hid_usage
*usage
,
335 unsigned long **bit
, int *max
)
337 struct mt_device
*td
= hid_get_drvdata(hdev
);
338 struct mt_class
*cls
= &td
->mtclass
;
340 struct hid_usage
*prev_usage
= NULL
;
342 /* Only map fields from TouchScreen or TouchPad collections.
343 * We need to ignore fields that belong to other collections
344 * such as Mouse that might have the same GenericDesktop usages. */
345 if (field
->application
== HID_DG_TOUCHSCREEN
)
346 td
->mt_flags
|= INPUT_MT_DIRECT
;
347 else if (field
->application
!= HID_DG_TOUCHPAD
)
351 * Model touchscreens providing buttons as touchpads.
353 if (field
->application
== HID_DG_TOUCHPAD
||
354 (usage
->hid
& HID_USAGE_PAGE
) == HID_UP_BUTTON
)
355 td
->mt_flags
|= INPUT_MT_POINTER
;
357 /* eGalax devices provide a Digitizer.Stylus input which overrides
358 * the correct Digitizers.Finger X/Y ranges.
359 * Let's just ignore this input. */
360 if (field
->physical
== HID_DG_STYLUS
)
363 if (usage
->usage_index
)
364 prev_usage
= &field
->usage
[usage
->usage_index
- 1];
366 switch (usage
->hid
& HID_USAGE_PAGE
) {
369 switch (usage
->hid
) {
371 if (prev_usage
&& (prev_usage
->hid
== usage
->hid
)) {
372 hid_map_usage(hi
, usage
, bit
, max
,
373 EV_ABS
, ABS_MT_TOOL_X
);
374 set_abs(hi
->input
, ABS_MT_TOOL_X
, field
,
377 hid_map_usage(hi
, usage
, bit
, max
,
378 EV_ABS
, ABS_MT_POSITION_X
);
379 set_abs(hi
->input
, ABS_MT_POSITION_X
, field
,
383 mt_store_field(usage
, td
, hi
);
384 td
->last_field_index
= field
->index
;
387 if (prev_usage
&& (prev_usage
->hid
== usage
->hid
)) {
388 hid_map_usage(hi
, usage
, bit
, max
,
389 EV_ABS
, ABS_MT_TOOL_Y
);
390 set_abs(hi
->input
, ABS_MT_TOOL_Y
, field
,
393 hid_map_usage(hi
, usage
, bit
, max
,
394 EV_ABS
, ABS_MT_POSITION_Y
);
395 set_abs(hi
->input
, ABS_MT_POSITION_Y
, field
,
399 mt_store_field(usage
, td
, hi
);
400 td
->last_field_index
= field
->index
;
405 case HID_UP_DIGITIZER
:
406 switch (usage
->hid
) {
408 if (cls
->quirks
& MT_QUIRK_HOVERING
) {
409 hid_map_usage(hi
, usage
, bit
, max
,
410 EV_ABS
, ABS_MT_DISTANCE
);
411 input_set_abs_params(hi
->input
,
412 ABS_MT_DISTANCE
, 0, 1, 0, 0);
414 mt_store_field(usage
, td
, hi
);
415 td
->last_field_index
= field
->index
;
417 case HID_DG_CONFIDENCE
:
418 mt_store_field(usage
, td
, hi
);
419 td
->last_field_index
= field
->index
;
421 case HID_DG_TIPSWITCH
:
422 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, BTN_TOUCH
);
423 input_set_capability(hi
->input
, EV_KEY
, BTN_TOUCH
);
424 mt_store_field(usage
, td
, hi
);
425 td
->last_field_index
= field
->index
;
427 case HID_DG_CONTACTID
:
428 mt_store_field(usage
, td
, hi
);
429 td
->last_field_index
= field
->index
;
430 td
->touches_by_report
++;
433 hid_map_usage(hi
, usage
, bit
, max
,
434 EV_ABS
, ABS_MT_TOUCH_MAJOR
);
435 if (!(cls
->quirks
& MT_QUIRK_NO_AREA
))
436 set_abs(hi
->input
, ABS_MT_TOUCH_MAJOR
, field
,
438 mt_store_field(usage
, td
, hi
);
439 td
->last_field_index
= field
->index
;
442 hid_map_usage(hi
, usage
, bit
, max
,
443 EV_ABS
, ABS_MT_TOUCH_MINOR
);
444 if (!(cls
->quirks
& MT_QUIRK_NO_AREA
)) {
445 set_abs(hi
->input
, ABS_MT_TOUCH_MINOR
, field
,
447 input_set_abs_params(hi
->input
,
448 ABS_MT_ORIENTATION
, 0, 1, 0, 0);
450 mt_store_field(usage
, td
, hi
);
451 td
->last_field_index
= field
->index
;
453 case HID_DG_TIPPRESSURE
:
454 hid_map_usage(hi
, usage
, bit
, max
,
455 EV_ABS
, ABS_MT_PRESSURE
);
456 set_abs(hi
->input
, ABS_MT_PRESSURE
, field
,
458 mt_store_field(usage
, td
, hi
);
459 td
->last_field_index
= field
->index
;
461 case HID_DG_CONTACTCOUNT
:
462 td
->last_field_index
= field
->index
;
464 case HID_DG_CONTACTMAX
:
465 /* we don't set td->last_slot_field as contactcount and
466 * contact max are global to the report */
467 td
->last_field_index
= field
->index
;
470 /* Legacy devices use TIPSWITCH and not TOUCH.
471 * Let's just ignore this field. */
474 /* let hid-input decide for the others */
478 code
= BTN_MOUSE
+ ((usage
->hid
- 1) & HID_USAGE
);
479 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, code
);
480 input_set_capability(hi
->input
, EV_KEY
, code
);
484 /* we do not want to map these: no input-oriented meaning */
491 static int mt_input_mapped(struct hid_device
*hdev
, struct hid_input
*hi
,
492 struct hid_field
*field
, struct hid_usage
*usage
,
493 unsigned long **bit
, int *max
)
495 if (usage
->type
== EV_KEY
|| usage
->type
== EV_ABS
)
496 set_bit(usage
->type
, hi
->input
->evbit
);
501 static int mt_compute_slot(struct mt_device
*td
, struct input_dev
*input
)
503 __s32 quirks
= td
->mtclass
.quirks
;
505 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID
)
506 return td
->curdata
.contactid
;
508 if (quirks
& MT_QUIRK_CYPRESS
)
509 return cypress_compute_slot(td
);
511 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTNUMBER
)
512 return td
->num_received
;
514 if (quirks
& MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
)
515 return td
->curdata
.contactid
- 1;
517 return input_mt_get_slot_by_key(input
, td
->curdata
.contactid
);
521 * this function is called when a whole contact has been processed,
522 * so that it can assign it to a slot and store the data there
524 static void mt_complete_slot(struct mt_device
*td
, struct input_dev
*input
)
526 if (td
->curvalid
|| (td
->mtclass
.quirks
& MT_QUIRK_ALWAYS_VALID
)) {
527 int slotnum
= mt_compute_slot(td
, input
);
528 struct mt_slot
*s
= &td
->curdata
;
529 struct input_mt
*mt
= input
->mt
;
531 if (slotnum
< 0 || slotnum
>= td
->maxcontacts
)
534 if ((td
->mtclass
.quirks
& MT_QUIRK_IGNORE_DUPLICATES
) && mt
) {
535 struct input_mt_slot
*slot
= &mt
->slots
[slotnum
];
536 if (input_mt_is_active(slot
) &&
537 input_mt_is_used(mt
, slot
))
541 input_mt_slot(input
, slotnum
);
542 input_mt_report_slot_state(input
, MT_TOOL_FINGER
,
543 s
->touch_state
|| s
->inrange_state
);
544 if (s
->touch_state
|| s
->inrange_state
) {
545 /* this finger is in proximity of the sensor */
546 int wide
= (s
->w
> s
->h
);
547 /* divided by two to match visual scale of touch */
548 int major
= max(s
->w
, s
->h
) >> 1;
549 int minor
= min(s
->w
, s
->h
) >> 1;
551 input_event(input
, EV_ABS
, ABS_MT_POSITION_X
, s
->x
);
552 input_event(input
, EV_ABS
, ABS_MT_POSITION_Y
, s
->y
);
553 input_event(input
, EV_ABS
, ABS_MT_TOOL_X
, s
->cx
);
554 input_event(input
, EV_ABS
, ABS_MT_TOOL_Y
, s
->cy
);
555 input_event(input
, EV_ABS
, ABS_MT_DISTANCE
,
557 input_event(input
, EV_ABS
, ABS_MT_ORIENTATION
, wide
);
558 input_event(input
, EV_ABS
, ABS_MT_PRESSURE
, s
->p
);
559 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, major
);
560 input_event(input
, EV_ABS
, ABS_MT_TOUCH_MINOR
, minor
);
568 * this function is called when a whole packet has been received and processed,
569 * so that it can decide what to send to the input layer.
571 static void mt_sync_frame(struct mt_device
*td
, struct input_dev
*input
)
573 input_mt_sync_frame(input
);
575 td
->num_received
= 0;
578 static int mt_event(struct hid_device
*hid
, struct hid_field
*field
,
579 struct hid_usage
*usage
, __s32 value
)
581 struct mt_device
*td
= hid_get_drvdata(hid
);
582 __s32 quirks
= td
->mtclass
.quirks
;
584 if (hid
->claimed
& HID_CLAIMED_INPUT
) {
585 switch (usage
->hid
) {
587 if (quirks
& MT_QUIRK_VALID_IS_INRANGE
)
588 td
->curvalid
= value
;
589 if (quirks
& MT_QUIRK_HOVERING
)
590 td
->curdata
.inrange_state
= value
;
592 case HID_DG_TIPSWITCH
:
593 if (quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
)
594 td
->curvalid
= value
;
595 td
->curdata
.touch_state
= value
;
597 case HID_DG_CONFIDENCE
:
598 if (quirks
& MT_QUIRK_VALID_IS_CONFIDENCE
)
599 td
->curvalid
= value
;
601 case HID_DG_CONTACTID
:
602 td
->curdata
.contactid
= value
;
604 case HID_DG_TIPPRESSURE
:
605 td
->curdata
.p
= value
;
608 if (usage
->code
== ABS_MT_TOOL_X
)
609 td
->curdata
.cx
= value
;
611 td
->curdata
.x
= value
;
614 if (usage
->code
== ABS_MT_TOOL_Y
)
615 td
->curdata
.cy
= value
;
617 td
->curdata
.y
= value
;
620 td
->curdata
.w
= value
;
623 td
->curdata
.h
= value
;
625 case HID_DG_CONTACTCOUNT
:
627 * Includes multi-packet support where subsequent
628 * packets are sent with zero contactcount.
631 td
->num_expected
= value
;
638 /* fallback to the generic hidinput handling */
642 if (usage
->usage_index
+ 1 == field
->report_count
) {
643 /* we only take into account the last report. */
644 if (usage
->hid
== td
->last_slot_field
)
645 mt_complete_slot(td
, field
->hidinput
->input
);
647 if (field
->index
== td
->last_field_index
648 && td
->num_received
>= td
->num_expected
)
649 mt_sync_frame(td
, field
->hidinput
->input
);
654 /* we have handled the hidinput part, now remains hiddev */
655 if (hid
->claimed
& HID_CLAIMED_HIDDEV
&& hid
->hiddev_hid_event
)
656 hid
->hiddev_hid_event(hid
, field
, usage
, value
);
661 static void mt_set_input_mode(struct hid_device
*hdev
)
663 struct mt_device
*td
= hid_get_drvdata(hdev
);
664 struct hid_report
*r
;
665 struct hid_report_enum
*re
;
667 if (td
->inputmode
< 0)
670 re
= &(hdev
->report_enum
[HID_FEATURE_REPORT
]);
671 r
= re
->report_id_hash
[td
->inputmode
];
673 r
->field
[0]->value
[td
->inputmode_index
] = 0x02;
674 usbhid_submit_report(hdev
, r
, USB_DIR_OUT
);
678 static void mt_set_maxcontacts(struct hid_device
*hdev
)
680 struct mt_device
*td
= hid_get_drvdata(hdev
);
681 struct hid_report
*r
;
682 struct hid_report_enum
*re
;
685 if (td
->maxcontact_report_id
< 0)
688 if (!td
->mtclass
.maxcontacts
)
691 re
= &hdev
->report_enum
[HID_FEATURE_REPORT
];
692 r
= re
->report_id_hash
[td
->maxcontact_report_id
];
694 max
= td
->mtclass
.maxcontacts
;
695 fieldmax
= r
->field
[0]->logical_maximum
;
696 max
= min(fieldmax
, max
);
697 if (r
->field
[0]->value
[0] != max
) {
698 r
->field
[0]->value
[0] = max
;
699 usbhid_submit_report(hdev
, r
, USB_DIR_OUT
);
704 static void mt_post_parse_default_settings(struct mt_device
*td
)
706 __s32 quirks
= td
->mtclass
.quirks
;
708 /* unknown serial device needs special quirks */
709 if (td
->touches_by_report
== 1) {
710 quirks
|= MT_QUIRK_ALWAYS_VALID
;
711 quirks
&= ~MT_QUIRK_NOT_SEEN_MEANS_UP
;
712 quirks
&= ~MT_QUIRK_VALID_IS_INRANGE
;
713 quirks
&= ~MT_QUIRK_VALID_IS_CONFIDENCE
;
716 td
->mtclass
.quirks
= quirks
;
719 static void mt_post_parse(struct mt_device
*td
)
721 struct mt_fields
*f
= td
->fields
;
723 if (td
->touches_by_report
> 0) {
724 int field_count_per_touch
= f
->length
/ td
->touches_by_report
;
725 td
->last_slot_field
= f
->usages
[field_count_per_touch
- 1];
729 static void mt_input_configured(struct hid_device
*hdev
, struct hid_input
*hi
)
732 struct mt_device
*td
= hid_get_drvdata(hdev
);
733 struct mt_class
*cls
= &td
->mtclass
;
734 struct input_dev
*input
= hi
->input
;
736 /* Only initialize slots for MT input devices */
737 if (!test_bit(ABS_MT_POSITION_X
, input
->absbit
))
740 if (!td
->maxcontacts
)
741 td
->maxcontacts
= MT_DEFAULT_MAXCONTACT
;
744 if (td
->serial_maybe
)
745 mt_post_parse_default_settings(td
);
747 if (cls
->is_indirect
)
748 td
->mt_flags
|= INPUT_MT_POINTER
;
750 if (cls
->quirks
& MT_QUIRK_NOT_SEEN_MEANS_UP
)
751 td
->mt_flags
|= INPUT_MT_DROP_UNUSED
;
753 input_mt_init_slots(input
, td
->maxcontacts
, td
->mt_flags
);
758 static int mt_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
761 struct mt_device
*td
;
762 struct mt_class
*mtclass
= mt_classes
; /* MT_CLS_DEFAULT */
764 for (i
= 0; mt_classes
[i
].name
; i
++) {
765 if (id
->driver_data
== mt_classes
[i
].name
) {
766 mtclass
= &(mt_classes
[i
]);
771 /* This allows the driver to correctly support devices
772 * that emit events over several HID messages.
774 hdev
->quirks
|= HID_QUIRK_NO_INPUT_SYNC
;
776 td
= kzalloc(sizeof(struct mt_device
), GFP_KERNEL
);
778 dev_err(&hdev
->dev
, "cannot allocate multitouch data\n");
781 td
->mtclass
= *mtclass
;
783 td
->maxcontact_report_id
= -1;
784 hid_set_drvdata(hdev
, td
);
786 td
->fields
= kzalloc(sizeof(struct mt_fields
), GFP_KERNEL
);
788 dev_err(&hdev
->dev
, "cannot allocate multitouch fields data\n");
793 if (id
->vendor
== HID_ANY_ID
&& id
->product
== HID_ANY_ID
)
794 td
->serial_maybe
= true;
796 ret
= hid_parse(hdev
);
800 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
804 ret
= sysfs_create_group(&hdev
->dev
.kobj
, &mt_attribute_group
);
806 mt_set_maxcontacts(hdev
);
807 mt_set_input_mode(hdev
);
821 static int mt_reset_resume(struct hid_device
*hdev
)
823 mt_set_maxcontacts(hdev
);
824 mt_set_input_mode(hdev
);
828 static int mt_resume(struct hid_device
*hdev
)
830 struct usb_interface
*intf
;
831 struct usb_host_interface
*interface
;
832 struct usb_device
*dev
;
834 if (hdev
->bus
!= BUS_USB
)
837 intf
= to_usb_interface(hdev
->dev
.parent
);
838 interface
= intf
->cur_altsetting
;
839 dev
= hid_to_usb_dev(hdev
);
841 /* Some Elan legacy devices require SET_IDLE to be set on resume.
842 * It should be safe to send it to other devices too.
843 * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
845 usb_control_msg(dev
, usb_sndctrlpipe(dev
, 0),
847 USB_TYPE_CLASS
| USB_RECIP_INTERFACE
,
848 0, interface
->desc
.bInterfaceNumber
,
849 NULL
, 0, USB_CTRL_SET_TIMEOUT
);
855 static void mt_remove(struct hid_device
*hdev
)
857 struct mt_device
*td
= hid_get_drvdata(hdev
);
858 sysfs_remove_group(&hdev
->dev
.kobj
, &mt_attribute_group
);
861 hid_set_drvdata(hdev
, NULL
);
864 static const struct hid_device_id mt_devices
[] = {
867 { .driver_data
= MT_CLS_3M
,
868 MT_USB_DEVICE(USB_VENDOR_ID_3M
,
869 USB_DEVICE_ID_3M1968
) },
870 { .driver_data
= MT_CLS_3M
,
871 MT_USB_DEVICE(USB_VENDOR_ID_3M
,
872 USB_DEVICE_ID_3M2256
) },
873 { .driver_data
= MT_CLS_3M
,
874 MT_USB_DEVICE(USB_VENDOR_ID_3M
,
875 USB_DEVICE_ID_3M3266
) },
877 /* ActionStar panels */
878 { .driver_data
= MT_CLS_DEFAULT
,
879 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR
,
880 USB_DEVICE_ID_ACTIONSTAR_1011
) },
883 { .driver_data
= MT_CLS_SERIAL
,
884 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL
,
885 USB_DEVICE_ID_ATMEL_MULTITOUCH
) },
886 { .driver_data
= MT_CLS_SERIAL
,
887 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL
,
888 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER
) },
890 /* Baanto multitouch devices */
891 { .driver_data
= MT_CLS_DEFAULT
,
892 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO
,
893 USB_DEVICE_ID_BAANTO_MT_190W2
) },
895 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
896 MT_USB_DEVICE(USB_VENDOR_ID_CANDO
,
897 USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
898 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
899 MT_USB_DEVICE(USB_VENDOR_ID_CANDO
,
900 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1
) },
901 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
902 MT_USB_DEVICE(USB_VENDOR_ID_CANDO
,
903 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
904 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTNUMBER
,
905 MT_USB_DEVICE(USB_VENDOR_ID_CANDO
,
906 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
908 /* Chunghwa Telecom touch panels */
909 { .driver_data
= MT_CLS_DEFAULT
,
910 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT
,
911 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH
) },
914 { .driver_data
= MT_CLS_DEFAULT
,
915 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH
,
916 USB_DEVICE_ID_CVTOUCH_SCREEN
) },
919 { .driver_data
= MT_CLS_CYPRESS
,
920 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
,
921 USB_DEVICE_ID_CYPRESS_TRUETOUCH
) },
923 /* eGalax devices (resistive) */
924 { .driver_data
= MT_CLS_EGALAX
,
925 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
926 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D
) },
927 { .driver_data
= MT_CLS_EGALAX
,
928 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
929 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E
) },
931 /* eGalax devices (capacitive) */
932 { .driver_data
= MT_CLS_EGALAX
,
933 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
934 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C
) },
935 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
936 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
937 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207
) },
938 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
939 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
940 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E
) },
941 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
942 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
943 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224
) },
944 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
945 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
946 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A
) },
947 { .driver_data
= MT_CLS_EGALAX
,
948 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
949 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B
) },
950 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
951 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
952 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262
) },
953 { .driver_data
= MT_CLS_EGALAX
,
954 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
955 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1
) },
956 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
957 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
958 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA
) },
959 { .driver_data
= MT_CLS_EGALAX
,
960 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
961 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA
) },
962 { .driver_data
= MT_CLS_EGALAX
,
963 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
964 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302
) },
965 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
966 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
967 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349
) },
968 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
969 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
970 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7
) },
971 { .driver_data
= MT_CLS_EGALAX_SERIAL
,
972 MT_USB_DEVICE(USB_VENDOR_ID_DWAV
,
973 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001
) },
974 { .driver_data
= MT_CLS_EGALAX
,
975 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
976 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224
) },
977 { .driver_data
= MT_CLS_EGALAX
,
978 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
979 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0
) },
980 { .driver_data
= MT_CLS_EGALAX
,
981 HID_USB_DEVICE(USB_VENDOR_ID_DWAV
,
982 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4
) },
984 /* Elo TouchSystems IntelliTouch Plus panel */
985 { .driver_data
= MT_CLS_DUAL_NSMU_CONTACTID
,
986 MT_USB_DEVICE(USB_VENDOR_ID_ELO
,
987 USB_DEVICE_ID_ELO_TS2515
) },
989 /* Flatfrog Panels */
990 { .driver_data
= MT_CLS_FLATFROG
,
991 MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG
,
992 USB_DEVICE_ID_MULTITOUCH_3200
) },
994 /* GeneralTouch panel */
995 { .driver_data
= MT_CLS_GENERALTOUCH_TWOFINGERS
,
996 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
,
997 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS
) },
998 { .driver_data
= MT_CLS_GENERALTOUCH_PWT_TENFINGERS
,
999 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
,
1000 USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS
) },
1002 /* Gametel game controller */
1003 { .driver_data
= MT_CLS_DEFAULT
,
1004 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL
,
1005 USB_DEVICE_ID_GAMETEL_MT_MODE
) },
1007 /* GoodTouch panels */
1008 { .driver_data
= MT_CLS_DEFAULT
,
1009 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH
,
1010 USB_DEVICE_ID_GOODTOUCH_000f
) },
1013 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
1014 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT
,
1015 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH
) },
1018 { .driver_data
= MT_CLS_SERIAL
,
1019 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM
,
1020 USB_DEVICE_ID_IDEACOM_IDC6650
) },
1021 { .driver_data
= MT_CLS_SERIAL
,
1022 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM
,
1023 USB_DEVICE_ID_IDEACOM_IDC6651
) },
1025 /* Ilitek dual touch panel */
1026 { .driver_data
= MT_CLS_DEFAULT
,
1027 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK
,
1028 USB_DEVICE_ID_ILITEK_MULTITOUCH
) },
1030 /* IRTOUCH panels */
1031 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
1032 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS
,
1033 USB_DEVICE_ID_IRTOUCH_INFRARED_USB
) },
1035 /* LG Display panels */
1036 { .driver_data
= MT_CLS_DEFAULT
,
1037 MT_USB_DEVICE(USB_VENDOR_ID_LG
,
1038 USB_DEVICE_ID_LG_MULTITOUCH
) },
1041 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
1042 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
1043 USB_DEVICE_ID_CRYSTALTOUCH
) },
1044 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
1045 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO
,
1046 USB_DEVICE_ID_CRYSTALTOUCH_DUAL
) },
1049 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
1050 MT_USB_DEVICE(USB_VENDOR_ID_ASUS
,
1051 USB_DEVICE_ID_ASUS_T91MT
)},
1052 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
1053 MT_USB_DEVICE(USB_VENDOR_ID_ASUS
,
1054 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
1055 { .driver_data
= MT_CLS_CONFIDENCE_MINUS_ONE
,
1056 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX
,
1057 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART
) },
1059 /* Panasonic panels */
1060 { .driver_data
= MT_CLS_PANASONIC
,
1061 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC
,
1062 USB_DEVICE_ID_PANABOARD_UBT780
) },
1063 { .driver_data
= MT_CLS_PANASONIC
,
1064 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC
,
1065 USB_DEVICE_ID_PANABOARD_UBT880
) },
1068 { .driver_data
= MT_CLS_DEFAULT
,
1069 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK
,
1070 USB_DEVICE_ID_NOVATEK_PCT
) },
1072 /* PenMount panels */
1073 { .driver_data
= MT_CLS_CONFIDENCE
,
1074 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT
,
1075 USB_DEVICE_ID_PENMOUNT_PCI
) },
1077 /* PixArt optical touch screen */
1078 { .driver_data
= MT_CLS_INRANGE_CONTACTNUMBER
,
1079 MT_USB_DEVICE(USB_VENDOR_ID_PIXART
,
1080 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN
) },
1081 { .driver_data
= MT_CLS_INRANGE_CONTACTNUMBER
,
1082 MT_USB_DEVICE(USB_VENDOR_ID_PIXART
,
1083 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1
) },
1084 { .driver_data
= MT_CLS_INRANGE_CONTACTNUMBER
,
1085 MT_USB_DEVICE(USB_VENDOR_ID_PIXART
,
1086 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2
) },
1088 /* PixCir-based panels */
1089 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
1090 MT_USB_DEVICE(USB_VENDOR_ID_HANVON
,
1091 USB_DEVICE_ID_HANVON_MULTITOUCH
) },
1092 { .driver_data
= MT_CLS_DUAL_INRANGE_CONTACTID
,
1093 MT_USB_DEVICE(USB_VENDOR_ID_CANDO
,
1094 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH
) },
1096 /* Quanta-based panels */
1097 { .driver_data
= MT_CLS_CONFIDENCE_CONTACT_ID
,
1098 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA
,
1099 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH
) },
1100 { .driver_data
= MT_CLS_CONFIDENCE_CONTACT_ID
,
1101 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA
,
1102 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001
) },
1103 { .driver_data
= MT_CLS_CONFIDENCE_CONTACT_ID
,
1104 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA
,
1105 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008
) },
1107 /* Stantum panels */
1108 { .driver_data
= MT_CLS_CONFIDENCE
,
1109 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM
,
1110 USB_DEVICE_ID_MTP
)},
1111 { .driver_data
= MT_CLS_CONFIDENCE
,
1112 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM
,
1113 USB_DEVICE_ID_MTP_STM
)},
1114 { .driver_data
= MT_CLS_CONFIDENCE
,
1115 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX
,
1116 USB_DEVICE_ID_MTP_SITRONIX
)},
1118 /* TopSeed panels */
1119 { .driver_data
= MT_CLS_TOPSEED
,
1120 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2
,
1121 USB_DEVICE_ID_TOPSEED2_PERIPAD_701
) },
1123 /* Touch International panels */
1124 { .driver_data
= MT_CLS_DEFAULT
,
1125 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL
,
1126 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH
) },
1129 { .driver_data
= MT_CLS_DEFAULT
,
1130 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
1131 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709
) },
1132 { .driver_data
= MT_CLS_DEFAULT
,
1133 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC
,
1134 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19
) },
1136 { .driver_data
= MT_CLS_DEFAULT
,
1137 MT_USB_DEVICE(USB_VENDOR_ID_XAT
,
1138 USB_DEVICE_ID_XAT_CSR
) },
1141 { .driver_data
= MT_CLS_DEFAULT
,
1142 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1143 USB_DEVICE_ID_XIROKU_SPX
) },
1144 { .driver_data
= MT_CLS_DEFAULT
,
1145 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1146 USB_DEVICE_ID_XIROKU_MPX
) },
1147 { .driver_data
= MT_CLS_DEFAULT
,
1148 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1149 USB_DEVICE_ID_XIROKU_CSR
) },
1150 { .driver_data
= MT_CLS_DEFAULT
,
1151 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1152 USB_DEVICE_ID_XIROKU_SPX1
) },
1153 { .driver_data
= MT_CLS_DEFAULT
,
1154 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1155 USB_DEVICE_ID_XIROKU_MPX1
) },
1156 { .driver_data
= MT_CLS_DEFAULT
,
1157 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1158 USB_DEVICE_ID_XIROKU_CSR1
) },
1159 { .driver_data
= MT_CLS_DEFAULT
,
1160 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1161 USB_DEVICE_ID_XIROKU_SPX2
) },
1162 { .driver_data
= MT_CLS_DEFAULT
,
1163 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1164 USB_DEVICE_ID_XIROKU_MPX2
) },
1165 { .driver_data
= MT_CLS_DEFAULT
,
1166 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU
,
1167 USB_DEVICE_ID_XIROKU_CSR2
) },
1169 /* Zytronic panels */
1170 { .driver_data
= MT_CLS_SERIAL
,
1171 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC
,
1172 USB_DEVICE_ID_ZYTRONIC_ZXY100
) },
1174 /* Generic MT device */
1175 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_MULTITOUCH
, HID_ANY_ID
, HID_ANY_ID
) },
1178 MODULE_DEVICE_TABLE(hid
, mt_devices
);
1180 static const struct hid_usage_id mt_grabbed_usages
[] = {
1181 { HID_ANY_ID
, HID_ANY_ID
, HID_ANY_ID
},
1182 { HID_ANY_ID
- 1, HID_ANY_ID
- 1, HID_ANY_ID
- 1}
1185 static struct hid_driver mt_driver
= {
1186 .name
= "hid-multitouch",
1187 .id_table
= mt_devices
,
1189 .remove
= mt_remove
,
1190 .input_mapping
= mt_input_mapping
,
1191 .input_mapped
= mt_input_mapped
,
1192 .input_configured
= mt_input_configured
,
1193 .feature_mapping
= mt_feature_mapping
,
1194 .usage_table
= mt_grabbed_usages
,
1197 .reset_resume
= mt_reset_resume
,
1198 .resume
= mt_resume
,
1202 static int __init
mt_init(void)
1204 return hid_register_driver(&mt_driver
);
1207 static void __exit
mt_exit(void)
1209 hid_unregister_driver(&mt_driver
);
1212 module_init(mt_init
);
1213 module_exit(mt_exit
);