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