]>
Commit | Line | Data |
---|---|---|
5519cab4 BT |
1 | /* |
2 | * HID driver for multitouch panels | |
3 | * | |
c2ef8f21 | 4 | * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr> |
b0a78681 | 5 | * Copyright (c) 2010-2013 Benjamin Tissoires <benjamin.tissoires@gmail.com> |
c2ef8f21 | 6 | * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France |
b0a78681 | 7 | * Copyright (c) 2012-2013 Red Hat, Inc |
5519cab4 | 8 | * |
4875ac11 RN |
9 | * This code is partly based on hid-egalax.c: |
10 | * | |
11 | * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr> | |
12 | * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> | |
13 | * Copyright (c) 2010 Canonical, Ltd. | |
14 | * | |
f786bba4 BT |
15 | * This code is partly based on hid-3m-pct.c: |
16 | * | |
17 | * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr> | |
18 | * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> | |
19 | * Copyright (c) 2010 Canonical, Ltd. | |
20 | * | |
5519cab4 BT |
21 | */ |
22 | ||
23 | /* | |
24 | * This program is free software; you can redistribute it and/or modify it | |
25 | * under the terms of the GNU General Public License as published by the Free | |
26 | * Software Foundation; either version 2 of the License, or (at your option) | |
27 | * any later version. | |
28 | */ | |
29 | ||
b0a78681 BT |
30 | /* |
31 | * This driver is regularly tested thanks to the tool hid-test[1]. | |
32 | * This tool relies on hid-replay[2] and a database of hid devices[3]. | |
33 | * Please run these regression tests before patching this module so that | |
34 | * your patch won't break existing known devices. | |
35 | * | |
36 | * [1] https://github.com/bentiss/hid-test | |
37 | * [2] https://github.com/bentiss/hid-replay | |
38 | * [3] https://github.com/bentiss/hid-devices | |
39 | */ | |
40 | ||
5519cab4 BT |
41 | #include <linux/device.h> |
42 | #include <linux/hid.h> | |
43 | #include <linux/module.h> | |
44 | #include <linux/slab.h> | |
45 | #include <linux/usb.h> | |
46 | #include <linux/input/mt.h> | |
5519cab4 BT |
47 | |
48 | ||
49 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | |
ef2fafb3 | 50 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
5519cab4 BT |
51 | MODULE_DESCRIPTION("HID multitouch panels"); |
52 | MODULE_LICENSE("GPL"); | |
53 | ||
54 | #include "hid-ids.h" | |
55 | ||
56 | /* quirks to control the device */ | |
57 | #define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0) | |
58 | #define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1) | |
2d93666e | 59 | #define MT_QUIRK_CYPRESS (1 << 2) |
5572da08 | 60 | #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3) |
a062cc5a SC |
61 | #define MT_QUIRK_ALWAYS_VALID (1 << 4) |
62 | #define MT_QUIRK_VALID_IS_INRANGE (1 << 5) | |
63 | #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6) | |
a062cc5a | 64 | #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) |
77723e3b | 65 | #define MT_QUIRK_NO_AREA (1 << 9) |
28728399 | 66 | #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) |
9b3bb9b8 | 67 | #define MT_QUIRK_HOVERING (1 << 11) |
c2517f62 | 68 | #define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) |
5519cab4 BT |
69 | |
70 | struct mt_slot { | |
349fd670 | 71 | __s32 x, y, cx, cy, p, w, h; |
5519cab4 BT |
72 | __s32 contactid; /* the device ContactID assigned to this slot */ |
73 | bool touch_state; /* is the touch valid? */ | |
9b3bb9b8 | 74 | bool inrange_state; /* is the finger in proximity of the sensor? */ |
5519cab4 BT |
75 | }; |
76 | ||
eec29e3d BT |
77 | struct mt_class { |
78 | __s32 name; /* MT_CLS */ | |
79 | __s32 quirks; | |
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 */ | |
84 | __u8 maxcontacts; | |
c2ef8f21 | 85 | bool is_indirect; /* true for touchpads */ |
eec29e3d BT |
86 | }; |
87 | ||
3ac36d15 BT |
88 | struct mt_fields { |
89 | unsigned usages[HID_MAX_FIELDS]; | |
90 | unsigned int length; | |
91 | }; | |
92 | ||
5519cab4 BT |
93 | struct mt_device { |
94 | struct mt_slot curdata; /* placeholder of incoming data */ | |
eec29e3d | 95 | struct mt_class mtclass; /* our mt device class */ |
3ac36d15 BT |
96 | struct mt_fields *fields; /* temporary placeholder for storing the |
97 | multitouch fields */ | |
7e3cc447 BT |
98 | int cc_index; /* contact count field index in the report */ |
99 | int cc_value_index; /* contact count value index in the field */ | |
5519cab4 | 100 | unsigned last_slot_field; /* the last field of a slot */ |
55978fa9 | 101 | unsigned mt_report_id; /* the report ID of the multitouch device */ |
5519cab4 | 102 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ |
4aceed37 | 103 | __s8 inputmode_index; /* InputMode HID feature index in the report */ |
31ae9bdd BT |
104 | __s8 maxcontact_report_id; /* Maximum Contact Number HID feature, |
105 | -1 if non-existent */ | |
5519cab4 BT |
106 | __u8 num_received; /* how many contacts we received */ |
107 | __u8 num_expected; /* expected last contact index */ | |
9498f954 | 108 | __u8 maxcontacts; |
9e87f22a BT |
109 | __u8 touches_by_report; /* how many touches are present in one report: |
110 | * 1 means we should use a serial protocol | |
111 | * > 1 means hybrid (multitouch) protocol */ | |
76f5902a | 112 | bool serial_maybe; /* need to check for serial protocol */ |
5519cab4 | 113 | bool curvalid; /* is the current contact valid? */ |
76f5902a | 114 | unsigned mt_flags; /* flags to pass to input-mt */ |
5519cab4 BT |
115 | }; |
116 | ||
5519cab4 | 117 | /* classes of device behavior */ |
22408283 BT |
118 | #define MT_CLS_DEFAULT 0x0001 |
119 | ||
a062cc5a SC |
120 | #define MT_CLS_SERIAL 0x0002 |
121 | #define MT_CLS_CONFIDENCE 0x0003 | |
5e7ea11f BT |
122 | #define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004 |
123 | #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005 | |
124 | #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006 | |
125 | #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007 | |
126 | #define MT_CLS_DUAL_NSMU_CONTACTID 0x0008 | |
b7ea95ff | 127 | #define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 |
dc3e1d80 | 128 | #define MT_CLS_NSMU 0x000a |
efc16787 | 129 | #define MT_CLS_DUAL_CONTACT_NUMBER 0x0010 |
e325905c | 130 | #define MT_CLS_DUAL_CONTACT_ID 0x0011 |
22408283 BT |
131 | |
132 | /* vendor specific classes */ | |
133 | #define MT_CLS_3M 0x0101 | |
134 | #define MT_CLS_CYPRESS 0x0102 | |
135 | #define MT_CLS_EGALAX 0x0103 | |
1b723e8d | 136 | #define MT_CLS_EGALAX_SERIAL 0x0104 |
847672cd | 137 | #define MT_CLS_TOPSEED 0x0105 |
2258e863 | 138 | #define MT_CLS_PANASONIC 0x0106 |
77723e3b | 139 | #define MT_CLS_FLATFROG 0x0107 |
cdcd3ac4 JK |
140 | #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108 |
141 | #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109 | |
5519cab4 | 142 | |
9498f954 | 143 | #define MT_DEFAULT_MAXCONTACT 10 |
afbcb04c | 144 | #define MT_MAX_MAXCONTACT 250 |
9498f954 | 145 | |
2c2110e9 HR |
146 | #define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p) |
147 | #define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p) | |
148 | ||
5519cab4 BT |
149 | /* |
150 | * these device-dependent functions determine what slot corresponds | |
151 | * to a valid contact that was just read. | |
152 | */ | |
153 | ||
a3b5e577 BT |
154 | static int cypress_compute_slot(struct mt_device *td) |
155 | { | |
156 | if (td->curdata.contactid != 0 || td->num_received == 0) | |
157 | return td->curdata.contactid; | |
158 | else | |
159 | return -1; | |
160 | } | |
161 | ||
b3c21d2c | 162 | static struct mt_class mt_classes[] = { |
2d93666e | 163 | { .name = MT_CLS_DEFAULT, |
dc3e1d80 BT |
164 | .quirks = MT_QUIRK_ALWAYS_VALID | |
165 | MT_QUIRK_CONTACT_CNT_ACCURATE }, | |
166 | { .name = MT_CLS_NSMU, | |
9498f954 | 167 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP }, |
a062cc5a SC |
168 | { .name = MT_CLS_SERIAL, |
169 | .quirks = MT_QUIRK_ALWAYS_VALID}, | |
22408283 BT |
170 | { .name = MT_CLS_CONFIDENCE, |
171 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE }, | |
5e7ea11f BT |
172 | { .name = MT_CLS_CONFIDENCE_CONTACT_ID, |
173 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
174 | MT_QUIRK_SLOT_IS_CONTACTID }, | |
22408283 BT |
175 | { .name = MT_CLS_CONFIDENCE_MINUS_ONE, |
176 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
177 | MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE }, | |
1e9cf35b | 178 | { .name = MT_CLS_DUAL_INRANGE_CONTACTID, |
2d93666e BT |
179 | .quirks = MT_QUIRK_VALID_IS_INRANGE | |
180 | MT_QUIRK_SLOT_IS_CONTACTID, | |
181 | .maxcontacts = 2 }, | |
1e9cf35b | 182 | { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
2d93666e BT |
183 | .quirks = MT_QUIRK_VALID_IS_INRANGE | |
184 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | |
185 | .maxcontacts = 2 }, | |
22408283 BT |
186 | { .name = MT_CLS_DUAL_NSMU_CONTACTID, |
187 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
188 | MT_QUIRK_SLOT_IS_CONTACTID, | |
189 | .maxcontacts = 2 }, | |
b7ea95ff AT |
190 | { .name = MT_CLS_INRANGE_CONTACTNUMBER, |
191 | .quirks = MT_QUIRK_VALID_IS_INRANGE | | |
192 | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, | |
efc16787 BT |
193 | { .name = MT_CLS_DUAL_CONTACT_NUMBER, |
194 | .quirks = MT_QUIRK_ALWAYS_VALID | | |
195 | MT_QUIRK_CONTACT_CNT_ACCURATE | | |
196 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | |
197 | .maxcontacts = 2 }, | |
e325905c BT |
198 | { .name = MT_CLS_DUAL_CONTACT_ID, |
199 | .quirks = MT_QUIRK_ALWAYS_VALID | | |
200 | MT_QUIRK_CONTACT_CNT_ACCURATE | | |
201 | MT_QUIRK_SLOT_IS_CONTACTID, | |
202 | .maxcontacts = 2 }, | |
22408283 BT |
203 | |
204 | /* | |
205 | * vendor specific classes | |
206 | */ | |
207 | { .name = MT_CLS_3M, | |
208 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
209 | MT_QUIRK_SLOT_IS_CONTACTID, | |
210 | .sn_move = 2048, | |
211 | .sn_width = 128, | |
c5d40be5 HR |
212 | .sn_height = 128, |
213 | .maxcontacts = 60, | |
214 | }, | |
2d93666e BT |
215 | { .name = MT_CLS_CYPRESS, |
216 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
217 | MT_QUIRK_CYPRESS, | |
218 | .maxcontacts = 10 }, | |
4875ac11 RN |
219 | { .name = MT_CLS_EGALAX, |
220 | .quirks = MT_QUIRK_SLOT_IS_CONTACTID | | |
2261bb9f | 221 | MT_QUIRK_VALID_IS_INRANGE, |
4875ac11 RN |
222 | .sn_move = 4096, |
223 | .sn_pressure = 32, | |
224 | }, | |
1b723e8d BT |
225 | { .name = MT_CLS_EGALAX_SERIAL, |
226 | .quirks = MT_QUIRK_SLOT_IS_CONTACTID | | |
227 | MT_QUIRK_ALWAYS_VALID, | |
4875ac11 RN |
228 | .sn_move = 4096, |
229 | .sn_pressure = 32, | |
230 | }, | |
847672cd BT |
231 | { .name = MT_CLS_TOPSEED, |
232 | .quirks = MT_QUIRK_ALWAYS_VALID, | |
233 | .is_indirect = true, | |
234 | .maxcontacts = 2, | |
235 | }, | |
2258e863 DK |
236 | { .name = MT_CLS_PANASONIC, |
237 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP, | |
238 | .maxcontacts = 4 }, | |
f5ff4e1e XY |
239 | { .name = MT_CLS_GENERALTOUCH_TWOFINGERS, |
240 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
241 | MT_QUIRK_VALID_IS_INRANGE | | |
242 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | |
243 | .maxcontacts = 2 | |
244 | }, | |
245 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | |
246 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
58ad34bf | 247 | MT_QUIRK_SLOT_IS_CONTACTNUMBER |
f5ff4e1e | 248 | }, |
043b403a | 249 | |
77723e3b HR |
250 | { .name = MT_CLS_FLATFROG, |
251 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
252 | MT_QUIRK_NO_AREA, | |
253 | .sn_move = 2048, | |
254 | .maxcontacts = 40, | |
255 | }, | |
2d93666e | 256 | { } |
5519cab4 BT |
257 | }; |
258 | ||
eec29e3d BT |
259 | static ssize_t mt_show_quirks(struct device *dev, |
260 | struct device_attribute *attr, | |
261 | char *buf) | |
262 | { | |
263 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | |
264 | struct mt_device *td = hid_get_drvdata(hdev); | |
265 | ||
266 | return sprintf(buf, "%u\n", td->mtclass.quirks); | |
267 | } | |
268 | ||
269 | static ssize_t mt_set_quirks(struct device *dev, | |
270 | struct device_attribute *attr, | |
271 | const char *buf, size_t count) | |
272 | { | |
273 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | |
274 | struct mt_device *td = hid_get_drvdata(hdev); | |
275 | ||
276 | unsigned long val; | |
277 | ||
278 | if (kstrtoul(buf, 0, &val)) | |
279 | return -EINVAL; | |
280 | ||
281 | td->mtclass.quirks = val; | |
282 | ||
7e3cc447 | 283 | if (td->cc_index < 0) |
c2517f62 BT |
284 | td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
285 | ||
eec29e3d BT |
286 | return count; |
287 | } | |
288 | ||
289 | static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks); | |
290 | ||
291 | static struct attribute *sysfs_attrs[] = { | |
292 | &dev_attr_quirks.attr, | |
293 | NULL | |
294 | }; | |
295 | ||
296 | static struct attribute_group mt_attribute_group = { | |
297 | .attrs = sysfs_attrs | |
298 | }; | |
299 | ||
f635bd11 | 300 | static void mt_feature_mapping(struct hid_device *hdev, |
5519cab4 BT |
301 | struct hid_field *field, struct hid_usage *usage) |
302 | { | |
9498f954 | 303 | struct mt_device *td = hid_get_drvdata(hdev); |
4aceed37 | 304 | int i; |
9498f954 BT |
305 | |
306 | switch (usage->hid) { | |
307 | case HID_DG_INPUTMODE: | |
5519cab4 | 308 | td->inputmode = field->report->id; |
4aceed37 BT |
309 | td->inputmode_index = 0; /* has to be updated below */ |
310 | ||
311 | for (i=0; i < field->maxusage; i++) { | |
312 | if (field->usage[i].hid == usage->hid) { | |
313 | td->inputmode_index = i; | |
314 | break; | |
315 | } | |
316 | } | |
317 | ||
9498f954 BT |
318 | break; |
319 | case HID_DG_CONTACTMAX: | |
31ae9bdd | 320 | td->maxcontact_report_id = field->report->id; |
9498f954 | 321 | td->maxcontacts = field->value[0]; |
afbcb04c BT |
322 | if (!td->maxcontacts && |
323 | field->logical_maximum <= MT_MAX_MAXCONTACT) | |
324 | td->maxcontacts = field->logical_maximum; | |
eec29e3d | 325 | if (td->mtclass.maxcontacts) |
9498f954 | 326 | /* check if the maxcontacts is given by the class */ |
eec29e3d | 327 | td->maxcontacts = td->mtclass.maxcontacts; |
9498f954 BT |
328 | |
329 | break; | |
1b42fc4a BT |
330 | case 0xff0000c5: |
331 | if (field->report_count == 256 && field->report_size == 8) { | |
332 | /* Win 8 devices need special quirks */ | |
333 | __s32 *quirks = &td->mtclass.quirks; | |
334 | *quirks |= MT_QUIRK_ALWAYS_VALID; | |
335 | *quirks |= MT_QUIRK_IGNORE_DUPLICATES; | |
336 | *quirks |= MT_QUIRK_HOVERING; | |
c629dd7e | 337 | *quirks |= MT_QUIRK_CONTACT_CNT_ACCURATE; |
1b42fc4a BT |
338 | *quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP; |
339 | *quirks &= ~MT_QUIRK_VALID_IS_INRANGE; | |
340 | *quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE; | |
341 | } | |
342 | break; | |
5519cab4 BT |
343 | } |
344 | } | |
345 | ||
346 | static void set_abs(struct input_dev *input, unsigned int code, | |
347 | struct hid_field *field, int snratio) | |
348 | { | |
349 | int fmin = field->logical_minimum; | |
350 | int fmax = field->logical_maximum; | |
351 | int fuzz = snratio ? (fmax - fmin) / snratio : 0; | |
352 | input_set_abs_params(input, code, fmin, fmax, fuzz, 0); | |
37cf6e6f | 353 | input_abs_set_res(input, code, hidinput_calc_abs_res(field, code)); |
5519cab4 BT |
354 | } |
355 | ||
3ac36d15 | 356 | static void mt_store_field(struct hid_usage *usage, struct mt_device *td, |
ed9d5c96 BT |
357 | struct hid_input *hi) |
358 | { | |
3ac36d15 BT |
359 | struct mt_fields *f = td->fields; |
360 | ||
361 | if (f->length >= HID_MAX_FIELDS) | |
362 | return; | |
363 | ||
364 | f->usages[f->length++] = usage->hid; | |
ed9d5c96 BT |
365 | } |
366 | ||
5519cab4 BT |
367 | static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
368 | struct hid_field *field, struct hid_usage *usage, | |
369 | unsigned long **bit, int *max) | |
370 | { | |
371 | struct mt_device *td = hid_get_drvdata(hdev); | |
eec29e3d | 372 | struct mt_class *cls = &td->mtclass; |
c2ef8f21 | 373 | int code; |
349fd670 | 374 | struct hid_usage *prev_usage = NULL; |
4875ac11 | 375 | |
658d4aed | 376 | /* Only map fields from TouchScreen or TouchPad collections. |
2258e863 DK |
377 | * We need to ignore fields that belong to other collections |
378 | * such as Mouse that might have the same GenericDesktop usages. */ | |
658d4aed | 379 | if (field->application == HID_DG_TOUCHSCREEN) |
76f5902a | 380 | td->mt_flags |= INPUT_MT_DIRECT; |
c2ef8f21 | 381 | else if (field->application != HID_DG_TOUCHPAD) |
658d4aed JB |
382 | return 0; |
383 | ||
76f5902a HR |
384 | /* |
385 | * Model touchscreens providing buttons as touchpads. | |
c2ef8f21 BT |
386 | */ |
387 | if (field->application == HID_DG_TOUCHPAD || | |
76f5902a HR |
388 | (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) |
389 | td->mt_flags |= INPUT_MT_POINTER; | |
c2ef8f21 | 390 | |
2261bb9f BT |
391 | /* eGalax devices provide a Digitizer.Stylus input which overrides |
392 | * the correct Digitizers.Finger X/Y ranges. | |
393 | * Let's just ignore this input. */ | |
394 | if (field->physical == HID_DG_STYLUS) | |
395 | return -1; | |
396 | ||
349fd670 BT |
397 | if (usage->usage_index) |
398 | prev_usage = &field->usage[usage->usage_index - 1]; | |
399 | ||
5519cab4 BT |
400 | switch (usage->hid & HID_USAGE_PAGE) { |
401 | ||
402 | case HID_UP_GENDESK: | |
403 | switch (usage->hid) { | |
404 | case HID_GD_X: | |
349fd670 BT |
405 | if (prev_usage && (prev_usage->hid == usage->hid)) { |
406 | hid_map_usage(hi, usage, bit, max, | |
407 | EV_ABS, ABS_MT_TOOL_X); | |
408 | set_abs(hi->input, ABS_MT_TOOL_X, field, | |
409 | cls->sn_move); | |
410 | } else { | |
411 | hid_map_usage(hi, usage, bit, max, | |
5519cab4 | 412 | EV_ABS, ABS_MT_POSITION_X); |
349fd670 BT |
413 | set_abs(hi->input, ABS_MT_POSITION_X, field, |
414 | cls->sn_move); | |
415 | } | |
416 | ||
3ac36d15 | 417 | mt_store_field(usage, td, hi); |
5519cab4 BT |
418 | return 1; |
419 | case HID_GD_Y: | |
349fd670 BT |
420 | if (prev_usage && (prev_usage->hid == usage->hid)) { |
421 | hid_map_usage(hi, usage, bit, max, | |
422 | EV_ABS, ABS_MT_TOOL_Y); | |
423 | set_abs(hi->input, ABS_MT_TOOL_Y, field, | |
424 | cls->sn_move); | |
425 | } else { | |
426 | hid_map_usage(hi, usage, bit, max, | |
5519cab4 | 427 | EV_ABS, ABS_MT_POSITION_Y); |
349fd670 BT |
428 | set_abs(hi->input, ABS_MT_POSITION_Y, field, |
429 | cls->sn_move); | |
430 | } | |
431 | ||
3ac36d15 | 432 | mt_store_field(usage, td, hi); |
5519cab4 BT |
433 | return 1; |
434 | } | |
435 | return 0; | |
436 | ||
437 | case HID_UP_DIGITIZER: | |
438 | switch (usage->hid) { | |
439 | case HID_DG_INRANGE: | |
9b3bb9b8 BT |
440 | if (cls->quirks & MT_QUIRK_HOVERING) { |
441 | hid_map_usage(hi, usage, bit, max, | |
442 | EV_ABS, ABS_MT_DISTANCE); | |
443 | input_set_abs_params(hi->input, | |
444 | ABS_MT_DISTANCE, 0, 1, 0, 0); | |
445 | } | |
3ac36d15 | 446 | mt_store_field(usage, td, hi); |
5519cab4 BT |
447 | return 1; |
448 | case HID_DG_CONFIDENCE: | |
3ac36d15 | 449 | mt_store_field(usage, td, hi); |
5519cab4 BT |
450 | return 1; |
451 | case HID_DG_TIPSWITCH: | |
452 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | |
453 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); | |
3ac36d15 | 454 | mt_store_field(usage, td, hi); |
5519cab4 BT |
455 | return 1; |
456 | case HID_DG_CONTACTID: | |
3ac36d15 | 457 | mt_store_field(usage, td, hi); |
9e87f22a | 458 | td->touches_by_report++; |
55978fa9 | 459 | td->mt_report_id = field->report->id; |
5519cab4 BT |
460 | return 1; |
461 | case HID_DG_WIDTH: | |
462 | hid_map_usage(hi, usage, bit, max, | |
463 | EV_ABS, ABS_MT_TOUCH_MAJOR); | |
77723e3b HR |
464 | if (!(cls->quirks & MT_QUIRK_NO_AREA)) |
465 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, | |
466 | cls->sn_width); | |
3ac36d15 | 467 | mt_store_field(usage, td, hi); |
5519cab4 BT |
468 | return 1; |
469 | case HID_DG_HEIGHT: | |
470 | hid_map_usage(hi, usage, bit, max, | |
471 | EV_ABS, ABS_MT_TOUCH_MINOR); | |
77723e3b HR |
472 | if (!(cls->quirks & MT_QUIRK_NO_AREA)) { |
473 | set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, | |
474 | cls->sn_height); | |
475 | input_set_abs_params(hi->input, | |
1e648a13 | 476 | ABS_MT_ORIENTATION, 0, 1, 0, 0); |
77723e3b | 477 | } |
3ac36d15 | 478 | mt_store_field(usage, td, hi); |
5519cab4 BT |
479 | return 1; |
480 | case HID_DG_TIPPRESSURE: | |
481 | hid_map_usage(hi, usage, bit, max, | |
482 | EV_ABS, ABS_MT_PRESSURE); | |
483 | set_abs(hi->input, ABS_MT_PRESSURE, field, | |
484 | cls->sn_pressure); | |
3ac36d15 | 485 | mt_store_field(usage, td, hi); |
5519cab4 BT |
486 | return 1; |
487 | case HID_DG_CONTACTCOUNT: | |
7e3cc447 BT |
488 | td->cc_index = field->index; |
489 | td->cc_value_index = usage->usage_index; | |
5519cab4 BT |
490 | return 1; |
491 | case HID_DG_CONTACTMAX: | |
492 | /* we don't set td->last_slot_field as contactcount and | |
493 | * contact max are global to the report */ | |
494 | return -1; | |
c2ef8f21 BT |
495 | case HID_DG_TOUCH: |
496 | /* Legacy devices use TIPSWITCH and not TOUCH. | |
497 | * Let's just ignore this field. */ | |
498 | return -1; | |
65b258e9 | 499 | } |
5519cab4 BT |
500 | /* let hid-input decide for the others */ |
501 | return 0; | |
502 | ||
c2ef8f21 BT |
503 | case HID_UP_BUTTON: |
504 | code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE); | |
505 | hid_map_usage(hi, usage, bit, max, EV_KEY, code); | |
506 | input_set_capability(hi->input, EV_KEY, code); | |
507 | return 1; | |
508 | ||
5519cab4 BT |
509 | case 0xff000000: |
510 | /* we do not want to map these: no input-oriented meaning */ | |
511 | return -1; | |
512 | } | |
513 | ||
514 | return 0; | |
515 | } | |
516 | ||
517 | static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, | |
518 | struct hid_field *field, struct hid_usage *usage, | |
519 | unsigned long **bit, int *max) | |
520 | { | |
521 | if (usage->type == EV_KEY || usage->type == EV_ABS) | |
522 | set_bit(usage->type, hi->input->evbit); | |
523 | ||
524 | return -1; | |
525 | } | |
526 | ||
3e1b5015 | 527 | static int mt_compute_slot(struct mt_device *td, struct input_dev *input) |
5519cab4 | 528 | { |
eec29e3d | 529 | __s32 quirks = td->mtclass.quirks; |
5519cab4 | 530 | |
2d93666e BT |
531 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTID) |
532 | return td->curdata.contactid; | |
5519cab4 | 533 | |
2d93666e | 534 | if (quirks & MT_QUIRK_CYPRESS) |
a3b5e577 BT |
535 | return cypress_compute_slot(td); |
536 | ||
2d93666e BT |
537 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER) |
538 | return td->num_received; | |
5572da08 | 539 | |
4a6ee685 BT |
540 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE) |
541 | return td->curdata.contactid - 1; | |
542 | ||
3e1b5015 | 543 | return input_mt_get_slot_by_key(input, td->curdata.contactid); |
5519cab4 BT |
544 | } |
545 | ||
546 | /* | |
547 | * this function is called when a whole contact has been processed, | |
548 | * so that it can assign it to a slot and store the data there | |
549 | */ | |
3e1b5015 | 550 | static void mt_complete_slot(struct mt_device *td, struct input_dev *input) |
5519cab4 | 551 | { |
c2517f62 BT |
552 | if ((td->mtclass.quirks & MT_QUIRK_CONTACT_CNT_ACCURATE) && |
553 | td->num_received >= td->num_expected) | |
554 | return; | |
555 | ||
20b60e6d | 556 | if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { |
3e1b5015 HR |
557 | int slotnum = mt_compute_slot(td, input); |
558 | struct mt_slot *s = &td->curdata; | |
28728399 | 559 | struct input_mt *mt = input->mt; |
5519cab4 | 560 | |
3e1b5015 HR |
561 | if (slotnum < 0 || slotnum >= td->maxcontacts) |
562 | return; | |
5519cab4 | 563 | |
28728399 BT |
564 | if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { |
565 | struct input_mt_slot *slot = &mt->slots[slotnum]; | |
566 | if (input_mt_is_active(slot) && | |
567 | input_mt_is_used(mt, slot)) | |
568 | return; | |
569 | } | |
570 | ||
3e1b5015 | 571 | input_mt_slot(input, slotnum); |
5519cab4 | 572 | input_mt_report_slot_state(input, MT_TOOL_FINGER, |
9b3bb9b8 BT |
573 | s->touch_state || s->inrange_state); |
574 | if (s->touch_state || s->inrange_state) { | |
575 | /* this finger is in proximity of the sensor */ | |
f786bba4 BT |
576 | int wide = (s->w > s->h); |
577 | /* divided by two to match visual scale of touch */ | |
578 | int major = max(s->w, s->h) >> 1; | |
579 | int minor = min(s->w, s->h) >> 1; | |
580 | ||
2d93666e BT |
581 | input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); |
582 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y); | |
349fd670 BT |
583 | input_event(input, EV_ABS, ABS_MT_TOOL_X, s->cx); |
584 | input_event(input, EV_ABS, ABS_MT_TOOL_Y, s->cy); | |
9b3bb9b8 BT |
585 | input_event(input, EV_ABS, ABS_MT_DISTANCE, |
586 | !s->touch_state); | |
f786bba4 | 587 | input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); |
2d93666e | 588 | input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p); |
f786bba4 BT |
589 | input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); |
590 | input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); | |
2d93666e | 591 | } |
5519cab4 BT |
592 | } |
593 | ||
3e1b5015 HR |
594 | td->num_received++; |
595 | } | |
596 | ||
597 | /* | |
598 | * this function is called when a whole packet has been received and processed, | |
599 | * so that it can decide what to send to the input layer. | |
600 | */ | |
601 | static void mt_sync_frame(struct mt_device *td, struct input_dev *input) | |
602 | { | |
76f5902a | 603 | input_mt_sync_frame(input); |
5519cab4 BT |
604 | input_sync(input); |
605 | td->num_received = 0; | |
606 | } | |
607 | ||
5519cab4 BT |
608 | static int mt_event(struct hid_device *hid, struct hid_field *field, |
609 | struct hid_usage *usage, __s32 value) | |
55978fa9 BT |
610 | { |
611 | /* we will handle the hidinput part later, now remains hiddev */ | |
612 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | |
613 | hid->hiddev_hid_event(hid, field, usage, value); | |
614 | ||
615 | return 1; | |
616 | } | |
617 | ||
618 | static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |
619 | struct hid_usage *usage, __s32 value) | |
5519cab4 BT |
620 | { |
621 | struct mt_device *td = hid_get_drvdata(hid); | |
eec29e3d | 622 | __s32 quirks = td->mtclass.quirks; |
5519cab4 | 623 | |
3e1b5015 | 624 | if (hid->claimed & HID_CLAIMED_INPUT) { |
5519cab4 BT |
625 | switch (usage->hid) { |
626 | case HID_DG_INRANGE: | |
20b60e6d | 627 | if (quirks & MT_QUIRK_VALID_IS_INRANGE) |
2d93666e | 628 | td->curvalid = value; |
9b3bb9b8 BT |
629 | if (quirks & MT_QUIRK_HOVERING) |
630 | td->curdata.inrange_state = value; | |
5519cab4 BT |
631 | break; |
632 | case HID_DG_TIPSWITCH: | |
2d93666e BT |
633 | if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) |
634 | td->curvalid = value; | |
5519cab4 BT |
635 | td->curdata.touch_state = value; |
636 | break; | |
637 | case HID_DG_CONFIDENCE: | |
2d93666e BT |
638 | if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) |
639 | td->curvalid = value; | |
5519cab4 BT |
640 | break; |
641 | case HID_DG_CONTACTID: | |
642 | td->curdata.contactid = value; | |
643 | break; | |
644 | case HID_DG_TIPPRESSURE: | |
645 | td->curdata.p = value; | |
646 | break; | |
647 | case HID_GD_X: | |
349fd670 BT |
648 | if (usage->code == ABS_MT_TOOL_X) |
649 | td->curdata.cx = value; | |
650 | else | |
651 | td->curdata.x = value; | |
5519cab4 BT |
652 | break; |
653 | case HID_GD_Y: | |
349fd670 BT |
654 | if (usage->code == ABS_MT_TOOL_Y) |
655 | td->curdata.cy = value; | |
656 | else | |
657 | td->curdata.y = value; | |
5519cab4 BT |
658 | break; |
659 | case HID_DG_WIDTH: | |
660 | td->curdata.w = value; | |
661 | break; | |
662 | case HID_DG_HEIGHT: | |
663 | td->curdata.h = value; | |
664 | break; | |
665 | case HID_DG_CONTACTCOUNT: | |
5519cab4 | 666 | break; |
c2ef8f21 BT |
667 | case HID_DG_TOUCH: |
668 | /* do nothing */ | |
669 | break; | |
5519cab4 BT |
670 | |
671 | default: | |
55978fa9 | 672 | return; |
5519cab4 | 673 | } |
5519cab4 | 674 | |
54f4c0c3 BT |
675 | if (usage->usage_index + 1 == field->report_count) { |
676 | /* we only take into account the last report. */ | |
677 | if (usage->hid == td->last_slot_field) | |
678 | mt_complete_slot(td, field->hidinput->input); | |
54f4c0c3 | 679 | } |
5519cab4 | 680 | |
2d93666e | 681 | } |
55978fa9 | 682 | } |
5519cab4 | 683 | |
55978fa9 BT |
684 | static void mt_report(struct hid_device *hid, struct hid_report *report) |
685 | { | |
686 | struct mt_device *td = hid_get_drvdata(hid); | |
687 | struct hid_field *field; | |
688 | unsigned count; | |
689 | int r, n; | |
5519cab4 | 690 | |
55978fa9 BT |
691 | if (report->id != td->mt_report_id) |
692 | return; | |
693 | ||
694 | if (!(hid->claimed & HID_CLAIMED_INPUT)) | |
695 | return; | |
696 | ||
c2517f62 BT |
697 | /* |
698 | * Includes multi-packet support where subsequent | |
699 | * packets are sent with zero contactcount. | |
700 | */ | |
7e3cc447 BT |
701 | if (td->cc_index >= 0) { |
702 | struct hid_field *field = report->field[td->cc_index]; | |
703 | int value = field->value[td->cc_value_index]; | |
704 | if (value) | |
705 | td->num_expected = value; | |
706 | } | |
c2517f62 | 707 | |
55978fa9 BT |
708 | for (r = 0; r < report->maxfield; r++) { |
709 | field = report->field[r]; | |
710 | count = field->report_count; | |
711 | ||
712 | if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) | |
713 | continue; | |
714 | ||
715 | for (n = 0; n < count; n++) | |
716 | mt_process_mt_event(hid, field, &field->usage[n], | |
717 | field->value[n]); | |
718 | } | |
5b62efd8 BT |
719 | |
720 | if (td->num_received >= td->num_expected) | |
721 | mt_sync_frame(td, report->field[0]->hidinput->input); | |
5519cab4 BT |
722 | } |
723 | ||
724 | static void mt_set_input_mode(struct hid_device *hdev) | |
725 | { | |
726 | struct mt_device *td = hid_get_drvdata(hdev); | |
727 | struct hid_report *r; | |
728 | struct hid_report_enum *re; | |
729 | ||
730 | if (td->inputmode < 0) | |
731 | return; | |
732 | ||
733 | re = &(hdev->report_enum[HID_FEATURE_REPORT]); | |
734 | r = re->report_id_hash[td->inputmode]; | |
735 | if (r) { | |
4aceed37 | 736 | r->field[0]->value[td->inputmode_index] = 0x02; |
d8814272 | 737 | hid_hw_request(hdev, r, HID_REQ_SET_REPORT); |
5519cab4 BT |
738 | } |
739 | } | |
740 | ||
31ae9bdd BT |
741 | static void mt_set_maxcontacts(struct hid_device *hdev) |
742 | { | |
743 | struct mt_device *td = hid_get_drvdata(hdev); | |
744 | struct hid_report *r; | |
745 | struct hid_report_enum *re; | |
746 | int fieldmax, max; | |
747 | ||
748 | if (td->maxcontact_report_id < 0) | |
749 | return; | |
750 | ||
751 | if (!td->mtclass.maxcontacts) | |
752 | return; | |
753 | ||
754 | re = &hdev->report_enum[HID_FEATURE_REPORT]; | |
755 | r = re->report_id_hash[td->maxcontact_report_id]; | |
756 | if (r) { | |
757 | max = td->mtclass.maxcontacts; | |
758 | fieldmax = r->field[0]->logical_maximum; | |
759 | max = min(fieldmax, max); | |
760 | if (r->field[0]->value[0] != max) { | |
761 | r->field[0]->value[0] = max; | |
d8814272 | 762 | hid_hw_request(hdev, r, HID_REQ_SET_REPORT); |
31ae9bdd BT |
763 | } |
764 | } | |
765 | } | |
766 | ||
4fa3a583 HR |
767 | static void mt_post_parse_default_settings(struct mt_device *td) |
768 | { | |
769 | __s32 quirks = td->mtclass.quirks; | |
770 | ||
771 | /* unknown serial device needs special quirks */ | |
772 | if (td->touches_by_report == 1) { | |
773 | quirks |= MT_QUIRK_ALWAYS_VALID; | |
774 | quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP; | |
775 | quirks &= ~MT_QUIRK_VALID_IS_INRANGE; | |
776 | quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE; | |
e0bb8f9a | 777 | quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
4fa3a583 HR |
778 | } |
779 | ||
780 | td->mtclass.quirks = quirks; | |
781 | } | |
782 | ||
3ac36d15 BT |
783 | static void mt_post_parse(struct mt_device *td) |
784 | { | |
785 | struct mt_fields *f = td->fields; | |
c2517f62 | 786 | struct mt_class *cls = &td->mtclass; |
3ac36d15 BT |
787 | |
788 | if (td->touches_by_report > 0) { | |
789 | int field_count_per_touch = f->length / td->touches_by_report; | |
790 | td->last_slot_field = f->usages[field_count_per_touch - 1]; | |
791 | } | |
c2517f62 | 792 | |
7e3cc447 | 793 | if (td->cc_index < 0) |
c2517f62 | 794 | cls->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
3ac36d15 BT |
795 | } |
796 | ||
76f5902a HR |
797 | static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi) |
798 | ||
799 | { | |
800 | struct mt_device *td = hid_get_drvdata(hdev); | |
801 | struct mt_class *cls = &td->mtclass; | |
802 | struct input_dev *input = hi->input; | |
803 | ||
804 | /* Only initialize slots for MT input devices */ | |
805 | if (!test_bit(ABS_MT_POSITION_X, input->absbit)) | |
806 | return; | |
807 | ||
808 | if (!td->maxcontacts) | |
809 | td->maxcontacts = MT_DEFAULT_MAXCONTACT; | |
810 | ||
811 | mt_post_parse(td); | |
812 | if (td->serial_maybe) | |
813 | mt_post_parse_default_settings(td); | |
814 | ||
815 | if (cls->is_indirect) | |
816 | td->mt_flags |= INPUT_MT_POINTER; | |
817 | ||
3e1b5015 HR |
818 | if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) |
819 | td->mt_flags |= INPUT_MT_DROP_UNUSED; | |
820 | ||
76f5902a HR |
821 | input_mt_init_slots(input, td->maxcontacts, td->mt_flags); |
822 | ||
823 | td->mt_flags = 0; | |
824 | } | |
825 | ||
5519cab4 BT |
826 | static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) |
827 | { | |
2d93666e | 828 | int ret, i; |
5519cab4 | 829 | struct mt_device *td; |
2d93666e BT |
830 | struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ |
831 | ||
94b5485c HR |
832 | for (i = 0; mt_classes[i].name ; i++) { |
833 | if (id->driver_data == mt_classes[i].name) { | |
834 | mtclass = &(mt_classes[i]); | |
835 | break; | |
2d93666e BT |
836 | } |
837 | } | |
5519cab4 | 838 | |
d682bd7f HR |
839 | /* This allows the driver to correctly support devices |
840 | * that emit events over several HID messages. | |
841 | */ | |
842 | hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; | |
5519cab4 | 843 | |
9498f954 | 844 | td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); |
5519cab4 BT |
845 | if (!td) { |
846 | dev_err(&hdev->dev, "cannot allocate multitouch data\n"); | |
847 | return -ENOMEM; | |
848 | } | |
eec29e3d | 849 | td->mtclass = *mtclass; |
5519cab4 | 850 | td->inputmode = -1; |
31ae9bdd | 851 | td->maxcontact_report_id = -1; |
7e3cc447 | 852 | td->cc_index = -1; |
5519cab4 BT |
853 | hid_set_drvdata(hdev, td); |
854 | ||
3ac36d15 BT |
855 | td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL); |
856 | if (!td->fields) { | |
857 | dev_err(&hdev->dev, "cannot allocate multitouch fields data\n"); | |
858 | ret = -ENOMEM; | |
859 | goto fail; | |
860 | } | |
861 | ||
76f5902a HR |
862 | if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID) |
863 | td->serial_maybe = true; | |
864 | ||
5519cab4 BT |
865 | ret = hid_parse(hdev); |
866 | if (ret != 0) | |
867 | goto fail; | |
868 | ||
869 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | |
2d93666e | 870 | if (ret) |
5519cab4 BT |
871 | goto fail; |
872 | ||
eec29e3d BT |
873 | ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); |
874 | ||
31ae9bdd | 875 | mt_set_maxcontacts(hdev); |
5519cab4 BT |
876 | mt_set_input_mode(hdev); |
877 | ||
3ac36d15 BT |
878 | kfree(td->fields); |
879 | td->fields = NULL; | |
880 | ||
5519cab4 BT |
881 | return 0; |
882 | ||
883 | fail: | |
3ac36d15 | 884 | kfree(td->fields); |
5519cab4 BT |
885 | kfree(td); |
886 | return ret; | |
887 | } | |
888 | ||
889 | #ifdef CONFIG_PM | |
890 | static int mt_reset_resume(struct hid_device *hdev) | |
891 | { | |
31ae9bdd | 892 | mt_set_maxcontacts(hdev); |
5519cab4 BT |
893 | mt_set_input_mode(hdev); |
894 | return 0; | |
895 | } | |
dfeefd10 SL |
896 | |
897 | static int mt_resume(struct hid_device *hdev) | |
898 | { | |
dfeefd10 SL |
899 | /* Some Elan legacy devices require SET_IDLE to be set on resume. |
900 | * It should be safe to send it to other devices too. | |
901 | * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */ | |
902 | ||
4ba25d3f | 903 | hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE); |
dfeefd10 SL |
904 | |
905 | return 0; | |
906 | } | |
5519cab4 BT |
907 | #endif |
908 | ||
909 | static void mt_remove(struct hid_device *hdev) | |
910 | { | |
911 | struct mt_device *td = hid_get_drvdata(hdev); | |
eec29e3d | 912 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); |
5519cab4 BT |
913 | hid_hw_stop(hdev); |
914 | kfree(td); | |
915 | hid_set_drvdata(hdev, NULL); | |
916 | } | |
917 | ||
918 | static const struct hid_device_id mt_devices[] = { | |
919 | ||
f786bba4 BT |
920 | /* 3M panels */ |
921 | { .driver_data = MT_CLS_3M, | |
2c2110e9 | 922 | MT_USB_DEVICE(USB_VENDOR_ID_3M, |
f786bba4 BT |
923 | USB_DEVICE_ID_3M1968) }, |
924 | { .driver_data = MT_CLS_3M, | |
2c2110e9 | 925 | MT_USB_DEVICE(USB_VENDOR_ID_3M, |
f786bba4 | 926 | USB_DEVICE_ID_3M2256) }, |
c4fad877 | 927 | { .driver_data = MT_CLS_3M, |
2c2110e9 | 928 | MT_USB_DEVICE(USB_VENDOR_ID_3M, |
c4fad877 | 929 | USB_DEVICE_ID_3M3266) }, |
f786bba4 | 930 | |
e6aac342 | 931 | /* ActionStar panels */ |
dc3e1d80 | 932 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 933 | MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, |
e6aac342 BT |
934 | USB_DEVICE_ID_ACTIONSTAR_1011) }, |
935 | ||
b1057124 BT |
936 | /* Atmel panels */ |
937 | { .driver_data = MT_CLS_SERIAL, | |
2c2110e9 | 938 | MT_USB_DEVICE(USB_VENDOR_ID_ATMEL, |
b1057124 | 939 | USB_DEVICE_ID_ATMEL_MULTITOUCH) }, |
841cb157 | 940 | { .driver_data = MT_CLS_SERIAL, |
2c2110e9 | 941 | MT_USB_DEVICE(USB_VENDOR_ID_ATMEL, |
841cb157 | 942 | USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) }, |
b1057124 | 943 | |
9ed32695 | 944 | /* Baanto multitouch devices */ |
dc3e1d80 | 945 | { .driver_data = MT_CLS_NSMU, |
16b79bb8 | 946 | MT_USB_DEVICE(USB_VENDOR_ID_BAANTO, |
9ed32695 | 947 | USB_DEVICE_ID_BAANTO_MT_190W2) }, |
a841b62c BT |
948 | /* Cando panels */ |
949 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 950 | MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c | 951 | USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
efc16787 | 952 | { .driver_data = MT_CLS_DUAL_CONTACT_NUMBER, |
2c2110e9 | 953 | MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c BT |
954 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, |
955 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 956 | MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c BT |
957 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, |
958 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 959 | MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c BT |
960 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, |
961 | ||
942fd422 | 962 | /* Chunghwa Telecom touch panels */ |
dc3e1d80 | 963 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 964 | MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, |
942fd422 AZ |
965 | USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, |
966 | ||
79603dc9 | 967 | /* CVTouch panels */ |
dc3e1d80 | 968 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 969 | MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, |
79603dc9 BT |
970 | USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
971 | ||
a3b5e577 BT |
972 | /* Cypress panel */ |
973 | { .driver_data = MT_CLS_CYPRESS, | |
974 | HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, | |
975 | USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, | |
976 | ||
22408283 | 977 | /* eGalax devices (resistive) */ |
e36f690b | 978 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 979 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b BT |
980 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, |
981 | { .driver_data = MT_CLS_EGALAX, | |
2c2110e9 | 982 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 983 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, |
22408283 BT |
984 | |
985 | /* eGalax devices (capacitive) */ | |
e36f690b | 986 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 987 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 988 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, |
fd1d1525 | 989 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 990 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 BT |
991 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) }, |
992 | { .driver_data = MT_CLS_EGALAX_SERIAL, | |
2c2110e9 | 993 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 BT |
994 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) }, |
995 | { .driver_data = MT_CLS_EGALAX_SERIAL, | |
2c2110e9 | 996 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 | 997 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) }, |
2ce09df4 | 998 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 999 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
2ce09df4 | 1000 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) }, |
e36f690b | 1001 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 1002 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 1003 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, |
fd1d1525 | 1004 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 1005 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 | 1006 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) }, |
e36f690b | 1007 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 1008 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 1009 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, |
fd1d1525 | 1010 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 1011 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 | 1012 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) }, |
66f06127 | 1013 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 1014 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
66f06127 | 1015 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, |
bb9ff210 | 1016 | { .driver_data = MT_CLS_EGALAX, |
2c2110e9 | 1017 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
bb9ff210 | 1018 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, |
fd1d1525 | 1019 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 1020 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d1525 | 1021 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) }, |
1b723e8d | 1022 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
ae01c9e5 TR |
1023 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
1024 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7) }, | |
1b723e8d | 1025 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e9 | 1026 | MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 1027 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, |
3d77104a JK |
1028 | { .driver_data = MT_CLS_EGALAX, |
1029 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, | |
1030 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) }, | |
1031 | { .driver_data = MT_CLS_EGALAX, | |
1032 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, | |
1033 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0) }, | |
1034 | { .driver_data = MT_CLS_EGALAX, | |
1035 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, | |
1036 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4) }, | |
22408283 | 1037 | |
c04abeef | 1038 | /* Elo TouchSystems IntelliTouch Plus panel */ |
e325905c | 1039 | { .driver_data = MT_CLS_DUAL_CONTACT_ID, |
2c2110e9 | 1040 | MT_USB_DEVICE(USB_VENDOR_ID_ELO, |
c04abeef BT |
1041 | USB_DEVICE_ID_ELO_TS2515) }, |
1042 | ||
77723e3b HR |
1043 | /* Flatfrog Panels */ |
1044 | { .driver_data = MT_CLS_FLATFROG, | |
1045 | MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG, | |
1046 | USB_DEVICE_ID_MULTITOUCH_3200) }, | |
1047 | ||
5572da08 | 1048 | /* GeneralTouch panel */ |
f5ff4e1e | 1049 | { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, |
2c2110e9 | 1050 | MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
5572da08 | 1051 | USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, |
f5ff4e1e XY |
1052 | { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
1053 | MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | |
1054 | USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) }, | |
5572da08 | 1055 | |
4d5df5d1 | 1056 | /* Gametel game controller */ |
dc3e1d80 | 1057 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1058 | MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL, |
4d5df5d1 AN |
1059 | USB_DEVICE_ID_GAMETEL_MT_MODE) }, |
1060 | ||
ee0fbd14 | 1061 | /* GoodTouch panels */ |
dc3e1d80 | 1062 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1063 | MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, |
ee0fbd14 BT |
1064 | USB_DEVICE_ID_GOODTOUCH_000f) }, |
1065 | ||
54580365 BT |
1066 | /* Hanvon panels */ |
1067 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, | |
2c2110e9 | 1068 | MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, |
54580365 BT |
1069 | USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, |
1070 | ||
a062cc5a SC |
1071 | /* Ideacom panel */ |
1072 | { .driver_data = MT_CLS_SERIAL, | |
2c2110e9 | 1073 | MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM, |
a062cc5a | 1074 | USB_DEVICE_ID_IDEACOM_IDC6650) }, |
71078b0d | 1075 | { .driver_data = MT_CLS_SERIAL, |
2c2110e9 | 1076 | MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM, |
71078b0d | 1077 | USB_DEVICE_ID_IDEACOM_IDC6651) }, |
a062cc5a | 1078 | |
4e61f0d7 | 1079 | /* Ilitek dual touch panel */ |
dc3e1d80 | 1080 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1081 | MT_USB_DEVICE(USB_VENDOR_ID_ILITEK, |
4e61f0d7 AZ |
1082 | USB_DEVICE_ID_ILITEK_MULTITOUCH) }, |
1083 | ||
4dfcced8 BT |
1084 | /* IRTOUCH panels */ |
1085 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, | |
2c2110e9 | 1086 | MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, |
4dfcced8 BT |
1087 | USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, |
1088 | ||
c50bb1a4 JB |
1089 | /* LG Display panels */ |
1090 | { .driver_data = MT_CLS_DEFAULT, | |
2c2110e9 | 1091 | MT_USB_DEVICE(USB_VENDOR_ID_LG, |
c50bb1a4 JB |
1092 | USB_DEVICE_ID_LG_MULTITOUCH) }, |
1093 | ||
df167c4a BT |
1094 | /* Lumio panels */ |
1095 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
2c2110e9 | 1096 | MT_USB_DEVICE(USB_VENDOR_ID_LUMIO, |
df167c4a | 1097 | USB_DEVICE_ID_CRYSTALTOUCH) }, |
c3ead6de | 1098 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, |
2c2110e9 | 1099 | MT_USB_DEVICE(USB_VENDOR_ID_LUMIO, |
c3ead6de | 1100 | USB_DEVICE_ID_CRYSTALTOUCH_DUAL) }, |
df167c4a | 1101 | |
4a6ee685 BT |
1102 | /* MosArt panels */ |
1103 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
2c2110e9 | 1104 | MT_USB_DEVICE(USB_VENDOR_ID_ASUS, |
4a6ee685 BT |
1105 | USB_DEVICE_ID_ASUS_T91MT)}, |
1106 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
2c2110e9 | 1107 | MT_USB_DEVICE(USB_VENDOR_ID_ASUS, |
4a6ee685 BT |
1108 | USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, |
1109 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
2c2110e9 | 1110 | MT_USB_DEVICE(USB_VENDOR_ID_TURBOX, |
4a6ee685 BT |
1111 | USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, |
1112 | ||
c2517f62 | 1113 | /* Nexio panels */ |
dc3e1d80 | 1114 | { .driver_data = MT_CLS_DEFAULT, |
c2517f62 BT |
1115 | MT_USB_DEVICE(USB_VENDOR_ID_NEXIO, |
1116 | USB_DEVICE_ID_NEXIO_MULTITOUCH_420)}, | |
1117 | ||
2258e863 DK |
1118 | /* Panasonic panels */ |
1119 | { .driver_data = MT_CLS_PANASONIC, | |
2c2110e9 | 1120 | MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, |
2258e863 DK |
1121 | USB_DEVICE_ID_PANABOARD_UBT780) }, |
1122 | { .driver_data = MT_CLS_PANASONIC, | |
2c2110e9 | 1123 | MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, |
2258e863 DK |
1124 | USB_DEVICE_ID_PANABOARD_UBT880) }, |
1125 | ||
4db703ea | 1126 | /* Novatek Panel */ |
dc3e1d80 | 1127 | { .driver_data = MT_CLS_NSMU, |
4380d819 | 1128 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, |
4db703ea AH |
1129 | USB_DEVICE_ID_NOVATEK_PCT) }, |
1130 | ||
6ab3a9a6 JS |
1131 | /* PenMount panels */ |
1132 | { .driver_data = MT_CLS_CONFIDENCE, | |
2c2110e9 | 1133 | MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, |
6ab3a9a6 JS |
1134 | USB_DEVICE_ID_PENMOUNT_PCI) }, |
1135 | ||
b7ea95ff AT |
1136 | /* PixArt optical touch screen */ |
1137 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 1138 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff AT |
1139 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, |
1140 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 1141 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff AT |
1142 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, |
1143 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
2c2110e9 | 1144 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff AT |
1145 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, |
1146 | ||
5519cab4 | 1147 | /* PixCir-based panels */ |
1e9cf35b | 1148 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
2c2110e9 | 1149 | MT_USB_DEVICE(USB_VENDOR_ID_HANVON, |
5519cab4 | 1150 | USB_DEVICE_ID_HANVON_MULTITOUCH) }, |
1e9cf35b | 1151 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
2c2110e9 | 1152 | MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
5519cab4 BT |
1153 | USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, |
1154 | ||
5e7ea11f BT |
1155 | /* Quanta-based panels */ |
1156 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
2c2110e9 | 1157 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
5e7ea11f BT |
1158 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, |
1159 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
2c2110e9 | 1160 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
5e7ea11f BT |
1161 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, |
1162 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
2c2110e9 | 1163 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
5e7ea11f BT |
1164 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) }, |
1165 | ||
043b403a | 1166 | /* Stantum panels */ |
bf5af9b5 | 1167 | { .driver_data = MT_CLS_CONFIDENCE, |
2c2110e9 | 1168 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM, |
043b403a | 1169 | USB_DEVICE_ID_MTP)}, |
bf5af9b5 | 1170 | { .driver_data = MT_CLS_CONFIDENCE, |
2c2110e9 | 1171 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, |
043b403a | 1172 | USB_DEVICE_ID_MTP_STM)}, |
dc3e1d80 | 1173 | { .driver_data = MT_CLS_DEFAULT, |
2c2110e9 | 1174 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, |
043b403a BT |
1175 | USB_DEVICE_ID_MTP_SITRONIX)}, |
1176 | ||
847672cd BT |
1177 | /* TopSeed panels */ |
1178 | { .driver_data = MT_CLS_TOPSEED, | |
2c2110e9 | 1179 | MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, |
847672cd BT |
1180 | USB_DEVICE_ID_TOPSEED2_PERIPAD_701) }, |
1181 | ||
5e74e56d | 1182 | /* Touch International panels */ |
dc3e1d80 | 1183 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1184 | MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, |
5e74e56d BT |
1185 | USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, |
1186 | ||
617b64f9 | 1187 | /* Unitec panels */ |
dc3e1d80 | 1188 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1189 | MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, |
617b64f9 | 1190 | USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, |
dc3e1d80 | 1191 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1192 | MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, |
617b64f9 | 1193 | USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, |
bc8a2a9b | 1194 | /* XAT */ |
dc3e1d80 | 1195 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1196 | MT_USB_DEVICE(USB_VENDOR_ID_XAT, |
bc8a2a9b | 1197 | USB_DEVICE_ID_XAT_CSR) }, |
617b64f9 | 1198 | |
11576c61 | 1199 | /* Xiroku */ |
dc3e1d80 | 1200 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1201 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1202 | USB_DEVICE_ID_XIROKU_SPX) }, |
dc3e1d80 | 1203 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1204 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1205 | USB_DEVICE_ID_XIROKU_MPX) }, |
dc3e1d80 | 1206 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1207 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1208 | USB_DEVICE_ID_XIROKU_CSR) }, |
dc3e1d80 | 1209 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1210 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1211 | USB_DEVICE_ID_XIROKU_SPX1) }, |
dc3e1d80 | 1212 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1213 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1214 | USB_DEVICE_ID_XIROKU_MPX1) }, |
dc3e1d80 | 1215 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1216 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1217 | USB_DEVICE_ID_XIROKU_CSR1) }, |
dc3e1d80 | 1218 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1219 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1220 | USB_DEVICE_ID_XIROKU_SPX2) }, |
dc3e1d80 | 1221 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1222 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 | 1223 | USB_DEVICE_ID_XIROKU_MPX2) }, |
dc3e1d80 | 1224 | { .driver_data = MT_CLS_NSMU, |
2c2110e9 | 1225 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c61 MH |
1226 | USB_DEVICE_ID_XIROKU_CSR2) }, |
1227 | ||
82d06982 BT |
1228 | /* Zytronic panels */ |
1229 | { .driver_data = MT_CLS_SERIAL, | |
1230 | MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC, | |
1231 | USB_DEVICE_ID_ZYTRONIC_ZXY100) }, | |
1232 | ||
4fa3a583 HR |
1233 | /* Generic MT device */ |
1234 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, | |
5519cab4 BT |
1235 | { } |
1236 | }; | |
1237 | MODULE_DEVICE_TABLE(hid, mt_devices); | |
1238 | ||
1239 | static const struct hid_usage_id mt_grabbed_usages[] = { | |
1240 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | |
1241 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | |
1242 | }; | |
1243 | ||
1244 | static struct hid_driver mt_driver = { | |
1245 | .name = "hid-multitouch", | |
1246 | .id_table = mt_devices, | |
1247 | .probe = mt_probe, | |
1248 | .remove = mt_remove, | |
1249 | .input_mapping = mt_input_mapping, | |
1250 | .input_mapped = mt_input_mapped, | |
76f5902a | 1251 | .input_configured = mt_input_configured, |
5519cab4 BT |
1252 | .feature_mapping = mt_feature_mapping, |
1253 | .usage_table = mt_grabbed_usages, | |
1254 | .event = mt_event, | |
55978fa9 | 1255 | .report = mt_report, |
5519cab4 BT |
1256 | #ifdef CONFIG_PM |
1257 | .reset_resume = mt_reset_resume, | |
dfeefd10 | 1258 | .resume = mt_resume, |
5519cab4 BT |
1259 | #endif |
1260 | }; | |
f425458e | 1261 | module_hid_driver(mt_driver); |