Blame view
drivers/hid/hid-multitouch.c
50.4 KB
5519cab47 HID: hid-multitou... |
1 2 3 |
/* * HID driver for multitouch panels * |
c2ef8f21e HID: multitouch: ... |
4 |
* Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr> |
b0a786818 HID: multitouch: ... |
5 |
* Copyright (c) 2010-2013 Benjamin Tissoires <benjamin.tissoires@gmail.com> |
c2ef8f21e HID: multitouch: ... |
6 |
* Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France |
b0a786818 HID: multitouch: ... |
7 |
* Copyright (c) 2012-2013 Red Hat, Inc |
5519cab47 HID: hid-multitou... |
8 |
* |
4875ac114 HID: merge hid-eg... |
9 10 11 12 13 14 |
* This code is partly based on hid-egalax.c: * * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr> * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> * Copyright (c) 2010 Canonical, Ltd. * |
f786bba44 HID: hid-multitou... |
15 16 17 18 19 20 |
* This code is partly based on hid-3m-pct.c: * * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr> * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> * Copyright (c) 2010 Canonical, Ltd. * |
5519cab47 HID: hid-multitou... |
21 22 23 24 25 26 27 28 |
*/ /* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. */ |
b0a786818 HID: multitouch: ... |
29 30 31 32 33 34 35 36 37 38 |
/* * This driver is regularly tested thanks to the tool hid-test[1]. * This tool relies on hid-replay[2] and a database of hid devices[3]. * Please run these regression tests before patching this module so that * your patch won't break existing known devices. * * [1] https://github.com/bentiss/hid-test * [2] https://github.com/bentiss/hid-replay * [3] https://github.com/bentiss/hid-devices */ |
5519cab47 HID: hid-multitou... |
39 40 41 42 |
#include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> #include <linux/slab.h> |
5519cab47 HID: hid-multitou... |
43 |
#include <linux/input/mt.h> |
49a5a827a HID: multitouch: ... |
44 |
#include <linux/string.h> |
4f4001bc7 HID: multitouch: ... |
45 |
#include <linux/timer.h> |
5519cab47 HID: hid-multitou... |
46 47 48 |
MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); |
ef2fafb3e HID: hid-multitou... |
49 |
MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
5519cab47 HID: hid-multitou... |
50 51 52 53 54 55 |
MODULE_DESCRIPTION("HID multitouch panels"); MODULE_LICENSE("GPL"); #include "hid-ids.h" /* quirks to control the device */ |
fd9118965 HID: multitouch: ... |
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
#define MT_QUIRK_NOT_SEEN_MEANS_UP BIT(0) #define MT_QUIRK_SLOT_IS_CONTACTID BIT(1) #define MT_QUIRK_CYPRESS BIT(2) #define MT_QUIRK_SLOT_IS_CONTACTNUMBER BIT(3) #define MT_QUIRK_ALWAYS_VALID BIT(4) #define MT_QUIRK_VALID_IS_INRANGE BIT(5) #define MT_QUIRK_VALID_IS_CONFIDENCE BIT(6) #define MT_QUIRK_CONFIDENCE BIT(7) #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE BIT(8) #define MT_QUIRK_NO_AREA BIT(9) #define MT_QUIRK_IGNORE_DUPLICATES BIT(10) #define MT_QUIRK_HOVERING BIT(11) #define MT_QUIRK_CONTACT_CNT_ACCURATE BIT(12) #define MT_QUIRK_FORCE_GET_FEATURE BIT(13) #define MT_QUIRK_FIX_CONST_CONTACT_ID BIT(14) #define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15) |
4f4001bc7 HID: multitouch: ... |
72 |
#define MT_QUIRK_STICKY_FINGERS BIT(16) |
957b8dffa HID: multitouch: ... |
73 |
#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) |
5519cab47 HID: hid-multitou... |
74 |
|
9abebedb1 HID: multitouch: ... |
75 76 |
#define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 |
2c6e0277e HID: multitouch: ... |
77 |
#define MT_BUTTONTYPE_CLICKPAD 0 |
4f4001bc7 HID: multitouch: ... |
78 |
#define MT_IO_FLAGS_RUNNING 0 |
960982745 HID: multitouch: ... |
79 80 |
#define MT_IO_FLAGS_ACTIVE_SLOTS 1 #define MT_IO_FLAGS_PENDING_SLOTS 2 |
4f4001bc7 HID: multitouch: ... |
81 |
|
5519cab47 HID: hid-multitou... |
82 |
struct mt_slot { |
349fd6705 HID: multitouch: ... |
83 |
__s32 x, y, cx, cy, p, w, h; |
5519cab47 HID: hid-multitou... |
84 85 |
__s32 contactid; /* the device ContactID assigned to this slot */ bool touch_state; /* is the touch valid? */ |
9b3bb9b8b HID: multitouch: ... |
86 |
bool inrange_state; /* is the finger in proximity of the sensor? */ |
6dd2e27a1 HID: multitouch: ... |
87 |
bool confidence_state; /* is the touch made by a finger? */ |
5519cab47 HID: hid-multitou... |
88 |
}; |
eec29e3da HID: multitouch: ... |
89 90 91 92 93 94 95 96 |
struct mt_class { __s32 name; /* MT_CLS */ __s32 quirks; __s32 sn_move; /* Signal/noise ratio for move events */ __s32 sn_width; /* Signal/noise ratio for width events */ __s32 sn_height; /* Signal/noise ratio for height events */ __s32 sn_pressure; /* Signal/noise ratio for pressure events */ __u8 maxcontacts; |
c2ef8f21e HID: multitouch: ... |
97 |
bool is_indirect; /* true for touchpads */ |
6aef704e3 HID: multitouch: ... |
98 |
bool export_all_inputs; /* do not ignore mouse, keyboards, etc... */ |
eec29e3da HID: multitouch: ... |
99 |
}; |
3ac36d155 HID: hid-multitou... |
100 101 102 103 |
struct mt_fields { unsigned usages[HID_MAX_FIELDS]; unsigned int length; }; |
5519cab47 HID: hid-multitou... |
104 105 |
struct mt_device { struct mt_slot curdata; /* placeholder of incoming data */ |
eec29e3da HID: multitouch: ... |
106 |
struct mt_class mtclass; /* our mt device class */ |
4f4001bc7 HID: multitouch: ... |
107 |
struct timer_list release_timer; /* to release sticky fingers */ |
3ac36d155 HID: hid-multitou... |
108 109 |
struct mt_fields *fields; /* temporary placeholder for storing the multitouch fields */ |
4f4001bc7 HID: multitouch: ... |
110 |
unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */ |
7e3cc447f HID: multitouch: ... |
111 112 |
int cc_index; /* contact count field index in the report */ int cc_value_index; /* contact count value index in the field */ |
5519cab47 HID: hid-multitou... |
113 |
unsigned last_slot_field; /* the last field of a slot */ |
55978fa9d HID: multitouch: ... |
114 |
unsigned mt_report_id; /* the report ID of the multitouch device */ |
b897f6db3 HID: multitouch: ... |
115 |
unsigned long initial_quirks; /* initial quirks state */ |
8821f5dc1 HID: multitouch: ... |
116 117 118 |
__s16 inputmode; /* InputMode HID feature, -1 if non-existent */ __s16 inputmode_index; /* InputMode HID feature index in the report */ __s16 maxcontact_report_id; /* Maximum Contact Number HID feature, |
31ae9bddb HID: multitouch: ... |
119 |
-1 if non-existent */ |
9abebedb1 HID: multitouch: ... |
120 |
__u8 inputmode_value; /* InputMode HID feature value */ |
5519cab47 HID: hid-multitou... |
121 122 |
__u8 num_received; /* how many contacts we received */ __u8 num_expected; /* expected last contact index */ |
9498f954a HID: hid-multitou... |
123 |
__u8 maxcontacts; |
9e87f22ac HID: multitouch: ... |
124 125 126 |
__u8 touches_by_report; /* how many touches are present in one report: * 1 means we should use a serial protocol * > 1 means hybrid (multitouch) protocol */ |
015fdaa9f HID: multitouch: ... |
127 |
__u8 buttons_count; /* number of physical buttons per touchpad */ |
2c6e0277e HID: multitouch: ... |
128 |
bool is_buttonpad; /* is this device a button pad? */ |
76f5902ae HID: hid-multitou... |
129 |
bool serial_maybe; /* need to check for serial protocol */ |
5519cab47 HID: hid-multitou... |
130 |
bool curvalid; /* is the current contact valid? */ |
76f5902ae HID: hid-multitou... |
131 |
unsigned mt_flags; /* flags to pass to input-mt */ |
5519cab47 HID: hid-multitou... |
132 |
}; |
a69c5f8b1 HID: multitouch: ... |
133 134 |
static void mt_post_parse_default_settings(struct mt_device *td); static void mt_post_parse(struct mt_device *td); |
5519cab47 HID: hid-multitou... |
135 |
/* classes of device behavior */ |
22408283b HID: hid-multitou... |
136 |
#define MT_CLS_DEFAULT 0x0001 |
a062cc5a7 HID: hid-multitou... |
137 138 |
#define MT_CLS_SERIAL 0x0002 #define MT_CLS_CONFIDENCE 0x0003 |
5e7ea11f6 HID: multitouch: ... |
139 140 141 142 |
#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004 #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005 #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007 |
0fa9c6161 HID: multitouch: ... |
143 |
/* reserved 0x0008 */ |
b7ea95ff9 HID: multitouch: ... |
144 |
#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 |
dc3e1d805 HID: multitouch: ... |
145 |
#define MT_CLS_NSMU 0x000a |
0fa9c6161 HID: multitouch: ... |
146 147 |
/* reserved 0x0010 */ /* reserved 0x0011 */ |
f961bd351 HID: detect Win 8... |
148 |
#define MT_CLS_WIN_8 0x0012 |
6aef704e3 HID: multitouch: ... |
149 |
#define MT_CLS_EXPORT_ALL_INPUTS 0x0013 |
504c932c7 HID: multitouch: ... |
150 |
#define MT_CLS_WIN_8_DUAL 0x0014 |
22408283b HID: hid-multitou... |
151 152 153 |
/* vendor specific classes */ #define MT_CLS_3M 0x0101 |
0fa9c6161 HID: multitouch: ... |
154 |
/* reserved 0x0102 */ |
22408283b HID: hid-multitou... |
155 |
#define MT_CLS_EGALAX 0x0103 |
1b723e8dc HID: multitouch: ... |
156 |
#define MT_CLS_EGALAX_SERIAL 0x0104 |
847672cd1 HID: multitouch: ... |
157 |
#define MT_CLS_TOPSEED 0x0105 |
2258e863b HID: multitouch: ... |
158 |
#define MT_CLS_PANASONIC 0x0106 |
77723e3bc HID: hid-multitou... |
159 |
#define MT_CLS_FLATFROG 0x0107 |
cdcd3ac4e Merge branch 'mul... |
160 161 |
#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108 #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109 |
f3287a995 HID: multitouch: ... |
162 |
#define MT_CLS_LG 0x010a |
957b8dffa HID: multitouch: ... |
163 |
#define MT_CLS_ASUS 0x010b |
da10bc252 HID: multitouch: ... |
164 |
#define MT_CLS_VTL 0x0110 |
0e82232c4 HID: multitouch: ... |
165 |
#define MT_CLS_GOOGLE 0x0111 |
5519cab47 HID: hid-multitou... |
166 |
|
9498f954a HID: hid-multitou... |
167 |
#define MT_DEFAULT_MAXCONTACT 10 |
afbcb04c1 HID: multitouch: ... |
168 |
#define MT_MAX_MAXCONTACT 250 |
9498f954a HID: hid-multitou... |
169 |
|
2c2110e90 HID: hid-multitou... |
170 171 |
#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p) #define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p) |
5519cab47 HID: hid-multitou... |
172 173 174 175 |
/* * these device-dependent functions determine what slot corresponds * to a valid contact that was just read. */ |
a3b5e577d HID: hid-multitou... |
176 177 178 179 180 181 182 |
static int cypress_compute_slot(struct mt_device *td) { if (td->curdata.contactid != 0 || td->num_received == 0) return td->curdata.contactid; else return -1; } |
b3c21d2ca HID: multitouch: ... |
183 |
static struct mt_class mt_classes[] = { |
2d93666e7 HID: hid-multitou... |
184 |
{ .name = MT_CLS_DEFAULT, |
dc3e1d805 HID: multitouch: ... |
185 186 187 |
.quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE }, { .name = MT_CLS_NSMU, |
9498f954a HID: hid-multitou... |
188 |
.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP }, |
a062cc5a7 HID: hid-multitou... |
189 190 |
{ .name = MT_CLS_SERIAL, .quirks = MT_QUIRK_ALWAYS_VALID}, |
22408283b HID: hid-multitou... |
191 192 |
{ .name = MT_CLS_CONFIDENCE, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE }, |
5e7ea11f6 HID: multitouch: ... |
193 194 195 |
{ .name = MT_CLS_CONFIDENCE_CONTACT_ID, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | MT_QUIRK_SLOT_IS_CONTACTID }, |
22408283b HID: hid-multitou... |
196 197 198 |
{ .name = MT_CLS_CONFIDENCE_MINUS_ONE, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE }, |
1e9cf35b9 HID: hid-multitou... |
199 |
{ .name = MT_CLS_DUAL_INRANGE_CONTACTID, |
2d93666e7 HID: hid-multitou... |
200 201 202 |
.quirks = MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTID, .maxcontacts = 2 }, |
1e9cf35b9 HID: hid-multitou... |
203 |
{ .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
2d93666e7 HID: hid-multitou... |
204 205 206 |
.quirks = MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER, .maxcontacts = 2 }, |
b7ea95ff9 HID: multitouch: ... |
207 208 209 |
{ .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks = MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, |
f961bd351 HID: detect Win 8... |
210 211 212 213 |
{ .name = MT_CLS_WIN_8, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_IGNORE_DUPLICATES | MT_QUIRK_HOVERING | |
4f4001bc7 HID: multitouch: ... |
214 215 |
MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_STICKY_FINGERS }, |
6aef704e3 HID: multitouch: ... |
216 217 218 219 |
{ .name = MT_CLS_EXPORT_ALL_INPUTS, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE, .export_all_inputs = true }, |
504c932c7 HID: multitouch: ... |
220 221 222 223 224 225 |
{ .name = MT_CLS_WIN_8_DUAL, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_IGNORE_DUPLICATES | MT_QUIRK_HOVERING | MT_QUIRK_CONTACT_CNT_ACCURATE, .export_all_inputs = true }, |
22408283b HID: hid-multitou... |
226 227 228 229 230 231 |
/* * vendor specific classes */ { .name = MT_CLS_3M, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | |
e9d0a26d3 HID: multitouch: ... |
232 233 |
MT_QUIRK_SLOT_IS_CONTACTID | MT_QUIRK_TOUCH_SIZE_SCALING, |
22408283b HID: hid-multitou... |
234 235 |
.sn_move = 2048, .sn_width = 128, |
c5d40be5f HID: hid-multitou... |
236 237 238 |
.sn_height = 128, .maxcontacts = 60, }, |
4875ac114 HID: merge hid-eg... |
239 240 |
{ .name = MT_CLS_EGALAX, .quirks = MT_QUIRK_SLOT_IS_CONTACTID | |
2261bb9ff HID: multitouch: ... |
241 |
MT_QUIRK_VALID_IS_INRANGE, |
4875ac114 HID: merge hid-eg... |
242 243 244 |
.sn_move = 4096, .sn_pressure = 32, }, |
1b723e8dc HID: multitouch: ... |
245 246 247 |
{ .name = MT_CLS_EGALAX_SERIAL, .quirks = MT_QUIRK_SLOT_IS_CONTACTID | MT_QUIRK_ALWAYS_VALID, |
4875ac114 HID: merge hid-eg... |
248 249 250 |
.sn_move = 4096, .sn_pressure = 32, }, |
847672cd1 HID: multitouch: ... |
251 252 253 254 255 |
{ .name = MT_CLS_TOPSEED, .quirks = MT_QUIRK_ALWAYS_VALID, .is_indirect = true, .maxcontacts = 2, }, |
2258e863b HID: multitouch: ... |
256 257 258 |
{ .name = MT_CLS_PANASONIC, .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP, .maxcontacts = 4 }, |
f5ff4e1e6 HID: multitouch: ... |
259 260 261 |
{ .name = MT_CLS_GENERALTOUCH_TWOFINGERS, .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | MT_QUIRK_VALID_IS_INRANGE | |
7b2262920 HID: multitouch: ... |
262 |
MT_QUIRK_SLOT_IS_CONTACTID, |
f5ff4e1e6 HID: multitouch: ... |
263 264 265 266 |
.maxcontacts = 2 }, { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
7b2262920 HID: multitouch: ... |
267 |
MT_QUIRK_SLOT_IS_CONTACTID |
f5ff4e1e6 HID: multitouch: ... |
268 |
}, |
043b403ae HID: hid-multitou... |
269 |
|
77723e3bc HID: hid-multitou... |
270 271 272 273 274 275 |
{ .name = MT_CLS_FLATFROG, .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | MT_QUIRK_NO_AREA, .sn_move = 2048, .maxcontacts = 40, }, |
f3287a995 HID: multitouch: ... |
276 277 278 279 280 281 |
{ .name = MT_CLS_LG, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_FIX_CONST_CONTACT_ID | MT_QUIRK_IGNORE_DUPLICATES | MT_QUIRK_HOVERING | MT_QUIRK_CONTACT_CNT_ACCURATE }, |
957b8dffa HID: multitouch: ... |
282 283 284 285 |
{ .name = MT_CLS_ASUS, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_ASUS_CUSTOM_UP }, |
da10bc252 HID: multitouch: ... |
286 287 288 289 290 |
{ .name = MT_CLS_VTL, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_FORCE_GET_FEATURE, }, |
0e82232c4 HID: multitouch: ... |
291 292 293 294 295 296 |
{ .name = MT_CLS_GOOGLE, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SLOT_IS_CONTACTID | MT_QUIRK_HOVERING }, |
2d93666e7 HID: hid-multitou... |
297 |
{ } |
5519cab47 HID: hid-multitou... |
298 |
}; |
eec29e3da HID: multitouch: ... |
299 300 301 302 |
static ssize_t mt_show_quirks(struct device *dev, struct device_attribute *attr, char *buf) { |
ee79a8f84 HID: use to_hid_d... |
303 |
struct hid_device *hdev = to_hid_device(dev); |
eec29e3da HID: multitouch: ... |
304 305 306 307 308 309 310 311 312 313 |
struct mt_device *td = hid_get_drvdata(hdev); return sprintf(buf, "%u ", td->mtclass.quirks); } static ssize_t mt_set_quirks(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { |
ee79a8f84 HID: use to_hid_d... |
314 |
struct hid_device *hdev = to_hid_device(dev); |
eec29e3da HID: multitouch: ... |
315 316 317 318 319 320 321 322 |
struct mt_device *td = hid_get_drvdata(hdev); unsigned long val; if (kstrtoul(buf, 0, &val)) return -EINVAL; td->mtclass.quirks = val; |
7e3cc447f HID: multitouch: ... |
323 |
if (td->cc_index < 0) |
c2517f62d HID: multitouch: ... |
324 |
td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
eec29e3da HID: multitouch: ... |
325 326 327 328 329 330 331 332 333 |
return count; } static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks); static struct attribute *sysfs_attrs[] = { &dev_attr_quirks.attr, NULL }; |
9182fb98d HID: multitouch: ... |
334 |
static const struct attribute_group mt_attribute_group = { |
eec29e3da HID: multitouch: ... |
335 336 |
.attrs = sysfs_attrs }; |
6d4f5440a HID: multitouch: ... |
337 338 339 |
static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) { struct mt_device *td = hid_get_drvdata(hdev); |
f671ac7a5 HID: Fix hid_repo... |
340 341 |
int ret; u32 size = hid_report_len(report); |
6d4f5440a HID: multitouch: ... |
342 343 344 |
u8 *buf; /* |
b897f6db3 HID: multitouch: ... |
345 346 |
* Do not fetch the feature report if the device has been explicitly * marked as non-capable. |
6d4f5440a HID: multitouch: ... |
347 |
*/ |
b897f6db3 HID: multitouch: ... |
348 |
if (td->initial_quirks & HID_QUIRK_NO_INIT_REPORTS) |
6d4f5440a HID: multitouch: ... |
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
return; buf = hid_alloc_report_buf(report, GFP_KERNEL); if (!buf) return; ret = hid_hw_raw_request(hdev, report->id, buf, size, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); if (ret < 0) { dev_warn(&hdev->dev, "failed to fetch feature %d ", report->id); } else { ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf, size, 0); if (ret) dev_warn(&hdev->dev, "failed to report feature "); } kfree(buf); } |
f635bd11c HID: Do not creat... |
371 |
static void mt_feature_mapping(struct hid_device *hdev, |
5519cab47 HID: hid-multitou... |
372 373 |
struct hid_field *field, struct hid_usage *usage) { |
9498f954a HID: hid-multitou... |
374 375 376 377 |
struct mt_device *td = hid_get_drvdata(hdev); switch (usage->hid) { case HID_DG_INPUTMODE: |
8821f5dc1 HID: multitouch: ... |
378 379 380 381 382 |
/* Ignore if value index is out of bounds. */ if (usage->usage_index >= field->report_count) { dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range "); break; |
4aceed37e HID: hid-multitou... |
383 |
} |
73e7d63ef HID: multitouch: ... |
384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
if (td->inputmode < 0) { td->inputmode = field->report->id; td->inputmode_index = usage->usage_index; } else { /* * Some elan panels wrongly declare 2 input mode * features, and silently ignore when we set the * value in the second field. Skip the second feature * and hope for the best. */ dev_info(&hdev->dev, "Ignoring the extra HID_DG_INPUTMODE "); } |
8821f5dc1 HID: multitouch: ... |
398 |
|
9498f954a HID: hid-multitou... |
399 400 |
break; case HID_DG_CONTACTMAX: |
6d4f5440a HID: multitouch: ... |
401 |
mt_get_feature(hdev, field->report); |
31ae9bddb HID: multitouch: ... |
402 |
td->maxcontact_report_id = field->report->id; |
9498f954a HID: hid-multitou... |
403 |
td->maxcontacts = field->value[0]; |
afbcb04c1 HID: multitouch: ... |
404 405 406 |
if (!td->maxcontacts && field->logical_maximum <= MT_MAX_MAXCONTACT) td->maxcontacts = field->logical_maximum; |
eec29e3da HID: multitouch: ... |
407 |
if (td->mtclass.maxcontacts) |
9498f954a HID: hid-multitou... |
408 |
/* check if the maxcontacts is given by the class */ |
eec29e3da HID: multitouch: ... |
409 |
td->maxcontacts = td->mtclass.maxcontacts; |
9498f954a HID: hid-multitou... |
410 411 |
break; |
2c6e0277e HID: multitouch: ... |
412 413 414 415 416 417 |
case HID_DG_BUTTONTYPE: if (usage->usage_index >= field->report_count) { dev_err(&hdev->dev, "HID_DG_BUTTONTYPE out of range "); break; } |
6d4f5440a HID: multitouch: ... |
418 |
mt_get_feature(hdev, field->report); |
2c6e0277e HID: multitouch: ... |
419 420 421 422 |
if (field->value[usage->usage_index] == MT_BUTTONTYPE_CLICKPAD) td->is_buttonpad = true; break; |
45c5c6828 HID: multitouch: ... |
423 424 425 426 427 |
case 0xff0000c5: /* Retrieve the Win8 blob once to enable some devices */ if (usage->usage_index == 0) mt_get_feature(hdev, field->report); break; |
5519cab47 HID: hid-multitou... |
428 429 430 431 432 433 434 435 436 437 |
} } static void set_abs(struct input_dev *input, unsigned int code, struct hid_field *field, int snratio) { int fmin = field->logical_minimum; int fmax = field->logical_maximum; int fuzz = snratio ? (fmax - fmin) / snratio : 0; input_set_abs_params(input, code, fmin, fmax, fuzz, 0); |
37cf6e6fc HID: export hidin... |
438 |
input_abs_set_res(input, code, hidinput_calc_abs_res(field, code)); |
5519cab47 HID: hid-multitou... |
439 |
} |
3ac36d155 HID: hid-multitou... |
440 |
static void mt_store_field(struct hid_usage *usage, struct mt_device *td, |
ed9d5c961 HID: multitouch: ... |
441 442 |
struct hid_input *hi) { |
3ac36d155 HID: hid-multitou... |
443 444 445 446 447 448 |
struct mt_fields *f = td->fields; if (f->length >= HID_MAX_FIELDS) return; f->usages[f->length++] = usage->hid; |
ed9d5c961 HID: multitouch: ... |
449 |
} |
a69c5f8b1 HID: multitouch: ... |
450 |
static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
5519cab47 HID: hid-multitou... |
451 452 453 454 |
struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { struct mt_device *td = hid_get_drvdata(hdev); |
eec29e3da HID: multitouch: ... |
455 |
struct mt_class *cls = &td->mtclass; |
c2ef8f21e HID: multitouch: ... |
456 |
int code; |
349fd6705 HID: multitouch: ... |
457 |
struct hid_usage *prev_usage = NULL; |
4875ac114 HID: merge hid-eg... |
458 |
|
658d4aed5 HID: hid-multitou... |
459 |
if (field->application == HID_DG_TOUCHSCREEN) |
76f5902ae HID: hid-multitou... |
460 |
td->mt_flags |= INPUT_MT_DIRECT; |
658d4aed5 HID: hid-multitou... |
461 |
|
76f5902ae HID: hid-multitou... |
462 463 |
/* * Model touchscreens providing buttons as touchpads. |
c2ef8f21e HID: multitouch: ... |
464 465 |
*/ if (field->application == HID_DG_TOUCHPAD || |
9abebedb1 HID: multitouch: ... |
466 |
(usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { |
76f5902ae HID: hid-multitou... |
467 |
td->mt_flags |= INPUT_MT_POINTER; |
9abebedb1 HID: multitouch: ... |
468 469 |
td->inputmode_value = MT_INPUTMODE_TOUCHPAD; } |
c2ef8f21e HID: multitouch: ... |
470 |
|
015fdaa9f HID: multitouch: ... |
471 472 473 |
/* count the buttons on touchpads */ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) td->buttons_count++; |
349fd6705 HID: multitouch: ... |
474 475 |
if (usage->usage_index) prev_usage = &field->usage[usage->usage_index - 1]; |
5519cab47 HID: hid-multitou... |
476 477 478 479 480 |
switch (usage->hid & HID_USAGE_PAGE) { case HID_UP_GENDESK: switch (usage->hid) { case HID_GD_X: |
349fd6705 HID: multitouch: ... |
481 482 483 484 485 486 487 |
if (prev_usage && (prev_usage->hid == usage->hid)) { hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOOL_X); set_abs(hi->input, ABS_MT_TOOL_X, field, cls->sn_move); } else { hid_map_usage(hi, usage, bit, max, |
5519cab47 HID: hid-multitou... |
488 |
EV_ABS, ABS_MT_POSITION_X); |
349fd6705 HID: multitouch: ... |
489 490 491 |
set_abs(hi->input, ABS_MT_POSITION_X, field, cls->sn_move); } |
3ac36d155 HID: hid-multitou... |
492 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
493 494 |
return 1; case HID_GD_Y: |
349fd6705 HID: multitouch: ... |
495 496 497 498 499 500 501 |
if (prev_usage && (prev_usage->hid == usage->hid)) { hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOOL_Y); set_abs(hi->input, ABS_MT_TOOL_Y, field, cls->sn_move); } else { hid_map_usage(hi, usage, bit, max, |
5519cab47 HID: hid-multitou... |
502 |
EV_ABS, ABS_MT_POSITION_Y); |
349fd6705 HID: multitouch: ... |
503 504 505 |
set_abs(hi->input, ABS_MT_POSITION_Y, field, cls->sn_move); } |
3ac36d155 HID: hid-multitou... |
506 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
507 508 509 510 511 512 513 |
return 1; } return 0; case HID_UP_DIGITIZER: switch (usage->hid) { case HID_DG_INRANGE: |
9b3bb9b8b HID: multitouch: ... |
514 515 516 517 518 519 |
if (cls->quirks & MT_QUIRK_HOVERING) { hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_DISTANCE); input_set_abs_params(hi->input, ABS_MT_DISTANCE, 0, 1, 0, 0); } |
3ac36d155 HID: hid-multitou... |
520 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
521 522 |
return 1; case HID_DG_CONFIDENCE: |
504c932c7 HID: multitouch: ... |
523 524 |
if ((cls->name == MT_CLS_WIN_8 || cls->name == MT_CLS_WIN_8_DUAL) && |
6dd2e27a1 HID: multitouch: ... |
525 526 |
field->application == HID_DG_TOUCHPAD) cls->quirks |= MT_QUIRK_CONFIDENCE; |
3ac36d155 HID: hid-multitou... |
527 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
528 529 530 531 |
return 1; case HID_DG_TIPSWITCH: hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); input_set_capability(hi->input, EV_KEY, BTN_TOUCH); |
3ac36d155 HID: hid-multitou... |
532 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
533 534 |
return 1; case HID_DG_CONTACTID: |
3ac36d155 HID: hid-multitou... |
535 |
mt_store_field(usage, td, hi); |
9e87f22ac HID: multitouch: ... |
536 |
td->touches_by_report++; |
55978fa9d HID: multitouch: ... |
537 |
td->mt_report_id = field->report->id; |
5519cab47 HID: hid-multitou... |
538 539 540 541 |
return 1; case HID_DG_WIDTH: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOUCH_MAJOR); |
77723e3bc HID: hid-multitou... |
542 543 544 |
if (!(cls->quirks & MT_QUIRK_NO_AREA)) set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, cls->sn_width); |
3ac36d155 HID: hid-multitou... |
545 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
546 547 548 549 |
return 1; case HID_DG_HEIGHT: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOUCH_MINOR); |
77723e3bc HID: hid-multitou... |
550 551 552 553 |
if (!(cls->quirks & MT_QUIRK_NO_AREA)) { set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, cls->sn_height); input_set_abs_params(hi->input, |
1e648a137 HID: hid-multitou... |
554 |
ABS_MT_ORIENTATION, 0, 1, 0, 0); |
77723e3bc HID: hid-multitou... |
555 |
} |
3ac36d155 HID: hid-multitou... |
556 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
557 558 559 560 561 562 |
return 1; case HID_DG_TIPPRESSURE: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_PRESSURE); set_abs(hi->input, ABS_MT_PRESSURE, field, cls->sn_pressure); |
3ac36d155 HID: hid-multitou... |
563 |
mt_store_field(usage, td, hi); |
5519cab47 HID: hid-multitou... |
564 565 |
return 1; case HID_DG_CONTACTCOUNT: |
8821f5dc1 HID: multitouch: ... |
566 567 568 569 |
/* Ignore if indexes are out of bounds. */ if (field->index >= field->report->maxfield || usage->usage_index >= field->report_count) return 1; |
7e3cc447f HID: multitouch: ... |
570 571 |
td->cc_index = field->index; td->cc_value_index = usage->usage_index; |
5519cab47 HID: hid-multitou... |
572 573 574 575 576 |
return 1; case HID_DG_CONTACTMAX: /* we don't set td->last_slot_field as contactcount and * contact max are global to the report */ return -1; |
c2ef8f21e HID: multitouch: ... |
577 578 579 580 |
case HID_DG_TOUCH: /* Legacy devices use TIPSWITCH and not TOUCH. * Let's just ignore this field. */ return -1; |
65b258e9b HID: multitouch: ... |
581 |
} |
5519cab47 HID: hid-multitou... |
582 583 |
/* let hid-input decide for the others */ return 0; |
c2ef8f21e HID: multitouch: ... |
584 585 |
case HID_UP_BUTTON: code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE); |
594312b88 HID: multitouch: ... |
586 587 588 589 |
/* * MS PTP spec says that external buttons left and right have * usages 2 and 3. */ |
504c932c7 HID: multitouch: ... |
590 591 |
if ((cls->name == MT_CLS_WIN_8 || cls->name == MT_CLS_WIN_8_DUAL) && |
594312b88 HID: multitouch: ... |
592 593 594 |
field->application == HID_DG_TOUCHPAD && (usage->hid & HID_USAGE) > 1) code--; |
c2ef8f21e HID: multitouch: ... |
595 596 597 |
hid_map_usage(hi, usage, bit, max, EV_KEY, code); input_set_capability(hi->input, EV_KEY, code); return 1; |
5519cab47 HID: hid-multitou... |
598 599 600 601 602 603 604 |
case 0xff000000: /* we do not want to map these: no input-oriented meaning */ return -1; } return 0; } |
3e1b5015d HID: hid-multitou... |
605 |
static int mt_compute_slot(struct mt_device *td, struct input_dev *input) |
5519cab47 HID: hid-multitou... |
606 |
{ |
eec29e3da HID: multitouch: ... |
607 |
__s32 quirks = td->mtclass.quirks; |
5519cab47 HID: hid-multitou... |
608 |
|
2d93666e7 HID: hid-multitou... |
609 610 |
if (quirks & MT_QUIRK_SLOT_IS_CONTACTID) return td->curdata.contactid; |
5519cab47 HID: hid-multitou... |
611 |
|
2d93666e7 HID: hid-multitou... |
612 |
if (quirks & MT_QUIRK_CYPRESS) |
a3b5e577d HID: hid-multitou... |
613 |
return cypress_compute_slot(td); |
2d93666e7 HID: hid-multitou... |
614 615 |
if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER) return td->num_received; |
5572da08a HID: hid-mulitouc... |
616 |
|
4a6ee685f HID: hid-multitou... |
617 618 |
if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE) return td->curdata.contactid - 1; |
3e1b5015d HID: hid-multitou... |
619 |
return input_mt_get_slot_by_key(input, td->curdata.contactid); |
5519cab47 HID: hid-multitou... |
620 621 622 623 624 625 |
} /* * this function is called when a whole contact has been processed, * so that it can assign it to a slot and store the data there */ |
3e1b5015d HID: hid-multitou... |
626 |
static void mt_complete_slot(struct mt_device *td, struct input_dev *input) |
5519cab47 HID: hid-multitou... |
627 |
{ |
c2517f62d HID: multitouch: ... |
628 629 630 |
if ((td->mtclass.quirks & MT_QUIRK_CONTACT_CNT_ACCURATE) && td->num_received >= td->num_expected) return; |
20b60e6de HID: multitouch: ... |
631 |
if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { |
6dd2e27a1 HID: multitouch: ... |
632 |
int active; |
3e1b5015d HID: hid-multitou... |
633 634 |
int slotnum = mt_compute_slot(td, input); struct mt_slot *s = &td->curdata; |
287283990 HID: multitouch: ... |
635 |
struct input_mt *mt = input->mt; |
5519cab47 HID: hid-multitou... |
636 |
|
3e1b5015d HID: hid-multitou... |
637 638 |
if (slotnum < 0 || slotnum >= td->maxcontacts) return; |
5519cab47 HID: hid-multitou... |
639 |
|
287283990 HID: multitouch: ... |
640 641 642 643 644 645 |
if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { struct input_mt_slot *slot = &mt->slots[slotnum]; if (input_mt_is_active(slot) && input_mt_is_used(mt, slot)) return; } |
6dd2e27a1 HID: multitouch: ... |
646 647 648 649 |
if (!(td->mtclass.quirks & MT_QUIRK_CONFIDENCE)) s->confidence_state = 1; active = (s->touch_state || s->inrange_state) && s->confidence_state; |
3e1b5015d HID: hid-multitou... |
650 |
input_mt_slot(input, slotnum); |
6dd2e27a1 HID: multitouch: ... |
651 652 |
input_mt_report_slot_state(input, MT_TOOL_FINGER, active); if (active) { |
9b3bb9b8b HID: multitouch: ... |
653 |
/* this finger is in proximity of the sensor */ |
f786bba44 HID: hid-multitou... |
654 |
int wide = (s->w > s->h); |
e9d0a26d3 HID: multitouch: ... |
655 656 657 658 659 660 661 662 663 664 665 |
int major = max(s->w, s->h); int minor = min(s->w, s->h); /* * divided by two to match visual scale of touch * for devices with this quirk */ if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) { major = major >> 1; minor = minor >> 1; } |
f786bba44 HID: hid-multitou... |
666 |
|
2d93666e7 HID: hid-multitou... |
667 668 |
input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y); |
349fd6705 HID: multitouch: ... |
669 670 |
input_event(input, EV_ABS, ABS_MT_TOOL_X, s->cx); input_event(input, EV_ABS, ABS_MT_TOOL_Y, s->cy); |
9b3bb9b8b HID: multitouch: ... |
671 672 |
input_event(input, EV_ABS, ABS_MT_DISTANCE, !s->touch_state); |
f786bba44 HID: hid-multitou... |
673 |
input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); |
2d93666e7 HID: hid-multitou... |
674 |
input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p); |
f786bba44 HID: hid-multitou... |
675 676 |
input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); |
960982745 HID: multitouch: ... |
677 678 |
set_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags); |
2d93666e7 HID: hid-multitou... |
679 |
} |
5519cab47 HID: hid-multitou... |
680 |
} |
3e1b5015d HID: hid-multitou... |
681 682 683 684 685 686 687 688 689 |
td->num_received++; } /* * this function is called when a whole packet has been received and processed, * so that it can decide what to send to the input layer. */ static void mt_sync_frame(struct mt_device *td, struct input_dev *input) { |
76f5902ae HID: hid-multitou... |
690 |
input_mt_sync_frame(input); |
5519cab47 HID: hid-multitou... |
691 692 |
input_sync(input); td->num_received = 0; |
960982745 HID: multitouch: ... |
693 694 695 696 697 |
if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags)) set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags); else clear_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags); clear_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags); |
5519cab47 HID: hid-multitou... |
698 |
} |
a69c5f8b1 HID: multitouch: ... |
699 |
static int mt_touch_event(struct hid_device *hid, struct hid_field *field, |
5519cab47 HID: hid-multitou... |
700 701 |
struct hid_usage *usage, __s32 value) { |
55978fa9d HID: multitouch: ... |
702 703 704 705 706 707 708 709 |
/* we will handle the hidinput part later, now remains hiddev */ if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) hid->hiddev_hid_event(hid, field, usage, value); return 1; } static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, |
addf1ae9f HID: multitouch: ... |
710 711 |
struct hid_usage *usage, __s32 value, bool first_packet) |
55978fa9d HID: multitouch: ... |
712 |
{ |
5519cab47 HID: hid-multitou... |
713 |
struct mt_device *td = hid_get_drvdata(hid); |
addf1ae9f HID: multitouch: ... |
714 |
__s32 cls = td->mtclass.name; |
eec29e3da HID: multitouch: ... |
715 |
__s32 quirks = td->mtclass.quirks; |
4c4375550 HID: multitouch: ... |
716 |
struct input_dev *input = field->hidinput->input; |
5519cab47 HID: hid-multitou... |
717 |
|
3e1b5015d HID: hid-multitou... |
718 |
if (hid->claimed & HID_CLAIMED_INPUT) { |
5519cab47 HID: hid-multitou... |
719 720 |
switch (usage->hid) { case HID_DG_INRANGE: |
20b60e6de HID: multitouch: ... |
721 |
if (quirks & MT_QUIRK_VALID_IS_INRANGE) |
2d93666e7 HID: hid-multitou... |
722 |
td->curvalid = value; |
9b3bb9b8b HID: multitouch: ... |
723 724 |
if (quirks & MT_QUIRK_HOVERING) td->curdata.inrange_state = value; |
5519cab47 HID: hid-multitou... |
725 726 |
break; case HID_DG_TIPSWITCH: |
2d93666e7 HID: hid-multitou... |
727 728 |
if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) td->curvalid = value; |
5519cab47 HID: hid-multitou... |
729 730 731 |
td->curdata.touch_state = value; break; case HID_DG_CONFIDENCE: |
6dd2e27a1 HID: multitouch: ... |
732 733 |
if (quirks & MT_QUIRK_CONFIDENCE) td->curdata.confidence_state = value; |
2d93666e7 HID: hid-multitou... |
734 735 |
if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) td->curvalid = value; |
5519cab47 HID: hid-multitou... |
736 737 738 739 740 741 742 743 |
break; case HID_DG_CONTACTID: td->curdata.contactid = value; break; case HID_DG_TIPPRESSURE: td->curdata.p = value; break; case HID_GD_X: |
349fd6705 HID: multitouch: ... |
744 745 746 747 |
if (usage->code == ABS_MT_TOOL_X) td->curdata.cx = value; else td->curdata.x = value; |
5519cab47 HID: hid-multitou... |
748 749 |
break; case HID_GD_Y: |
349fd6705 HID: multitouch: ... |
750 751 752 753 |
if (usage->code == ABS_MT_TOOL_Y) td->curdata.cy = value; else td->curdata.y = value; |
5519cab47 HID: hid-multitou... |
754 755 756 757 758 759 760 761 |
break; case HID_DG_WIDTH: td->curdata.w = value; break; case HID_DG_HEIGHT: td->curdata.h = value; break; case HID_DG_CONTACTCOUNT: |
5519cab47 HID: hid-multitou... |
762 |
break; |
c2ef8f21e HID: multitouch: ... |
763 764 765 |
case HID_DG_TOUCH: /* do nothing */ break; |
5519cab47 HID: hid-multitou... |
766 767 |
default: |
addf1ae9f HID: multitouch: ... |
768 769 770 771 772 773 774 775 |
/* * For Win8 PTP touchpads we should only look at * non finger/touch events in the first_packet of * a (possible) multi-packet frame. */ if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && !first_packet) return; |
4c4375550 HID: multitouch: ... |
776 777 778 |
if (usage->type) input_event(input, usage->type, usage->code, value); |
55978fa9d HID: multitouch: ... |
779 |
return; |
5519cab47 HID: hid-multitou... |
780 |
} |
5519cab47 HID: hid-multitou... |
781 |
|
54f4c0c3e HID: multitouch: ... |
782 783 784 785 |
if (usage->usage_index + 1 == field->report_count) { /* we only take into account the last report. */ if (usage->hid == td->last_slot_field) mt_complete_slot(td, field->hidinput->input); |
54f4c0c3e HID: multitouch: ... |
786 |
} |
5519cab47 HID: hid-multitou... |
787 |
|
2d93666e7 HID: hid-multitou... |
788 |
} |
55978fa9d HID: multitouch: ... |
789 |
} |
5519cab47 HID: hid-multitou... |
790 |
|
a69c5f8b1 HID: multitouch: ... |
791 |
static void mt_touch_report(struct hid_device *hid, struct hid_report *report) |
55978fa9d HID: multitouch: ... |
792 793 794 |
{ struct mt_device *td = hid_get_drvdata(hid); struct hid_field *field; |
addf1ae9f HID: multitouch: ... |
795 |
bool first_packet; |
55978fa9d HID: multitouch: ... |
796 797 |
unsigned count; int r, n; |
5519cab47 HID: hid-multitou... |
798 |
|
4f4001bc7 HID: multitouch: ... |
799 800 801 |
/* sticky fingers release in progress, abort */ if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; |
c2517f62d HID: multitouch: ... |
802 803 804 805 |
/* * Includes multi-packet support where subsequent * packets are sent with zero contactcount. */ |
7e3cc447f HID: multitouch: ... |
806 807 808 809 810 811 |
if (td->cc_index >= 0) { struct hid_field *field = report->field[td->cc_index]; int value = field->value[td->cc_value_index]; if (value) td->num_expected = value; } |
c2517f62d HID: multitouch: ... |
812 |
|
addf1ae9f HID: multitouch: ... |
813 |
first_packet = td->num_received == 0; |
55978fa9d HID: multitouch: ... |
814 815 816 817 818 819 820 821 822 |
for (r = 0; r < report->maxfield; r++) { field = report->field[r]; count = field->report_count; if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) continue; for (n = 0; n < count; n++) mt_process_mt_event(hid, field, &field->usage[n], |
addf1ae9f HID: multitouch: ... |
823 |
field->value[n], first_packet); |
55978fa9d HID: multitouch: ... |
824 |
} |
5b62efd82 HID: multitouch: ... |
825 826 827 |
if (td->num_received >= td->num_expected) mt_sync_frame(td, report->field[0]->hidinput->input); |
4f4001bc7 HID: multitouch: ... |
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
/* * Windows 8 specs says 2 things: * - once a contact has been reported, it has to be reported in each * subsequent report * - the report rate when fingers are present has to be at least * the refresh rate of the screen, 60 or 120 Hz * * I interprete this that the specification forces a report rate of * at least 60 Hz for a touchscreen to be certified. * Which means that if we do not get a report whithin 16 ms, either * something wrong happens, either the touchscreen forgets to send * a release. Taking a reasonable margin allows to remove issues * with USB communication or the load of the machine. * * Given that Win 8 devices are forced to send a release, this will * only affect laggish machines and the ones that have a firmware * defect. */ |
960982745 HID: multitouch: ... |
847 848 849 850 851 852 853 |
if (td->mtclass.quirks & MT_QUIRK_STICKY_FINGERS) { if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mod_timer(&td->release_timer, jiffies + msecs_to_jiffies(100)); else del_timer(&td->release_timer); } |
4f4001bc7 HID: multitouch: ... |
854 855 |
clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); |
5519cab47 HID: hid-multitou... |
856 |
} |
b2c68a2f1 HID: hid-input: a... |
857 |
static int mt_touch_input_configured(struct hid_device *hdev, |
a69c5f8b1 HID: multitouch: ... |
858 859 860 861 862 |
struct hid_input *hi) { struct mt_device *td = hid_get_drvdata(hdev); struct mt_class *cls = &td->mtclass; struct input_dev *input = hi->input; |
b2c68a2f1 HID: hid-input: a... |
863 |
int ret; |
a69c5f8b1 HID: multitouch: ... |
864 865 866 867 868 869 870 871 872 873 874 875 876 |
if (!td->maxcontacts) td->maxcontacts = MT_DEFAULT_MAXCONTACT; mt_post_parse(td); if (td->serial_maybe) mt_post_parse_default_settings(td); if (cls->is_indirect) td->mt_flags |= INPUT_MT_POINTER; if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) td->mt_flags |= INPUT_MT_DROP_UNUSED; |
015fdaa9f HID: multitouch: ... |
877 878 |
/* check for clickpads */ if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1)) |
2c6e0277e HID: multitouch: ... |
879 880 881 |
td->is_buttonpad = true; if (td->is_buttonpad) |
015fdaa9f HID: multitouch: ... |
882 |
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit); |
b2c68a2f1 HID: hid-input: a... |
883 884 885 |
ret = input_mt_init_slots(input, td->maxcontacts, td->mt_flags); if (ret) return ret; |
a69c5f8b1 HID: multitouch: ... |
886 887 |
td->mt_flags = 0; |
b2c68a2f1 HID: hid-input: a... |
888 |
return 0; |
a69c5f8b1 HID: multitouch: ... |
889 |
} |
957b8dffa HID: multitouch: ... |
890 891 |
#define mt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \ max, EV_KEY, (c)) |
a69c5f8b1 HID: multitouch: ... |
892 893 894 895 |
static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { |
6aef704e3 HID: multitouch: ... |
896 897 898 899 900 901 902 903 904 905 |
struct mt_device *td = hid_get_drvdata(hdev); /* * If mtclass.export_all_inputs is not set, only map fields from * TouchScreen or TouchPad collections. We need to ignore fields * that belong to other collections such as Mouse that might have * the same GenericDesktop usages. */ if (!td->mtclass.export_all_inputs && field->application != HID_DG_TOUCHSCREEN && |
fa11aa72b HID: multitouch: ... |
906 |
field->application != HID_DG_PEN && |
8fe89ef07 HID: multitouch: ... |
907 908 |
field->application != HID_DG_TOUCHPAD && field->application != HID_GD_KEYBOARD && |
e57f4e67a HID: multitouch: ... |
909 |
field->application != HID_GD_SYSTEM_CONTROL && |
1fbf74efe HID: multitouch: ... |
910 |
field->application != HID_CP_CONSUMER_CONTROL && |
957b8dffa HID: multitouch: ... |
911 912 913 |
field->application != HID_GD_WIRELESS_RADIO_CTLS && !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS && td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP)) |
6f492f287 HID: multitouch: ... |
914 |
return -1; |
a69c5f8b1 HID: multitouch: ... |
915 |
|
6aef704e3 HID: multitouch: ... |
916 |
/* |
957b8dffa HID: multitouch: ... |
917 918 919 920 |
* Some Asus keyboard+touchpad devices have the hotkeys defined in the * touchpad report descriptor. We need to treat these as an array to * map usages to input keys. */ |
39bbf4022 HID: multitouch: ... |
921 |
if (field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS && |
957b8dffa HID: multitouch: ... |
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 |
td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP && (usage->hid & HID_USAGE_PAGE) == HID_UP_CUSTOM) { set_bit(EV_REP, hi->input->evbit); if (field->flags & HID_MAIN_ITEM_VARIABLE) field->flags &= ~HID_MAIN_ITEM_VARIABLE; switch (usage->hid & HID_USAGE) { case 0x10: mt_map_key_clear(KEY_BRIGHTNESSDOWN); break; case 0x20: mt_map_key_clear(KEY_BRIGHTNESSUP); break; case 0x35: mt_map_key_clear(KEY_DISPLAY_OFF); break; case 0x6b: mt_map_key_clear(KEY_F21); break; case 0x6c: mt_map_key_clear(KEY_SLEEP); break; default: return -1; } return 1; } /* |
6aef704e3 HID: multitouch: ... |
940 941 |
* some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" * for the stylus. |
1cc1cc92c HID: multitouch: ... |
942 943 944 |
* The check for mt_report_id ensures we don't process * HID_DG_CONTACTCOUNT from the pen report as it is outside the physical * collection, but within the report ID. |
6aef704e3 HID: multitouch: ... |
945 |
*/ |
a69c5f8b1 HID: multitouch: ... |
946 |
if (field->physical == HID_DG_STYLUS) |
e55f62008 HID: multitouch: ... |
947 |
return 0; |
1cc1cc92c HID: multitouch: ... |
948 949 950 951 |
else if ((field->physical == 0) && (field->report->id != td->mt_report_id) && (td->mt_report_id != -1)) return 0; |
a69c5f8b1 HID: multitouch: ... |
952 |
|
6aef704e3 HID: multitouch: ... |
953 954 955 956 957 958 |
if (field->application == HID_DG_TOUCHSCREEN || field->application == HID_DG_TOUCHPAD) return mt_touch_input_mapping(hdev, hi, field, usage, bit, max); /* let hid-core decide for the others */ return 0; |
a69c5f8b1 HID: multitouch: ... |
959 960 961 962 963 964 |
} static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { |
6aef704e3 HID: multitouch: ... |
965 966 967 968 |
/* * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" * for the stylus. */ |
fa11aa72b HID: multitouch: ... |
969 |
if (field->physical == HID_DG_STYLUS) |
e55f62008 HID: multitouch: ... |
970 |
return 0; |
fa11aa72b HID: multitouch: ... |
971 |
|
6aef704e3 HID: multitouch: ... |
972 |
if (field->application == HID_DG_TOUCHSCREEN || |
4cf56a89c HID: multitouch: ... |
973 974 975 976 |
field->application == HID_DG_TOUCHPAD) { /* We own these mappings, tell hid-input to ignore them */ return -1; } |
6aef704e3 HID: multitouch: ... |
977 978 979 |
/* let hid-core decide for the others */ return 0; |
a69c5f8b1 HID: multitouch: ... |
980 981 982 983 984 985 986 987 988 |
} static int mt_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) { struct mt_device *td = hid_get_drvdata(hid); if (field->report->id == td->mt_report_id) return mt_touch_event(hid, field, usage, value); |
e55f62008 HID: multitouch: ... |
989 |
return 0; |
a69c5f8b1 HID: multitouch: ... |
990 991 992 993 994 |
} static void mt_report(struct hid_device *hid, struct hid_report *report) { struct mt_device *td = hid_get_drvdata(hid); |
e55f62008 HID: multitouch: ... |
995 |
struct hid_field *field = report->field[0]; |
a69c5f8b1 HID: multitouch: ... |
996 997 998 999 1000 |
if (!(hid->claimed & HID_CLAIMED_INPUT)) return; if (report->id == td->mt_report_id) |
e55f62008 HID: multitouch: ... |
1001 |
return mt_touch_report(hid, report); |
fa11aa72b HID: multitouch: ... |
1002 |
|
e55f62008 HID: multitouch: ... |
1003 1004 |
if (field && field->hidinput && field->hidinput->input) input_sync(field->hidinput->input); |
5519cab47 HID: hid-multitou... |
1005 1006 1007 1008 1009 1010 1011 |
} static void mt_set_input_mode(struct hid_device *hdev) { struct mt_device *td = hid_get_drvdata(hdev); struct hid_report *r; struct hid_report_enum *re; |
da10bc252 HID: multitouch: ... |
1012 1013 |
struct mt_class *cls = &td->mtclass; char *buf; |
f671ac7a5 HID: Fix hid_repo... |
1014 |
u32 report_len; |
5519cab47 HID: hid-multitou... |
1015 1016 1017 1018 1019 1020 1021 |
if (td->inputmode < 0) return; re = &(hdev->report_enum[HID_FEATURE_REPORT]); r = re->report_id_hash[td->inputmode]; if (r) { |
da10bc252 HID: multitouch: ... |
1022 |
if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) { |
dabb05c66 HID: make hid_rep... |
1023 |
report_len = hid_report_len(r); |
da10bc252 HID: multitouch: ... |
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
buf = hid_alloc_report_buf(r, GFP_KERNEL); if (!buf) { hid_err(hdev, "failed to allocate buffer for report "); return; } hid_hw_raw_request(hdev, r->id, buf, report_len, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); kfree(buf); } |
9abebedb1 HID: multitouch: ... |
1035 |
r->field[0]->value[td->inputmode_index] = td->inputmode_value; |
d88142725 HID: use hid_hw_r... |
1036 |
hid_hw_request(hdev, r, HID_REQ_SET_REPORT); |
5519cab47 HID: hid-multitou... |
1037 1038 |
} } |
31ae9bddb HID: multitouch: ... |
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 |
static void mt_set_maxcontacts(struct hid_device *hdev) { struct mt_device *td = hid_get_drvdata(hdev); struct hid_report *r; struct hid_report_enum *re; int fieldmax, max; if (td->maxcontact_report_id < 0) return; if (!td->mtclass.maxcontacts) return; re = &hdev->report_enum[HID_FEATURE_REPORT]; r = re->report_id_hash[td->maxcontact_report_id]; if (r) { max = td->mtclass.maxcontacts; fieldmax = r->field[0]->logical_maximum; max = min(fieldmax, max); if (r->field[0]->value[0] != max) { r->field[0]->value[0] = max; |
d88142725 HID: use hid_hw_r... |
1060 |
hid_hw_request(hdev, r, HID_REQ_SET_REPORT); |
31ae9bddb HID: multitouch: ... |
1061 1062 1063 |
} } } |
4fa3a5837 HID: hid-multitou... |
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 |
static void mt_post_parse_default_settings(struct mt_device *td) { __s32 quirks = td->mtclass.quirks; /* unknown serial device needs special quirks */ if (td->touches_by_report == 1) { quirks |= MT_QUIRK_ALWAYS_VALID; quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP; quirks &= ~MT_QUIRK_VALID_IS_INRANGE; quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE; |
e0bb8f9ad HID: multitouch: ... |
1074 |
quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
4fa3a5837 HID: hid-multitou... |
1075 1076 1077 1078 |
} td->mtclass.quirks = quirks; } |
3ac36d155 HID: hid-multitou... |
1079 1080 1081 |
static void mt_post_parse(struct mt_device *td) { struct mt_fields *f = td->fields; |
c2517f62d HID: multitouch: ... |
1082 |
struct mt_class *cls = &td->mtclass; |
3ac36d155 HID: hid-multitou... |
1083 1084 1085 1086 1087 |
if (td->touches_by_report > 0) { int field_count_per_touch = f->length / td->touches_by_report; td->last_slot_field = f->usages[field_count_per_touch - 1]; } |
c2517f62d HID: multitouch: ... |
1088 |
|
7e3cc447f HID: multitouch: ... |
1089 |
if (td->cc_index < 0) |
c2517f62d HID: multitouch: ... |
1090 |
cls->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; |
3ac36d155 HID: hid-multitou... |
1091 |
} |
b2c68a2f1 HID: hid-input: a... |
1092 |
static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) |
76f5902ae HID: hid-multitou... |
1093 1094 |
{ struct mt_device *td = hid_get_drvdata(hdev); |
c08d46aa8 HID: multitouch: ... |
1095 1096 |
char *name; const char *suffix = NULL; |
6aef704e3 HID: multitouch: ... |
1097 |
struct hid_field *field = hi->report->field[0]; |
b2c68a2f1 HID: hid-input: a... |
1098 |
int ret; |
76f5902ae HID: hid-multitou... |
1099 |
|
b2c68a2f1 HID: hid-input: a... |
1100 1101 1102 1103 1104 |
if (hi->report->id == td->mt_report_id) { ret = mt_touch_input_configured(hdev, hi); if (ret) return ret; } |
76f5902ae HID: hid-multitou... |
1105 |
|
6aef704e3 HID: multitouch: ... |
1106 1107 1108 1109 1110 |
/* * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" * for the stylus. Check this first, and then rely on the application * field. */ |
c08d46aa8 HID: multitouch: ... |
1111 1112 |
if (hi->report->field[0]->physical == HID_DG_STYLUS) { suffix = "Pen"; |
e55f62008 HID: multitouch: ... |
1113 1114 |
/* force BTN_STYLUS to allow tablet matching in udev */ __set_bit(BTN_STYLUS, hi->input->keybit); |
6aef704e3 HID: multitouch: ... |
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 |
} else { switch (field->application) { case HID_GD_KEYBOARD: suffix = "Keyboard"; break; case HID_GD_KEYPAD: suffix = "Keypad"; break; case HID_GD_MOUSE: suffix = "Mouse"; break; case HID_DG_STYLUS: suffix = "Pen"; /* force BTN_STYLUS to allow tablet matching in udev */ __set_bit(BTN_STYLUS, hi->input->keybit); break; case HID_DG_TOUCHSCREEN: /* we do not set suffix = "Touchscreen" */ break; |
dc425a1c8 HID: multitouch: ... |
1134 1135 1136 |
case HID_DG_TOUCHPAD: suffix = "Touchpad"; break; |
6aef704e3 HID: multitouch: ... |
1137 1138 1139 1140 1141 1142 |
case HID_GD_SYSTEM_CONTROL: suffix = "System Control"; break; case HID_CP_CONSUMER_CONTROL: suffix = "Consumer Control"; break; |
1fbf74efe HID: multitouch: ... |
1143 1144 1145 |
case HID_GD_WIRELESS_RADIO_CTLS: suffix = "Wireless Radio Control"; break; |
957b8dffa HID: multitouch: ... |
1146 1147 1148 |
case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: suffix = "Custom Media Keys"; break; |
6aef704e3 HID: multitouch: ... |
1149 1150 1151 1152 |
default: suffix = "UNKNOWN"; break; } |
c08d46aa8 HID: multitouch: ... |
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
} if (suffix) { name = devm_kzalloc(&hi->input->dev, strlen(hdev->name) + strlen(suffix) + 2, GFP_KERNEL); if (name) { sprintf(name, "%s %s", hdev->name, suffix); hi->input->name = name; } } |
b2c68a2f1 HID: hid-input: a... |
1164 1165 |
return 0; |
76f5902ae HID: hid-multitou... |
1166 |
} |
f3287a995 HID: multitouch: ... |
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 |
static void mt_fix_const_field(struct hid_field *field, unsigned int usage) { if (field->usage[0].hid != usage || !(field->flags & HID_MAIN_ITEM_CONSTANT)) return; field->flags &= ~HID_MAIN_ITEM_CONSTANT; field->flags |= HID_MAIN_ITEM_VARIABLE; } static void mt_fix_const_fields(struct hid_device *hdev, unsigned int usage) { struct hid_report *report; int i; list_for_each_entry(report, &hdev->report_enum[HID_INPUT_REPORT].report_list, list) { if (!report->maxfield) continue; for (i = 0; i < report->maxfield; i++) if (report->field[i]->maxusage >= 1) mt_fix_const_field(report->field[i], usage); } } |
4f4001bc7 HID: multitouch: ... |
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 |
static void mt_release_contacts(struct hid_device *hid) { struct hid_input *hidinput; struct mt_device *td = hid_get_drvdata(hid); list_for_each_entry(hidinput, &hid->inputs, list) { struct input_dev *input_dev = hidinput->input; struct input_mt *mt = input_dev->mt; int i; if (mt) { for (i = 0; i < mt->num_slots; i++) { input_mt_slot(input_dev, i); input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, false); } input_mt_sync_frame(input_dev); input_sync(input_dev); } } td->num_received = 0; } static void mt_expired_timeout(unsigned long arg) { struct hid_device *hdev = (void *)arg; struct mt_device *td = hid_get_drvdata(hdev); /* * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; |
960982745 HID: multitouch: ... |
1230 1231 |
if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); |
4f4001bc7 HID: multitouch: ... |
1232 1233 |
clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } |
5519cab47 HID: hid-multitou... |
1234 1235 |
static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) { |
2d93666e7 HID: hid-multitou... |
1236 |
int ret, i; |
5519cab47 HID: hid-multitou... |
1237 |
struct mt_device *td; |
2d93666e7 HID: hid-multitou... |
1238 |
struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ |
94b5485cd HID: hid-multitou... |
1239 1240 1241 1242 |
for (i = 0; mt_classes[i].name ; i++) { if (id->driver_data == mt_classes[i].name) { mtclass = &(mt_classes[i]); break; |
2d93666e7 HID: hid-multitou... |
1243 1244 |
} } |
5519cab47 HID: hid-multitou... |
1245 |
|
c08d46aa8 HID: multitouch: ... |
1246 |
td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); |
5519cab47 HID: hid-multitou... |
1247 1248 1249 1250 1251 |
if (!td) { dev_err(&hdev->dev, "cannot allocate multitouch data "); return -ENOMEM; } |
eec29e3da HID: multitouch: ... |
1252 |
td->mtclass = *mtclass; |
5519cab47 HID: hid-multitou... |
1253 |
td->inputmode = -1; |
31ae9bddb HID: multitouch: ... |
1254 |
td->maxcontact_report_id = -1; |
9abebedb1 HID: multitouch: ... |
1255 |
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN; |
7e3cc447f HID: multitouch: ... |
1256 |
td->cc_index = -1; |
fa11aa72b HID: multitouch: ... |
1257 |
td->mt_report_id = -1; |
5519cab47 HID: hid-multitou... |
1258 |
hid_set_drvdata(hdev, td); |
c08d46aa8 HID: multitouch: ... |
1259 1260 |
td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields), GFP_KERNEL); |
3ac36d155 HID: hid-multitou... |
1261 1262 1263 |
if (!td->fields) { dev_err(&hdev->dev, "cannot allocate multitouch fields data "); |
c08d46aa8 HID: multitouch: ... |
1264 |
return -ENOMEM; |
3ac36d155 HID: hid-multitou... |
1265 |
} |
76f5902ae HID: hid-multitou... |
1266 1267 |
if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID) td->serial_maybe = true; |
b897f6db3 HID: multitouch: ... |
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 |
/* * Store the initial quirk state */ td->initial_quirks = hdev->quirks; /* This allows the driver to correctly support devices * that emit events over several HID messages. */ hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; /* * This allows the driver to handle different input sensors * that emits events through different reports on the same HID * device. */ hdev->quirks |= HID_QUIRK_MULTI_INPUT; hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT; /* * Some multitouch screens do not like to be polled for input * reports. Fortunately, the Win8 spec says that all touches * should be sent during each report, making the initialization * of input reports unnecessary. For Win7 devices, well, let's hope * they will still be happy (this is only be a problem if a touch * was already there while probing the device). * * In addition some touchpads do not behave well if we read * all feature reports from them. Instead we prevent * initial report fetching and then selectively fetch each * report we are interested in. */ hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; |
4f4001bc7 HID: multitouch: ... |
1300 |
setup_timer(&td->release_timer, mt_expired_timeout, (long)hdev); |
5519cab47 HID: hid-multitou... |
1301 1302 |
ret = hid_parse(hdev); if (ret != 0) |
c08d46aa8 HID: multitouch: ... |
1303 |
return ret; |
5519cab47 HID: hid-multitou... |
1304 |
|
f3287a995 HID: multitouch: ... |
1305 1306 |
if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) mt_fix_const_fields(hdev, HID_DG_CONTACTID); |
5519cab47 HID: hid-multitou... |
1307 |
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
2d93666e7 HID: hid-multitou... |
1308 |
if (ret) |
c08d46aa8 HID: multitouch: ... |
1309 |
return ret; |
5519cab47 HID: hid-multitou... |
1310 |
|
eec29e3da HID: multitouch: ... |
1311 |
ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); |
0c4b3c637 HID: multitouch: ... |
1312 1313 1314 1315 |
if (ret) dev_warn(&hdev->dev, "Cannot allocate sysfs group for %s ", hdev->name); |
eec29e3da HID: multitouch: ... |
1316 |
|
31ae9bddb HID: multitouch: ... |
1317 |
mt_set_maxcontacts(hdev); |
5519cab47 HID: hid-multitou... |
1318 |
mt_set_input_mode(hdev); |
c08d46aa8 HID: multitouch: ... |
1319 1320 |
/* release .fields memory as it is not used anymore */ devm_kfree(&hdev->dev, td->fields); |
3ac36d155 HID: hid-multitou... |
1321 |
td->fields = NULL; |
5519cab47 HID: hid-multitou... |
1322 |
return 0; |
5519cab47 HID: hid-multitou... |
1323 1324 1325 1326 1327 |
} #ifdef CONFIG_PM static int mt_reset_resume(struct hid_device *hdev) { |
d3e69b9a0 HID: multitouch: ... |
1328 |
mt_release_contacts(hdev); |
31ae9bddb HID: multitouch: ... |
1329 |
mt_set_maxcontacts(hdev); |
5519cab47 HID: hid-multitou... |
1330 1331 1332 |
mt_set_input_mode(hdev); return 0; } |
dfeefd108 HID: multitouch: ... |
1333 1334 1335 |
static int mt_resume(struct hid_device *hdev) { |
dfeefd108 HID: multitouch: ... |
1336 1337 1338 |
/* Some Elan legacy devices require SET_IDLE to be set on resume. * It should be safe to send it to other devices too. * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */ |
4ba25d3f8 HID: multitouch: ... |
1339 |
hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE); |
dfeefd108 HID: multitouch: ... |
1340 1341 1342 |
return 0; } |
5519cab47 HID: hid-multitou... |
1343 1344 1345 1346 |
#endif static void mt_remove(struct hid_device *hdev) { |
b897f6db3 HID: multitouch: ... |
1347 |
struct mt_device *td = hid_get_drvdata(hdev); |
4f4001bc7 HID: multitouch: ... |
1348 |
del_timer_sync(&td->release_timer); |
eec29e3da HID: multitouch: ... |
1349 |
sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); |
5939212df HID: multitouch: ... |
1350 |
hid_hw_stop(hdev); |
b897f6db3 HID: multitouch: ... |
1351 |
hdev->quirks = td->initial_quirks; |
5519cab47 HID: hid-multitou... |
1352 |
} |
0fa9c6161 HID: multitouch: ... |
1353 1354 1355 1356 1357 1358 |
/* * This list contains only: * - VID/PID of products not working with the default multitouch handling * - 2 generic rules. * So there is no point in adding here any device with MT_CLS_DEFAULT. */ |
5519cab47 HID: hid-multitou... |
1359 |
static const struct hid_device_id mt_devices[] = { |
f786bba44 HID: hid-multitou... |
1360 1361 |
/* 3M panels */ { .driver_data = MT_CLS_3M, |
2c2110e90 HID: hid-multitou... |
1362 |
MT_USB_DEVICE(USB_VENDOR_ID_3M, |
f786bba44 HID: hid-multitou... |
1363 1364 |
USB_DEVICE_ID_3M1968) }, { .driver_data = MT_CLS_3M, |
2c2110e90 HID: hid-multitou... |
1365 |
MT_USB_DEVICE(USB_VENDOR_ID_3M, |
f786bba44 HID: hid-multitou... |
1366 |
USB_DEVICE_ID_3M2256) }, |
c4fad877c HID: multitouch: ... |
1367 |
{ .driver_data = MT_CLS_3M, |
2c2110e90 HID: hid-multitou... |
1368 |
MT_USB_DEVICE(USB_VENDOR_ID_3M, |
c4fad877c HID: multitouch: ... |
1369 |
USB_DEVICE_ID_3M3266) }, |
f786bba44 HID: hid-multitou... |
1370 |
|
504c932c7 HID: multitouch: ... |
1371 1372 1373 1374 1375 1376 1377 1378 1379 |
/* Alps devices */ { .driver_data = MT_CLS_WIN_8_DUAL, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL_PTP) }, { .driver_data = MT_CLS_WIN_8_DUAL, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) }, |
56d859e11 HID: multitouch: ... |
1380 1381 1382 1383 1384 |
/* Lenovo X1 TAB Gen 2 */ { .driver_data = MT_CLS_WIN_8_DUAL, HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_TAB) }, |
6aef704e3 HID: multitouch: ... |
1385 1386 1387 1388 |
/* Anton devices */ { .driver_data = MT_CLS_EXPORT_ALL_INPUTS, MT_USB_DEVICE(USB_VENDOR_ID_ANTON, USB_DEVICE_ID_ANTON_TOUCH_PAD) }, |
e6aac3427 HID: hid-multitou... |
1389 |
|
957b8dffa HID: multitouch: ... |
1390 1391 1392 1393 1394 |
/* Asus T304UA */ { .driver_data = MT_CLS_ASUS, HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD) }, |
b10571246 HID: multitouch: ... |
1395 1396 |
/* Atmel panels */ { .driver_data = MT_CLS_SERIAL, |
2c2110e90 HID: hid-multitou... |
1397 |
MT_USB_DEVICE(USB_VENDOR_ID_ATMEL, |
841cb1570 HID: multitouch: ... |
1398 |
USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) }, |
b10571246 HID: multitouch: ... |
1399 |
|
9ed326951 HID: multitouch: ... |
1400 |
/* Baanto multitouch devices */ |
dc3e1d805 HID: multitouch: ... |
1401 |
{ .driver_data = MT_CLS_NSMU, |
16b79bb8e HID: multitouch: ... |
1402 |
MT_USB_DEVICE(USB_VENDOR_ID_BAANTO, |
9ed326951 HID: multitouch: ... |
1403 |
USB_DEVICE_ID_BAANTO_MT_190W2) }, |
0fa9c6161 HID: multitouch: ... |
1404 |
|
a841b62c5 HID: hid-multitou... |
1405 1406 |
/* Cando panels */ { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
2c2110e90 HID: hid-multitou... |
1407 |
MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c5 HID: hid-multitou... |
1408 |
USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
a841b62c5 HID: hid-multitou... |
1409 |
{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, |
2c2110e90 HID: hid-multitou... |
1410 |
MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
a841b62c5 HID: hid-multitou... |
1411 |
USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, |
942fd4225 HID: hid-multitou... |
1412 |
/* Chunghwa Telecom touch panels */ |
dc3e1d805 HID: multitouch: ... |
1413 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1414 |
MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, |
942fd4225 HID: hid-multitou... |
1415 |
USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, |
16f2433ed HID: multitouch: ... |
1416 1417 1418 1419 1420 |
/* Cirque devices */ { .driver_data = MT_CLS_WIN_8_DUAL, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, I2C_VENDOR_ID_CIRQUE, I2C_PRODUCT_ID_CIRQUE_121F) }, |
070f63b46 HID: multitouch: ... |
1421 1422 1423 1424 1425 1426 1427 |
/* CJTouch panels */ { .driver_data = MT_CLS_NSMU, MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020) }, { .driver_data = MT_CLS_NSMU, MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040) }, |
79603dc9a HID: hid-multitou... |
1428 |
/* CVTouch panels */ |
dc3e1d805 HID: multitouch: ... |
1429 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1430 |
MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, |
79603dc9a HID: hid-multitou... |
1431 |
USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
22408283b HID: hid-multitou... |
1432 |
/* eGalax devices (resistive) */ |
e36f690b3 HID: multitouch: ... |
1433 |
{ .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1434 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b3 HID: multitouch: ... |
1435 1436 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, { .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1437 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b3 HID: multitouch: ... |
1438 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, |
22408283b HID: hid-multitou... |
1439 1440 |
/* eGalax devices (capacitive) */ |
fd1d15258 HID: multitouch: ... |
1441 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1442 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d15258 HID: multitouch: ... |
1443 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) }, |
aa672da1b HID: sort IDs for... |
1444 |
{ .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1445 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
aa672da1b HID: sort IDs for... |
1446 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, |
fd1d15258 HID: multitouch: ... |
1447 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1448 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d15258 HID: multitouch: ... |
1449 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) }, |
2ce09df47 HID: multitouch: ... |
1450 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1451 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
2ce09df47 HID: multitouch: ... |
1452 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) }, |
aa672da1b HID: sort IDs for... |
1453 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1454 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
aa672da1b HID: sort IDs for... |
1455 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) }, |
fd1d15258 HID: multitouch: ... |
1456 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1457 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d15258 HID: multitouch: ... |
1458 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) }, |
e36f690b3 HID: multitouch: ... |
1459 |
{ .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1460 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
aa672da1b HID: sort IDs for... |
1461 1462 1463 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, { .driver_data = MT_CLS_EGALAX, MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b3 HID: multitouch: ... |
1464 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, |
fd1d15258 HID: multitouch: ... |
1465 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1466 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d15258 HID: multitouch: ... |
1467 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) }, |
e36f690b3 HID: multitouch: ... |
1468 |
{ .driver_data = MT_CLS_EGALAX, |
aa672da1b HID: sort IDs for... |
1469 1470 1471 1472 1473 1474 |
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4) }, { .driver_data = MT_CLS_EGALAX, HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0) }, { .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1475 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
66f06127f HID: multitouch: ... |
1476 1477 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, { .driver_data = MT_CLS_EGALAX, |
2c2110e90 HID: hid-multitou... |
1478 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
bb9ff2107 HID: multitouch: ... |
1479 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, |
1b723e8dc HID: multitouch: ... |
1480 |
{ .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1481 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
fd1d15258 HID: multitouch: ... |
1482 1483 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) }, { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1484 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
ae01c9e53 HID: multitouch: ... |
1485 1486 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7) }, { .driver_data = MT_CLS_EGALAX_SERIAL, |
2c2110e90 HID: hid-multitou... |
1487 |
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
e36f690b3 HID: multitouch: ... |
1488 |
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, |
22408283b HID: hid-multitou... |
1489 |
|
7c7606a24 HID: multitouch: ... |
1490 1491 1492 1493 |
/* Elitegroup panel */ { .driver_data = MT_CLS_SERIAL, MT_USB_DEVICE(USB_VENDOR_ID_ELITEGROUP, USB_DEVICE_ID_ELITEGROUP_05D8) }, |
77723e3bc HID: hid-multitou... |
1494 1495 1496 1497 |
/* Flatfrog Panels */ { .driver_data = MT_CLS_FLATFROG, MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG, USB_DEVICE_ID_MULTITOUCH_3200) }, |
3db187e7b HID: multitouch: ... |
1498 1499 1500 1501 |
/* FocalTech Panels */ { .driver_data = MT_CLS_SERIAL, MT_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH) }, |
5572da08a HID: hid-mulitouc... |
1502 |
/* GeneralTouch panel */ |
f5ff4e1e6 HID: multitouch: ... |
1503 |
{ .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, |
2c2110e90 HID: hid-multitou... |
1504 |
MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
5572da08a HID: hid-mulitouc... |
1505 |
USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, |
f5ff4e1e6 HID: multitouch: ... |
1506 1507 1508 |
{ .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) }, |
7b2262920 HID: multitouch: ... |
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 |
{ .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101) }, { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102) }, { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106) }, { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A) }, { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100) }, |
5572da08a HID: hid-mulitouc... |
1524 |
|
4d5df5d11 HID: multitouch: ... |
1525 |
/* Gametel game controller */ |
dc3e1d805 HID: multitouch: ... |
1526 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1527 |
MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL, |
4d5df5d11 HID: multitouch: ... |
1528 |
USB_DEVICE_ID_GAMETEL_MT_MODE) }, |
ee0fbd149 HID: hid-multitou... |
1529 |
/* GoodTouch panels */ |
dc3e1d805 HID: multitouch: ... |
1530 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1531 |
MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, |
ee0fbd149 HID: hid-multitou... |
1532 |
USB_DEVICE_ID_GOODTOUCH_000f) }, |
545803651 HID: hid-multitou... |
1533 1534 |
/* Hanvon panels */ { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
2c2110e90 HID: hid-multitou... |
1535 |
MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, |
545803651 HID: hid-multitou... |
1536 |
USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, |
4e61f0d75 HID: hid-multitou... |
1537 |
/* Ilitek dual touch panel */ |
dc3e1d805 HID: multitouch: ... |
1538 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1539 |
MT_USB_DEVICE(USB_VENDOR_ID_ILITEK, |
4e61f0d75 HID: hid-multitou... |
1540 |
USB_DEVICE_ID_ILITEK_MULTITOUCH) }, |
f3287a995 HID: multitouch: ... |
1541 1542 1543 1544 |
/* LG Melfas panel */ { .driver_data = MT_CLS_LG, HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) }, |
4a6ee685f HID: hid-multitou... |
1545 1546 |
/* MosArt panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, |
2c2110e90 HID: hid-multitou... |
1547 |
MT_USB_DEVICE(USB_VENDOR_ID_ASUS, |
4a6ee685f HID: hid-multitou... |
1548 1549 |
USB_DEVICE_ID_ASUS_T91MT)}, { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, |
2c2110e90 HID: hid-multitou... |
1550 |
MT_USB_DEVICE(USB_VENDOR_ID_ASUS, |
4a6ee685f HID: hid-multitou... |
1551 1552 |
USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, |
2c2110e90 HID: hid-multitou... |
1553 |
MT_USB_DEVICE(USB_VENDOR_ID_TURBOX, |
4a6ee685f HID: hid-multitou... |
1554 |
USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, |
2258e863b HID: multitouch: ... |
1555 1556 |
/* Panasonic panels */ { .driver_data = MT_CLS_PANASONIC, |
2c2110e90 HID: hid-multitou... |
1557 |
MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, |
2258e863b HID: multitouch: ... |
1558 1559 |
USB_DEVICE_ID_PANABOARD_UBT780) }, { .driver_data = MT_CLS_PANASONIC, |
2c2110e90 HID: hid-multitou... |
1560 |
MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, |
2258e863b HID: multitouch: ... |
1561 |
USB_DEVICE_ID_PANABOARD_UBT880) }, |
4db703ead HID: multitouch: ... |
1562 |
/* Novatek Panel */ |
dc3e1d805 HID: multitouch: ... |
1563 |
{ .driver_data = MT_CLS_NSMU, |
4380d8198 HID: multitouch: ... |
1564 |
MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, |
4db703ead HID: multitouch: ... |
1565 |
USB_DEVICE_ID_NOVATEK_PCT) }, |
a80e803a2 HID: multitouch: ... |
1566 1567 1568 1569 |
/* Ntrig Panel */ { .driver_data = MT_CLS_NSMU, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_NTRIG, 0x1b05) }, |
b7ea95ff9 HID: multitouch: ... |
1570 1571 |
/* PixArt optical touch screen */ { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, |
2c2110e90 HID: hid-multitou... |
1572 |
MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff9 HID: multitouch: ... |
1573 1574 |
USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, |
2c2110e90 HID: hid-multitou... |
1575 |
MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff9 HID: multitouch: ... |
1576 1577 |
USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, |
2c2110e90 HID: hid-multitou... |
1578 |
MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
b7ea95ff9 HID: multitouch: ... |
1579 |
USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, |
5519cab47 HID: hid-multitou... |
1580 |
/* PixCir-based panels */ |
1e9cf35b9 HID: hid-multitou... |
1581 |
{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, |
2c2110e90 HID: hid-multitou... |
1582 |
MT_USB_DEVICE(USB_VENDOR_ID_CANDO, |
5519cab47 HID: hid-multitou... |
1583 |
USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, |
5e7ea11f6 HID: multitouch: ... |
1584 1585 |
/* Quanta-based panels */ { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, |
2c2110e90 HID: hid-multitou... |
1586 |
MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
5e7ea11f6 HID: multitouch: ... |
1587 |
USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, |
a6802e008 HID: hid-multitou... |
1588 |
|
043b403ae HID: hid-multitou... |
1589 |
/* Stantum panels */ |
bf5af9b5b HID: hid-multitou... |
1590 |
{ .driver_data = MT_CLS_CONFIDENCE, |
2c2110e90 HID: hid-multitou... |
1591 |
MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, |
043b403ae HID: hid-multitou... |
1592 |
USB_DEVICE_ID_MTP_STM)}, |
043b403ae HID: hid-multitou... |
1593 |
|
847672cd1 HID: multitouch: ... |
1594 1595 |
/* TopSeed panels */ { .driver_data = MT_CLS_TOPSEED, |
2c2110e90 HID: hid-multitou... |
1596 |
MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, |
847672cd1 HID: multitouch: ... |
1597 |
USB_DEVICE_ID_TOPSEED2_PERIPAD_701) }, |
5e74e56da HID: hid-multitou... |
1598 |
/* Touch International panels */ |
dc3e1d805 HID: multitouch: ... |
1599 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1600 |
MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, |
5e74e56da HID: hid-multitou... |
1601 |
USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, |
617b64f97 HID: hid-multitou... |
1602 |
/* Unitec panels */ |
dc3e1d805 HID: multitouch: ... |
1603 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1604 |
MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, |
617b64f97 HID: hid-multitou... |
1605 |
USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, |
dc3e1d805 HID: multitouch: ... |
1606 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1607 |
MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, |
617b64f97 HID: hid-multitou... |
1608 |
USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, |
bf9d121ef HID: multicouh: a... |
1609 |
|
da10bc252 HID: multitouch: ... |
1610 1611 1612 1613 |
/* VTL panels */ { .driver_data = MT_CLS_VTL, MT_USB_DEVICE(USB_VENDOR_ID_VTL, USB_DEVICE_ID_VTL_MULTITOUCH_FF3F) }, |
bf9d121ef HID: multicouh: a... |
1614 1615 1616 1617 |
/* Wistron panels */ { .driver_data = MT_CLS_NSMU, MT_USB_DEVICE(USB_VENDOR_ID_WISTRON, USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH) }, |
bc8a2a9b4 HID: hid-multitou... |
1618 |
/* XAT */ |
dc3e1d805 HID: multitouch: ... |
1619 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1620 |
MT_USB_DEVICE(USB_VENDOR_ID_XAT, |
bc8a2a9b4 HID: hid-multitou... |
1621 |
USB_DEVICE_ID_XAT_CSR) }, |
617b64f97 HID: hid-multitou... |
1622 |
|
11576c611 HID: hid-multitou... |
1623 |
/* Xiroku */ |
dc3e1d805 HID: multitouch: ... |
1624 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1625 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1626 |
USB_DEVICE_ID_XIROKU_SPX) }, |
dc3e1d805 HID: multitouch: ... |
1627 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1628 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1629 |
USB_DEVICE_ID_XIROKU_MPX) }, |
dc3e1d805 HID: multitouch: ... |
1630 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1631 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1632 |
USB_DEVICE_ID_XIROKU_CSR) }, |
dc3e1d805 HID: multitouch: ... |
1633 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1634 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1635 |
USB_DEVICE_ID_XIROKU_SPX1) }, |
dc3e1d805 HID: multitouch: ... |
1636 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1637 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1638 |
USB_DEVICE_ID_XIROKU_MPX1) }, |
dc3e1d805 HID: multitouch: ... |
1639 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1640 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1641 |
USB_DEVICE_ID_XIROKU_CSR1) }, |
dc3e1d805 HID: multitouch: ... |
1642 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1643 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1644 |
USB_DEVICE_ID_XIROKU_SPX2) }, |
dc3e1d805 HID: multitouch: ... |
1645 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1646 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1647 |
USB_DEVICE_ID_XIROKU_MPX2) }, |
dc3e1d805 HID: multitouch: ... |
1648 |
{ .driver_data = MT_CLS_NSMU, |
2c2110e90 HID: hid-multitou... |
1649 |
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
11576c611 HID: hid-multitou... |
1650 |
USB_DEVICE_ID_XIROKU_CSR2) }, |
0e82232c4 HID: multitouch: ... |
1651 1652 1653 1654 |
/* Google MT devices */ { .driver_data = MT_CLS_GOOGLE, HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_TOUCH_ROSE) }, |
4fa3a5837 HID: hid-multitou... |
1655 1656 |
/* Generic MT device */ { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, |
f961bd351 HID: detect Win 8... |
1657 1658 1659 1660 1661 |
/* Generic Win 8 certified MT device */ { .driver_data = MT_CLS_WIN_8, HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH_WIN_8, HID_ANY_ID, HID_ANY_ID) }, |
5519cab47 HID: hid-multitou... |
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 |
{ } }; MODULE_DEVICE_TABLE(hid, mt_devices); static const struct hid_usage_id mt_grabbed_usages[] = { { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} }; static struct hid_driver mt_driver = { .name = "hid-multitouch", .id_table = mt_devices, .probe = mt_probe, .remove = mt_remove, .input_mapping = mt_input_mapping, .input_mapped = mt_input_mapped, |
76f5902ae HID: hid-multitou... |
1678 |
.input_configured = mt_input_configured, |
5519cab47 HID: hid-multitou... |
1679 1680 1681 |
.feature_mapping = mt_feature_mapping, .usage_table = mt_grabbed_usages, .event = mt_event, |
55978fa9d HID: multitouch: ... |
1682 |
.report = mt_report, |
5519cab47 HID: hid-multitou... |
1683 1684 |
#ifdef CONFIG_PM .reset_resume = mt_reset_resume, |
dfeefd108 HID: multitouch: ... |
1685 |
.resume = mt_resume, |
5519cab47 HID: hid-multitou... |
1686 1687 |
#endif }; |
f425458ea HID: Use module_h... |
1688 |
module_hid_driver(mt_driver); |