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