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