]>
Commit | Line | Data |
---|---|---|
5519cab4 BT |
1 | /* |
2 | * HID driver for multitouch panels | |
3 | * | |
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 | |
7 | * | |
4875ac11 RN |
8 | * This code is partly based on hid-egalax.c: |
9 | * | |
10 | * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr> | |
11 | * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> | |
12 | * Copyright (c) 2010 Canonical, Ltd. | |
13 | * | |
f786bba4 BT |
14 | * This code is partly based on hid-3m-pct.c: |
15 | * | |
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. | |
19 | * | |
5519cab4 BT |
20 | */ |
21 | ||
22 | /* | |
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) | |
26 | * any later version. | |
27 | */ | |
28 | ||
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" | |
36 | ||
37 | ||
38 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | |
ef2fafb3 | 39 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
5519cab4 BT |
40 | MODULE_DESCRIPTION("HID multitouch panels"); |
41 | MODULE_LICENSE("GPL"); | |
42 | ||
43 | #include "hid-ids.h" | |
44 | ||
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) | |
2d93666e | 48 | #define MT_QUIRK_CYPRESS (1 << 2) |
5572da08 | 49 | #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3) |
a062cc5a SC |
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) | |
a062cc5a | 53 | #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) |
5519cab4 BT |
54 | |
55 | struct mt_slot { | |
56 | __s32 x, y, p, w, h; | |
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 */ | |
60 | }; | |
61 | ||
eec29e3d BT |
62 | struct mt_class { |
63 | __s32 name; /* MT_CLS */ | |
64 | __s32 quirks; | |
65 | __s32 sn_move; /* Signal/noise ratio for move events */ | |
66 | __s32 sn_width; /* Signal/noise ratio for width events */ | |
67 | __s32 sn_height; /* Signal/noise ratio for height events */ | |
68 | __s32 sn_pressure; /* Signal/noise ratio for pressure events */ | |
69 | __u8 maxcontacts; | |
70 | }; | |
71 | ||
5519cab4 BT |
72 | struct mt_device { |
73 | struct mt_slot curdata; /* placeholder of incoming data */ | |
eec29e3d | 74 | struct mt_class mtclass; /* our mt device class */ |
5519cab4 BT |
75 | unsigned last_field_index; /* last field index of the report */ |
76 | unsigned last_slot_field; /* the last field of a slot */ | |
b84bd27f | 77 | int last_mt_collection; /* last known mt-related collection */ |
5519cab4 BT |
78 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ |
79 | __u8 num_received; /* how many contacts we received */ | |
80 | __u8 num_expected; /* expected last contact index */ | |
9498f954 | 81 | __u8 maxcontacts; |
5519cab4 | 82 | bool curvalid; /* is the current contact valid? */ |
9498f954 | 83 | struct mt_slot *slots; |
5519cab4 BT |
84 | }; |
85 | ||
5519cab4 | 86 | /* classes of device behavior */ |
22408283 BT |
87 | #define MT_CLS_DEFAULT 0x0001 |
88 | ||
a062cc5a SC |
89 | #define MT_CLS_SERIAL 0x0002 |
90 | #define MT_CLS_CONFIDENCE 0x0003 | |
5e7ea11f BT |
91 | #define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004 |
92 | #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005 | |
93 | #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006 | |
94 | #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007 | |
95 | #define MT_CLS_DUAL_NSMU_CONTACTID 0x0008 | |
b7ea95ff | 96 | #define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 |
22408283 BT |
97 | |
98 | /* vendor specific classes */ | |
99 | #define MT_CLS_3M 0x0101 | |
100 | #define MT_CLS_CYPRESS 0x0102 | |
101 | #define MT_CLS_EGALAX 0x0103 | |
1b723e8d | 102 | #define MT_CLS_EGALAX_SERIAL 0x0104 |
5519cab4 | 103 | |
9498f954 BT |
104 | #define MT_DEFAULT_MAXCONTACT 10 |
105 | ||
5519cab4 BT |
106 | /* |
107 | * these device-dependent functions determine what slot corresponds | |
108 | * to a valid contact that was just read. | |
109 | */ | |
110 | ||
a3b5e577 BT |
111 | static int cypress_compute_slot(struct mt_device *td) |
112 | { | |
113 | if (td->curdata.contactid != 0 || td->num_received == 0) | |
114 | return td->curdata.contactid; | |
115 | else | |
116 | return -1; | |
117 | } | |
118 | ||
5519cab4 BT |
119 | static int find_slot_from_contactid(struct mt_device *td) |
120 | { | |
121 | int i; | |
9498f954 | 122 | for (i = 0; i < td->maxcontacts; ++i) { |
5519cab4 BT |
123 | if (td->slots[i].contactid == td->curdata.contactid && |
124 | td->slots[i].touch_state) | |
125 | return i; | |
126 | } | |
9498f954 | 127 | for (i = 0; i < td->maxcontacts; ++i) { |
5519cab4 BT |
128 | if (!td->slots[i].seen_in_this_frame && |
129 | !td->slots[i].touch_state) | |
130 | return i; | |
131 | } | |
5519cab4 BT |
132 | /* should not occurs. If this happens that means |
133 | * that the device sent more touches that it says | |
134 | * in the report descriptor. It is ignored then. */ | |
2d93666e | 135 | return -1; |
5519cab4 BT |
136 | } |
137 | ||
138 | struct mt_class mt_classes[] = { | |
2d93666e | 139 | { .name = MT_CLS_DEFAULT, |
9498f954 | 140 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP }, |
a062cc5a SC |
141 | { .name = MT_CLS_SERIAL, |
142 | .quirks = MT_QUIRK_ALWAYS_VALID}, | |
22408283 BT |
143 | { .name = MT_CLS_CONFIDENCE, |
144 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE }, | |
5e7ea11f BT |
145 | { .name = MT_CLS_CONFIDENCE_CONTACT_ID, |
146 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
147 | MT_QUIRK_SLOT_IS_CONTACTID }, | |
22408283 BT |
148 | { .name = MT_CLS_CONFIDENCE_MINUS_ONE, |
149 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
150 | MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE }, | |
1e9cf35b | 151 | { .name = MT_CLS_DUAL_INRANGE_CONTACTID, |
2d93666e BT |
152 | .quirks = MT_QUIRK_VALID_IS_INRANGE | |
153 | MT_QUIRK_SLOT_IS_CONTACTID, | |
154 | .maxcontacts = 2 }, | |
1e9cf35b | 155 | { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
2d93666e BT |
156 | .quirks = MT_QUIRK_VALID_IS_INRANGE | |
157 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | |
158 | .maxcontacts = 2 }, | |
22408283 BT |
159 | { .name = MT_CLS_DUAL_NSMU_CONTACTID, |
160 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
161 | MT_QUIRK_SLOT_IS_CONTACTID, | |
162 | .maxcontacts = 2 }, | |
b7ea95ff AT |
163 | { .name = MT_CLS_INRANGE_CONTACTNUMBER, |
164 | .quirks = MT_QUIRK_VALID_IS_INRANGE | | |
165 | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, | |
22408283 BT |
166 | |
167 | /* | |
168 | * vendor specific classes | |
169 | */ | |
170 | { .name = MT_CLS_3M, | |
171 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | | |
172 | MT_QUIRK_SLOT_IS_CONTACTID, | |
173 | .sn_move = 2048, | |
174 | .sn_width = 128, | |
175 | .sn_height = 128 }, | |
2d93666e BT |
176 | { .name = MT_CLS_CYPRESS, |
177 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | |
178 | MT_QUIRK_CYPRESS, | |
179 | .maxcontacts = 10 }, | |
4875ac11 RN |
180 | { .name = MT_CLS_EGALAX, |
181 | .quirks = MT_QUIRK_SLOT_IS_CONTACTID | | |
2261bb9f | 182 | MT_QUIRK_VALID_IS_INRANGE, |
4875ac11 RN |
183 | .sn_move = 4096, |
184 | .sn_pressure = 32, | |
185 | }, | |
1b723e8d BT |
186 | { .name = MT_CLS_EGALAX_SERIAL, |
187 | .quirks = MT_QUIRK_SLOT_IS_CONTACTID | | |
188 | MT_QUIRK_ALWAYS_VALID, | |
189 | .sn_move = 4096, | |
190 | .sn_pressure = 32, | |
191 | }, | |
043b403a | 192 | |
2d93666e | 193 | { } |
5519cab4 BT |
194 | }; |
195 | ||
eec29e3d BT |
196 | static ssize_t mt_show_quirks(struct device *dev, |
197 | struct device_attribute *attr, | |
198 | char *buf) | |
199 | { | |
200 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | |
201 | struct mt_device *td = hid_get_drvdata(hdev); | |
202 | ||
203 | return sprintf(buf, "%u\n", td->mtclass.quirks); | |
204 | } | |
205 | ||
206 | static ssize_t mt_set_quirks(struct device *dev, | |
207 | struct device_attribute *attr, | |
208 | const char *buf, size_t count) | |
209 | { | |
210 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | |
211 | struct mt_device *td = hid_get_drvdata(hdev); | |
212 | ||
213 | unsigned long val; | |
214 | ||
215 | if (kstrtoul(buf, 0, &val)) | |
216 | return -EINVAL; | |
217 | ||
218 | td->mtclass.quirks = val; | |
219 | ||
220 | return count; | |
221 | } | |
222 | ||
223 | static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks); | |
224 | ||
225 | static struct attribute *sysfs_attrs[] = { | |
226 | &dev_attr_quirks.attr, | |
227 | NULL | |
228 | }; | |
229 | ||
230 | static struct attribute_group mt_attribute_group = { | |
231 | .attrs = sysfs_attrs | |
232 | }; | |
233 | ||
f635bd11 | 234 | static void mt_feature_mapping(struct hid_device *hdev, |
5519cab4 BT |
235 | struct hid_field *field, struct hid_usage *usage) |
236 | { | |
9498f954 BT |
237 | struct mt_device *td = hid_get_drvdata(hdev); |
238 | ||
239 | switch (usage->hid) { | |
240 | case HID_DG_INPUTMODE: | |
5519cab4 | 241 | td->inputmode = field->report->id; |
9498f954 BT |
242 | break; |
243 | case HID_DG_CONTACTMAX: | |
244 | td->maxcontacts = field->value[0]; | |
eec29e3d | 245 | if (td->mtclass.maxcontacts) |
9498f954 | 246 | /* check if the maxcontacts is given by the class */ |
eec29e3d | 247 | td->maxcontacts = td->mtclass.maxcontacts; |
9498f954 BT |
248 | |
249 | break; | |
5519cab4 BT |
250 | } |
251 | } | |
252 | ||
253 | static void set_abs(struct input_dev *input, unsigned int code, | |
254 | struct hid_field *field, int snratio) | |
255 | { | |
256 | int fmin = field->logical_minimum; | |
257 | int fmax = field->logical_maximum; | |
258 | int fuzz = snratio ? (fmax - fmin) / snratio : 0; | |
259 | input_set_abs_params(input, code, fmin, fmax, fuzz, 0); | |
260 | } | |
261 | ||
262 | static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |
263 | struct hid_field *field, struct hid_usage *usage, | |
264 | unsigned long **bit, int *max) | |
265 | { | |
266 | struct mt_device *td = hid_get_drvdata(hdev); | |
eec29e3d | 267 | struct mt_class *cls = &td->mtclass; |
4875ac11 | 268 | |
658d4aed JB |
269 | /* Only map fields from TouchScreen or TouchPad collections. |
270 | * We need to ignore fields that belong to other collections | |
271 | * such as Mouse that might have the same GenericDesktop usages. */ | |
272 | if (field->application == HID_DG_TOUCHSCREEN) | |
273 | set_bit(INPUT_PROP_DIRECT, hi->input->propbit); | |
274 | else if (field->application == HID_DG_TOUCHPAD) | |
275 | set_bit(INPUT_PROP_POINTER, hi->input->propbit); | |
276 | else | |
277 | return 0; | |
278 | ||
2261bb9f BT |
279 | /* eGalax devices provide a Digitizer.Stylus input which overrides |
280 | * the correct Digitizers.Finger X/Y ranges. | |
281 | * Let's just ignore this input. */ | |
282 | if (field->physical == HID_DG_STYLUS) | |
283 | return -1; | |
284 | ||
5519cab4 BT |
285 | switch (usage->hid & HID_USAGE_PAGE) { |
286 | ||
287 | case HID_UP_GENDESK: | |
288 | switch (usage->hid) { | |
289 | case HID_GD_X: | |
290 | hid_map_usage(hi, usage, bit, max, | |
291 | EV_ABS, ABS_MT_POSITION_X); | |
292 | set_abs(hi->input, ABS_MT_POSITION_X, field, | |
293 | cls->sn_move); | |
294 | /* touchscreen emulation */ | |
295 | set_abs(hi->input, ABS_X, field, cls->sn_move); | |
b84bd27f BT |
296 | if (td->last_mt_collection == usage->collection_index) { |
297 | td->last_slot_field = usage->hid; | |
298 | td->last_field_index = field->index; | |
299 | } | |
5519cab4 BT |
300 | return 1; |
301 | case HID_GD_Y: | |
302 | hid_map_usage(hi, usage, bit, max, | |
303 | EV_ABS, ABS_MT_POSITION_Y); | |
304 | set_abs(hi->input, ABS_MT_POSITION_Y, field, | |
305 | cls->sn_move); | |
306 | /* touchscreen emulation */ | |
307 | set_abs(hi->input, ABS_Y, field, cls->sn_move); | |
b84bd27f BT |
308 | if (td->last_mt_collection == usage->collection_index) { |
309 | td->last_slot_field = usage->hid; | |
310 | td->last_field_index = field->index; | |
311 | } | |
5519cab4 BT |
312 | return 1; |
313 | } | |
314 | return 0; | |
315 | ||
316 | case HID_UP_DIGITIZER: | |
317 | switch (usage->hid) { | |
318 | case HID_DG_INRANGE: | |
b84bd27f BT |
319 | if (td->last_mt_collection == usage->collection_index) { |
320 | td->last_slot_field = usage->hid; | |
321 | td->last_field_index = field->index; | |
322 | } | |
5519cab4 BT |
323 | return 1; |
324 | case HID_DG_CONFIDENCE: | |
b84bd27f BT |
325 | if (td->last_mt_collection == usage->collection_index) { |
326 | td->last_slot_field = usage->hid; | |
327 | td->last_field_index = field->index; | |
328 | } | |
5519cab4 BT |
329 | return 1; |
330 | case HID_DG_TIPSWITCH: | |
331 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | |
332 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); | |
b84bd27f BT |
333 | if (td->last_mt_collection == usage->collection_index) { |
334 | td->last_slot_field = usage->hid; | |
335 | td->last_field_index = field->index; | |
336 | } | |
5519cab4 BT |
337 | return 1; |
338 | case HID_DG_CONTACTID: | |
50bc03ab BT |
339 | if (!td->maxcontacts) |
340 | td->maxcontacts = MT_DEFAULT_MAXCONTACT; | |
9498f954 | 341 | input_mt_init_slots(hi->input, td->maxcontacts); |
5519cab4 | 342 | td->last_slot_field = usage->hid; |
2955caed | 343 | td->last_field_index = field->index; |
b84bd27f | 344 | td->last_mt_collection = usage->collection_index; |
5519cab4 BT |
345 | return 1; |
346 | case HID_DG_WIDTH: | |
347 | hid_map_usage(hi, usage, bit, max, | |
348 | EV_ABS, ABS_MT_TOUCH_MAJOR); | |
f786bba4 BT |
349 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, |
350 | cls->sn_width); | |
b84bd27f BT |
351 | if (td->last_mt_collection == usage->collection_index) { |
352 | td->last_slot_field = usage->hid; | |
353 | td->last_field_index = field->index; | |
354 | } | |
5519cab4 BT |
355 | return 1; |
356 | case HID_DG_HEIGHT: | |
357 | hid_map_usage(hi, usage, bit, max, | |
358 | EV_ABS, ABS_MT_TOUCH_MINOR); | |
f786bba4 BT |
359 | set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, |
360 | cls->sn_height); | |
1e648a13 BT |
361 | input_set_abs_params(hi->input, |
362 | ABS_MT_ORIENTATION, 0, 1, 0, 0); | |
b84bd27f BT |
363 | if (td->last_mt_collection == usage->collection_index) { |
364 | td->last_slot_field = usage->hid; | |
365 | td->last_field_index = field->index; | |
366 | } | |
5519cab4 BT |
367 | return 1; |
368 | case HID_DG_TIPPRESSURE: | |
369 | hid_map_usage(hi, usage, bit, max, | |
370 | EV_ABS, ABS_MT_PRESSURE); | |
371 | set_abs(hi->input, ABS_MT_PRESSURE, field, | |
372 | cls->sn_pressure); | |
373 | /* touchscreen emulation */ | |
374 | set_abs(hi->input, ABS_PRESSURE, field, | |
375 | cls->sn_pressure); | |
b84bd27f BT |
376 | if (td->last_mt_collection == usage->collection_index) { |
377 | td->last_slot_field = usage->hid; | |
378 | td->last_field_index = field->index; | |
379 | } | |
5519cab4 BT |
380 | return 1; |
381 | case HID_DG_CONTACTCOUNT: | |
b84bd27f BT |
382 | if (td->last_mt_collection == usage->collection_index) |
383 | td->last_field_index = field->index; | |
5519cab4 BT |
384 | return 1; |
385 | case HID_DG_CONTACTMAX: | |
386 | /* we don't set td->last_slot_field as contactcount and | |
387 | * contact max are global to the report */ | |
b84bd27f BT |
388 | if (td->last_mt_collection == usage->collection_index) |
389 | td->last_field_index = field->index; | |
5519cab4 BT |
390 | return -1; |
391 | } | |
392 | /* let hid-input decide for the others */ | |
393 | return 0; | |
394 | ||
395 | case 0xff000000: | |
396 | /* we do not want to map these: no input-oriented meaning */ | |
397 | return -1; | |
398 | } | |
399 | ||
400 | return 0; | |
401 | } | |
402 | ||
403 | static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, | |
404 | struct hid_field *field, struct hid_usage *usage, | |
405 | unsigned long **bit, int *max) | |
406 | { | |
407 | if (usage->type == EV_KEY || usage->type == EV_ABS) | |
408 | set_bit(usage->type, hi->input->evbit); | |
409 | ||
410 | return -1; | |
411 | } | |
412 | ||
413 | static int mt_compute_slot(struct mt_device *td) | |
414 | { | |
eec29e3d | 415 | __s32 quirks = td->mtclass.quirks; |
5519cab4 | 416 | |
2d93666e BT |
417 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTID) |
418 | return td->curdata.contactid; | |
5519cab4 | 419 | |
2d93666e | 420 | if (quirks & MT_QUIRK_CYPRESS) |
a3b5e577 BT |
421 | return cypress_compute_slot(td); |
422 | ||
2d93666e BT |
423 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER) |
424 | return td->num_received; | |
5572da08 | 425 | |
4a6ee685 BT |
426 | if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE) |
427 | return td->curdata.contactid - 1; | |
428 | ||
5519cab4 BT |
429 | return find_slot_from_contactid(td); |
430 | } | |
431 | ||
432 | /* | |
433 | * this function is called when a whole contact has been processed, | |
434 | * so that it can assign it to a slot and store the data there | |
435 | */ | |
436 | static void mt_complete_slot(struct mt_device *td) | |
437 | { | |
2d93666e | 438 | td->curdata.seen_in_this_frame = true; |
5519cab4 | 439 | if (td->curvalid) { |
5519cab4 BT |
440 | int slotnum = mt_compute_slot(td); |
441 | ||
9498f954 | 442 | if (slotnum >= 0 && slotnum < td->maxcontacts) |
2d93666e | 443 | td->slots[slotnum] = td->curdata; |
5519cab4 BT |
444 | } |
445 | td->num_received++; | |
446 | } | |
447 | ||
448 | ||
449 | /* | |
450 | * this function is called when a whole packet has been received and processed, | |
451 | * so that it can decide what to send to the input layer. | |
452 | */ | |
453 | static void mt_emit_event(struct mt_device *td, struct input_dev *input) | |
454 | { | |
455 | int i; | |
456 | ||
9498f954 | 457 | for (i = 0; i < td->maxcontacts; ++i) { |
5519cab4 | 458 | struct mt_slot *s = &(td->slots[i]); |
eec29e3d | 459 | if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) && |
5519cab4 | 460 | !s->seen_in_this_frame) { |
5519cab4 BT |
461 | s->touch_state = false; |
462 | } | |
463 | ||
464 | input_mt_slot(input, i); | |
465 | input_mt_report_slot_state(input, MT_TOOL_FINGER, | |
466 | s->touch_state); | |
2d93666e | 467 | if (s->touch_state) { |
f786bba4 BT |
468 | /* this finger is on the screen */ |
469 | int wide = (s->w > s->h); | |
470 | /* divided by two to match visual scale of touch */ | |
471 | int major = max(s->w, s->h) >> 1; | |
472 | int minor = min(s->w, s->h) >> 1; | |
473 | ||
2d93666e BT |
474 | input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); |
475 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y); | |
f786bba4 | 476 | input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); |
2d93666e | 477 | input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p); |
f786bba4 BT |
478 | input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); |
479 | input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); | |
2d93666e | 480 | } |
5519cab4 BT |
481 | s->seen_in_this_frame = false; |
482 | ||
483 | } | |
484 | ||
485 | input_mt_report_pointer_emulation(input, true); | |
486 | input_sync(input); | |
487 | td->num_received = 0; | |
488 | } | |
489 | ||
490 | ||
491 | ||
492 | static int mt_event(struct hid_device *hid, struct hid_field *field, | |
493 | struct hid_usage *usage, __s32 value) | |
494 | { | |
495 | struct mt_device *td = hid_get_drvdata(hid); | |
eec29e3d | 496 | __s32 quirks = td->mtclass.quirks; |
5519cab4 | 497 | |
9498f954 | 498 | if (hid->claimed & HID_CLAIMED_INPUT && td->slots) { |
5519cab4 BT |
499 | switch (usage->hid) { |
500 | case HID_DG_INRANGE: | |
a062cc5a SC |
501 | if (quirks & MT_QUIRK_ALWAYS_VALID) |
502 | td->curvalid = true; | |
503 | else if (quirks & MT_QUIRK_VALID_IS_INRANGE) | |
2d93666e | 504 | td->curvalid = value; |
5519cab4 BT |
505 | break; |
506 | case HID_DG_TIPSWITCH: | |
2d93666e BT |
507 | if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) |
508 | td->curvalid = value; | |
5519cab4 BT |
509 | td->curdata.touch_state = value; |
510 | break; | |
511 | case HID_DG_CONFIDENCE: | |
2d93666e BT |
512 | if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) |
513 | td->curvalid = value; | |
5519cab4 BT |
514 | break; |
515 | case HID_DG_CONTACTID: | |
516 | td->curdata.contactid = value; | |
517 | break; | |
518 | case HID_DG_TIPPRESSURE: | |
519 | td->curdata.p = value; | |
520 | break; | |
521 | case HID_GD_X: | |
522 | td->curdata.x = value; | |
523 | break; | |
524 | case HID_GD_Y: | |
525 | td->curdata.y = value; | |
526 | break; | |
527 | case HID_DG_WIDTH: | |
528 | td->curdata.w = value; | |
529 | break; | |
530 | case HID_DG_HEIGHT: | |
531 | td->curdata.h = value; | |
532 | break; | |
533 | case HID_DG_CONTACTCOUNT: | |
534 | /* | |
2d93666e BT |
535 | * Includes multi-packet support where subsequent |
536 | * packets are sent with zero contactcount. | |
5519cab4 BT |
537 | */ |
538 | if (value) | |
2d93666e | 539 | td->num_expected = value; |
5519cab4 BT |
540 | break; |
541 | ||
542 | default: | |
543 | /* fallback to the generic hidinput handling */ | |
544 | return 0; | |
545 | } | |
5519cab4 | 546 | |
f153fc39 | 547 | if (usage->hid == td->last_slot_field) { |
2d93666e | 548 | mt_complete_slot(td); |
f153fc39 | 549 | } |
2d93666e BT |
550 | |
551 | if (field->index == td->last_field_index | |
552 | && td->num_received >= td->num_expected) | |
553 | mt_emit_event(td, field->hidinput->input); | |
5519cab4 | 554 | |
2d93666e | 555 | } |
5519cab4 BT |
556 | |
557 | /* we have handled the hidinput part, now remains hiddev */ | |
558 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | |
559 | hid->hiddev_hid_event(hid, field, usage, value); | |
560 | ||
561 | return 1; | |
562 | } | |
563 | ||
564 | static void mt_set_input_mode(struct hid_device *hdev) | |
565 | { | |
566 | struct mt_device *td = hid_get_drvdata(hdev); | |
567 | struct hid_report *r; | |
568 | struct hid_report_enum *re; | |
569 | ||
570 | if (td->inputmode < 0) | |
571 | return; | |
572 | ||
573 | re = &(hdev->report_enum[HID_FEATURE_REPORT]); | |
574 | r = re->report_id_hash[td->inputmode]; | |
575 | if (r) { | |
576 | r->field[0]->value[0] = 0x02; | |
577 | usbhid_submit_report(hdev, r, USB_DIR_OUT); | |
578 | } | |
579 | } | |
580 | ||
581 | static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |
582 | { | |
2d93666e | 583 | int ret, i; |
5519cab4 | 584 | struct mt_device *td; |
2d93666e BT |
585 | struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ |
586 | ||
587 | for (i = 0; mt_classes[i].name ; i++) { | |
588 | if (id->driver_data == mt_classes[i].name) { | |
589 | mtclass = &(mt_classes[i]); | |
590 | break; | |
591 | } | |
592 | } | |
5519cab4 | 593 | |
d682bd7f HR |
594 | /* This allows the driver to correctly support devices |
595 | * that emit events over several HID messages. | |
596 | */ | |
597 | hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; | |
5519cab4 | 598 | |
9498f954 | 599 | td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); |
5519cab4 BT |
600 | if (!td) { |
601 | dev_err(&hdev->dev, "cannot allocate multitouch data\n"); | |
602 | return -ENOMEM; | |
603 | } | |
eec29e3d | 604 | td->mtclass = *mtclass; |
5519cab4 | 605 | td->inputmode = -1; |
b84bd27f | 606 | td->last_mt_collection = -1; |
5519cab4 BT |
607 | hid_set_drvdata(hdev, td); |
608 | ||
609 | ret = hid_parse(hdev); | |
610 | if (ret != 0) | |
611 | goto fail; | |
612 | ||
613 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | |
2d93666e | 614 | if (ret) |
5519cab4 BT |
615 | goto fail; |
616 | ||
9498f954 BT |
617 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), |
618 | GFP_KERNEL); | |
619 | if (!td->slots) { | |
620 | dev_err(&hdev->dev, "cannot allocate multitouch slots\n"); | |
621 | hid_hw_stop(hdev); | |
622 | ret = -ENOMEM; | |
623 | goto fail; | |
624 | } | |
625 | ||
eec29e3d BT |
626 | ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); |
627 | ||
5519cab4 BT |
628 | mt_set_input_mode(hdev); |
629 | ||
630 | return 0; | |
631 | ||
632 | fail: | |
633 | kfree(td); | |
634 | return ret; | |
635 | } | |
636 | ||
637 | #ifdef CONFIG_PM | |
638 | static int mt_reset_resume(struct hid_device *hdev) | |
639 | { | |
640 | mt_set_input_mode(hdev); | |
641 | return 0; | |
642 | } | |
643 | #endif | |
644 | ||
645 | static void mt_remove(struct hid_device *hdev) | |
646 | { | |
647 | struct mt_device *td = hid_get_drvdata(hdev); | |
eec29e3d | 648 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); |
5519cab4 | 649 | hid_hw_stop(hdev); |
9498f954 | 650 | kfree(td->slots); |
5519cab4 BT |
651 | kfree(td); |
652 | hid_set_drvdata(hdev, NULL); | |
653 | } | |
654 | ||
655 | static const struct hid_device_id mt_devices[] = { | |
656 | ||
f786bba4 BT |
657 | /* 3M panels */ |
658 | { .driver_data = MT_CLS_3M, | |
659 | HID_USB_DEVICE(USB_VENDOR_ID_3M, | |
660 | USB_DEVICE_ID_3M1968) }, | |
661 | { .driver_data = MT_CLS_3M, | |
662 | HID_USB_DEVICE(USB_VENDOR_ID_3M, | |
663 | USB_DEVICE_ID_3M2256) }, | |
664 | ||
e6aac342 BT |
665 | /* ActionStar panels */ |
666 | { .driver_data = MT_CLS_DEFAULT, | |
667 | HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, | |
668 | USB_DEVICE_ID_ACTIONSTAR_1011) }, | |
669 | ||
a841b62c BT |
670 | /* Cando panels */ |
671 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
672 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | |
673 | USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, | |
674 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
675 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | |
676 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, | |
677 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
678 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | |
679 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, | |
680 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, | |
681 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | |
682 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, | |
683 | ||
942fd422 AZ |
684 | /* Chunghwa Telecom touch panels */ |
685 | { .driver_data = MT_CLS_DEFAULT, | |
686 | HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, | |
687 | USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, | |
688 | ||
79603dc9 BT |
689 | /* CVTouch panels */ |
690 | { .driver_data = MT_CLS_DEFAULT, | |
691 | HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, | |
692 | USB_DEVICE_ID_CVTOUCH_SCREEN) }, | |
693 | ||
a3b5e577 BT |
694 | /* Cypress panel */ |
695 | { .driver_data = MT_CLS_CYPRESS, | |
696 | HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, | |
697 | USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, | |
698 | ||
22408283 | 699 | /* eGalax devices (resistive) */ |
e36f690b | 700 | { .driver_data = MT_CLS_EGALAX, |
22408283 | 701 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b BT |
702 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, |
703 | { .driver_data = MT_CLS_EGALAX, | |
22408283 | 704 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 705 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, |
22408283 BT |
706 | |
707 | /* eGalax devices (capacitive) */ | |
e36f690b | 708 | { .driver_data = MT_CLS_EGALAX, |
22408283 | 709 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b BT |
710 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, |
711 | { .driver_data = MT_CLS_EGALAX, | |
22408283 | 712 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b BT |
713 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, |
714 | { .driver_data = MT_CLS_EGALAX, | |
22408283 | 715 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 716 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, |
66f06127 BT |
717 | { .driver_data = MT_CLS_EGALAX, |
718 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, | |
719 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, | |
bb9ff210 MV |
720 | { .driver_data = MT_CLS_EGALAX, |
721 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, | |
722 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, | |
1b723e8d | 723 | { .driver_data = MT_CLS_EGALAX_SERIAL, |
1fd8f047 | 724 | HID_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b | 725 | USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, |
22408283 | 726 | |
c04abeef BT |
727 | /* Elo TouchSystems IntelliTouch Plus panel */ |
728 | { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID, | |
729 | HID_USB_DEVICE(USB_VENDOR_ID_ELO, | |
730 | USB_DEVICE_ID_ELO_TS2515) }, | |
731 | ||
5572da08 | 732 | /* GeneralTouch panel */ |
1e9cf35b | 733 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
5572da08 BT |
734 | HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
735 | USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, | |
736 | ||
ee0fbd14 BT |
737 | /* GoodTouch panels */ |
738 | { .driver_data = MT_CLS_DEFAULT, | |
739 | HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, | |
740 | USB_DEVICE_ID_GOODTOUCH_000f) }, | |
741 | ||
54580365 BT |
742 | /* Hanvon panels */ |
743 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, | |
744 | HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, | |
745 | USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, | |
746 | ||
a062cc5a SC |
747 | /* Ideacom panel */ |
748 | { .driver_data = MT_CLS_SERIAL, | |
749 | HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, | |
750 | USB_DEVICE_ID_IDEACOM_IDC6650) }, | |
751 | ||
4e61f0d7 AZ |
752 | /* Ilitek dual touch panel */ |
753 | { .driver_data = MT_CLS_DEFAULT, | |
754 | HID_USB_DEVICE(USB_VENDOR_ID_ILITEK, | |
755 | USB_DEVICE_ID_ILITEK_MULTITOUCH) }, | |
756 | ||
4dfcced8 BT |
757 | /* IRTOUCH panels */ |
758 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, | |
759 | HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, | |
760 | USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, | |
761 | ||
c50bb1a4 JB |
762 | /* LG Display panels */ |
763 | { .driver_data = MT_CLS_DEFAULT, | |
764 | HID_USB_DEVICE(USB_VENDOR_ID_LG, | |
765 | USB_DEVICE_ID_LG_MULTITOUCH) }, | |
766 | ||
df167c4a BT |
767 | /* Lumio panels */ |
768 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
769 | HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, | |
770 | USB_DEVICE_ID_CRYSTALTOUCH) }, | |
c3ead6de BT |
771 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, |
772 | HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, | |
773 | USB_DEVICE_ID_CRYSTALTOUCH_DUAL) }, | |
df167c4a | 774 | |
4a6ee685 BT |
775 | /* MosArt panels */ |
776 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
777 | HID_USB_DEVICE(USB_VENDOR_ID_ASUS, | |
778 | USB_DEVICE_ID_ASUS_T91MT)}, | |
779 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
780 | HID_USB_DEVICE(USB_VENDOR_ID_ASUS, | |
781 | USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, | |
782 | { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, | |
783 | HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, | |
784 | USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, | |
785 | ||
6ab3a9a6 JS |
786 | /* PenMount panels */ |
787 | { .driver_data = MT_CLS_CONFIDENCE, | |
788 | HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, | |
789 | USB_DEVICE_ID_PENMOUNT_PCI) }, | |
790 | ||
b7ea95ff AT |
791 | /* PixArt optical touch screen */ |
792 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
793 | HID_USB_DEVICE(USB_VENDOR_ID_PIXART, | |
794 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, | |
795 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
796 | HID_USB_DEVICE(USB_VENDOR_ID_PIXART, | |
797 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, | |
798 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | |
799 | HID_USB_DEVICE(USB_VENDOR_ID_PIXART, | |
800 | USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, | |
801 | ||
5519cab4 | 802 | /* PixCir-based panels */ |
1e9cf35b | 803 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
5519cab4 BT |
804 | HID_USB_DEVICE(USB_VENDOR_ID_HANVON, |
805 | USB_DEVICE_ID_HANVON_MULTITOUCH) }, | |
1e9cf35b | 806 | { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
5519cab4 BT |
807 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, |
808 | USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, | |
809 | ||
5e7ea11f BT |
810 | /* Quanta-based panels */ |
811 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
812 | HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | |
813 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, | |
814 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
815 | HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | |
816 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, | |
817 | { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, | |
818 | HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | |
819 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) }, | |
820 | ||
043b403a | 821 | /* Stantum panels */ |
bf5af9b5 | 822 | { .driver_data = MT_CLS_CONFIDENCE, |
043b403a BT |
823 | HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, |
824 | USB_DEVICE_ID_MTP)}, | |
bf5af9b5 | 825 | { .driver_data = MT_CLS_CONFIDENCE, |
85a60082 | 826 | HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, |
043b403a | 827 | USB_DEVICE_ID_MTP_STM)}, |
bf5af9b5 | 828 | { .driver_data = MT_CLS_CONFIDENCE, |
85a60082 | 829 | HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, |
043b403a BT |
830 | USB_DEVICE_ID_MTP_SITRONIX)}, |
831 | ||
5e74e56d BT |
832 | /* Touch International panels */ |
833 | { .driver_data = MT_CLS_DEFAULT, | |
834 | HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, | |
835 | USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, | |
836 | ||
617b64f9 BT |
837 | /* Unitec panels */ |
838 | { .driver_data = MT_CLS_DEFAULT, | |
839 | HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, | |
840 | USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, | |
841 | { .driver_data = MT_CLS_DEFAULT, | |
842 | HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, | |
843 | USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, | |
bc8a2a9b | 844 | /* XAT */ |
845 | { .driver_data = MT_CLS_DEFAULT, | |
846 | HID_USB_DEVICE(USB_VENDOR_ID_XAT, | |
847 | USB_DEVICE_ID_XAT_CSR) }, | |
617b64f9 | 848 | |
5519cab4 BT |
849 | { } |
850 | }; | |
851 | MODULE_DEVICE_TABLE(hid, mt_devices); | |
852 | ||
853 | static const struct hid_usage_id mt_grabbed_usages[] = { | |
854 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | |
855 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | |
856 | }; | |
857 | ||
858 | static struct hid_driver mt_driver = { | |
859 | .name = "hid-multitouch", | |
860 | .id_table = mt_devices, | |
861 | .probe = mt_probe, | |
862 | .remove = mt_remove, | |
863 | .input_mapping = mt_input_mapping, | |
864 | .input_mapped = mt_input_mapped, | |
865 | .feature_mapping = mt_feature_mapping, | |
866 | .usage_table = mt_grabbed_usages, | |
867 | .event = mt_event, | |
868 | #ifdef CONFIG_PM | |
869 | .reset_resume = mt_reset_resume, | |
870 | #endif | |
871 | }; | |
872 | ||
873 | static int __init mt_init(void) | |
874 | { | |
875 | return hid_register_driver(&mt_driver); | |
876 | } | |
877 | ||
878 | static void __exit mt_exit(void) | |
879 | { | |
880 | hid_unregister_driver(&mt_driver); | |
881 | } | |
882 | ||
883 | module_init(mt_init); | |
884 | module_exit(mt_exit); |