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