Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 1 | /* |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 2 | * HID support for Linux |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 1999 Andreas Gal |
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
Jiri Kosina | 6b1968d | 2012-03-09 13:55:43 +0100 | [diff] [blame] | 7 | * Copyright (c) 2006-2012 Jiri Kosina |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * This program is free software; you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License as published by the Free |
| 13 | * Software Foundation; either version 2 of the License, or (at your option) |
| 14 | * any later version. |
| 15 | */ |
| 16 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 18 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 19 | #include <linux/module.h> |
| 20 | #include <linux/slab.h> |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/kernel.h> |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 23 | #include <linux/list.h> |
| 24 | #include <linux/mm.h> |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 25 | #include <linux/spinlock.h> |
| 26 | #include <asm/unaligned.h> |
| 27 | #include <asm/byteorder.h> |
| 28 | #include <linux/input.h> |
| 29 | #include <linux/wait.h> |
Jiri Kosina | 47a80ed | 2007-03-12 14:55:12 +0100 | [diff] [blame] | 30 | #include <linux/vmalloc.h> |
Jiri Kosina | c4124c9 | 2007-11-30 11:12:58 +0100 | [diff] [blame] | 31 | #include <linux/sched.h> |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 32 | #include <linux/semaphore.h> |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 33 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 34 | #include <linux/hid.h> |
| 35 | #include <linux/hiddev.h> |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 36 | #include <linux/hid-debug.h> |
Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 37 | #include <linux/hidraw.h> |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 38 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 39 | #include "hid-ids.h" |
| 40 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 41 | /* |
| 42 | * Version Information |
| 43 | */ |
| 44 | |
Jiri Kosina | 5314980 | 2007-01-09 13:24:25 +0100 | [diff] [blame] | 45 | #define DRIVER_DESC "HID core driver" |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 46 | #define DRIVER_LICENSE "GPL" |
| 47 | |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 48 | int hid_debug = 0; |
Anssi Hannula | 377e10f | 2008-03-22 23:50:13 +0100 | [diff] [blame] | 49 | module_param_named(debug, hid_debug, int, 0600); |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 50 | MODULE_PARM_DESC(debug, "toggle HID debugging messages"); |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 51 | EXPORT_SYMBOL_GPL(hid_debug); |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 52 | |
Jiri Kosina | 6b1968d | 2012-03-09 13:55:43 +0100 | [diff] [blame] | 53 | static int hid_ignore_special_drivers = 0; |
| 54 | module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600); |
| 55 | MODULE_PARM_DESC(debug, "Ignore any special drivers and handle all devices by generic driver"); |
| 56 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 57 | /* |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 58 | * Register a new report for a device. |
| 59 | */ |
| 60 | |
Michael Poole | 90a006a | 2010-01-24 22:32:29 -0500 | [diff] [blame] | 61 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 62 | { |
| 63 | struct hid_report_enum *report_enum = device->report_enum + type; |
| 64 | struct hid_report *report; |
| 65 | |
| 66 | if (report_enum->report_id_hash[id]) |
| 67 | return report_enum->report_id_hash[id]; |
| 68 | |
Joe Perches | a3789a17 | 2010-12-09 19:29:07 -0800 | [diff] [blame] | 69 | report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); |
| 70 | if (!report) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 71 | return NULL; |
| 72 | |
| 73 | if (id != 0) |
| 74 | report_enum->numbered = 1; |
| 75 | |
| 76 | report->id = id; |
| 77 | report->type = type; |
| 78 | report->size = 0; |
| 79 | report->device = device; |
| 80 | report_enum->report_id_hash[id] = report; |
| 81 | |
| 82 | list_add_tail(&report->list, &report_enum->report_list); |
| 83 | |
| 84 | return report; |
| 85 | } |
Michael Poole | 90a006a | 2010-01-24 22:32:29 -0500 | [diff] [blame] | 86 | EXPORT_SYMBOL_GPL(hid_register_report); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 87 | |
| 88 | /* |
| 89 | * Register a new field for this report. |
| 90 | */ |
| 91 | |
| 92 | static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) |
| 93 | { |
| 94 | struct hid_field *field; |
| 95 | |
| 96 | if (report->maxfield == HID_MAX_FIELDS) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 97 | hid_err(report->device, "too many fields in report\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 98 | return NULL; |
| 99 | } |
| 100 | |
Joe Perches | a3789a17 | 2010-12-09 19:29:07 -0800 | [diff] [blame] | 101 | field = kzalloc((sizeof(struct hid_field) + |
| 102 | usages * sizeof(struct hid_usage) + |
| 103 | values * sizeof(unsigned)), GFP_KERNEL); |
| 104 | if (!field) |
| 105 | return NULL; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 106 | |
| 107 | field->index = report->maxfield++; |
| 108 | report->field[field->index] = field; |
| 109 | field->usage = (struct hid_usage *)(field + 1); |
Jiri Slaby | 282bfd4 | 2008-03-28 17:06:41 +0100 | [diff] [blame] | 110 | field->value = (s32 *)(field->usage + usages); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 111 | field->report = report; |
| 112 | |
| 113 | return field; |
| 114 | } |
| 115 | |
| 116 | /* |
| 117 | * Open a collection. The type/usage is pushed on the stack. |
| 118 | */ |
| 119 | |
| 120 | static int open_collection(struct hid_parser *parser, unsigned type) |
| 121 | { |
| 122 | struct hid_collection *collection; |
| 123 | unsigned usage; |
| 124 | |
| 125 | usage = parser->local.usage[0]; |
| 126 | |
| 127 | if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 128 | hid_err(parser->device, "collection stack overflow\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 129 | return -1; |
| 130 | } |
| 131 | |
| 132 | if (parser->device->maxcollection == parser->device->collection_size) { |
| 133 | collection = kmalloc(sizeof(struct hid_collection) * |
| 134 | parser->device->collection_size * 2, GFP_KERNEL); |
| 135 | if (collection == NULL) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 136 | hid_err(parser->device, "failed to reallocate collection array\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 137 | return -1; |
| 138 | } |
| 139 | memcpy(collection, parser->device->collection, |
| 140 | sizeof(struct hid_collection) * |
| 141 | parser->device->collection_size); |
| 142 | memset(collection + parser->device->collection_size, 0, |
| 143 | sizeof(struct hid_collection) * |
| 144 | parser->device->collection_size); |
| 145 | kfree(parser->device->collection); |
| 146 | parser->device->collection = collection; |
| 147 | parser->device->collection_size *= 2; |
| 148 | } |
| 149 | |
| 150 | parser->collection_stack[parser->collection_stack_ptr++] = |
| 151 | parser->device->maxcollection; |
| 152 | |
| 153 | collection = parser->device->collection + |
| 154 | parser->device->maxcollection++; |
| 155 | collection->type = type; |
| 156 | collection->usage = usage; |
| 157 | collection->level = parser->collection_stack_ptr - 1; |
| 158 | |
| 159 | if (type == HID_COLLECTION_APPLICATION) |
| 160 | parser->device->maxapplication++; |
| 161 | |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | /* |
| 166 | * Close a collection. |
| 167 | */ |
| 168 | |
| 169 | static int close_collection(struct hid_parser *parser) |
| 170 | { |
| 171 | if (!parser->collection_stack_ptr) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 172 | hid_err(parser->device, "collection stack underflow\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 173 | return -1; |
| 174 | } |
| 175 | parser->collection_stack_ptr--; |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | /* |
| 180 | * Climb up the stack, search for the specified collection type |
| 181 | * and return the usage. |
| 182 | */ |
| 183 | |
| 184 | static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) |
| 185 | { |
Joe Perches | 504499f | 2010-12-09 19:29:08 -0800 | [diff] [blame] | 186 | struct hid_collection *collection = parser->device->collection; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 187 | int n; |
Joe Perches | 504499f | 2010-12-09 19:29:08 -0800 | [diff] [blame] | 188 | |
| 189 | for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { |
| 190 | unsigned index = parser->collection_stack[n]; |
| 191 | if (collection[index].type == type) |
| 192 | return collection[index].usage; |
| 193 | } |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 194 | return 0; /* we know nothing about this usage type */ |
| 195 | } |
| 196 | |
| 197 | /* |
| 198 | * Add a usage to the temporary parser table. |
| 199 | */ |
| 200 | |
| 201 | static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
| 202 | { |
| 203 | if (parser->local.usage_index >= HID_MAX_USAGES) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 204 | hid_err(parser->device, "usage index exceeded\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 205 | return -1; |
| 206 | } |
| 207 | parser->local.usage[parser->local.usage_index] = usage; |
| 208 | parser->local.collection_index[parser->local.usage_index] = |
| 209 | parser->collection_stack_ptr ? |
| 210 | parser->collection_stack[parser->collection_stack_ptr - 1] : 0; |
| 211 | parser->local.usage_index++; |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | /* |
| 216 | * Register a new field for this report. |
| 217 | */ |
| 218 | |
| 219 | static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) |
| 220 | { |
| 221 | struct hid_report *report; |
| 222 | struct hid_field *field; |
| 223 | int usages; |
| 224 | unsigned offset; |
| 225 | int i; |
| 226 | |
Joe Perches | a3789a17 | 2010-12-09 19:29:07 -0800 | [diff] [blame] | 227 | report = hid_register_report(parser->device, report_type, parser->global.report_id); |
| 228 | if (!report) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 229 | hid_err(parser->device, "hid_register_report failed\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 230 | return -1; |
| 231 | } |
| 232 | |
| 233 | if (parser->global.logical_maximum < parser->global.logical_minimum) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 234 | hid_err(parser->device, "logical range invalid %d %d\n", |
| 235 | parser->global.logical_minimum, parser->global.logical_maximum); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 236 | return -1; |
| 237 | } |
| 238 | |
| 239 | offset = report->size; |
| 240 | report->size += parser->global.report_size * parser->global.report_count; |
| 241 | |
| 242 | if (!parser->local.usage_index) /* Ignore padding fields */ |
| 243 | return 0; |
| 244 | |
| 245 | usages = max_t(int, parser->local.usage_index, parser->global.report_count); |
| 246 | |
Joe Perches | a3789a17 | 2010-12-09 19:29:07 -0800 | [diff] [blame] | 247 | field = hid_register_field(report, usages, parser->global.report_count); |
| 248 | if (!field) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 249 | return 0; |
| 250 | |
| 251 | field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); |
| 252 | field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); |
| 253 | field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); |
| 254 | |
| 255 | for (i = 0; i < usages; i++) { |
| 256 | int j = i; |
| 257 | /* Duplicate the last usage we parsed if we have excess values */ |
| 258 | if (i >= parser->local.usage_index) |
| 259 | j = parser->local.usage_index - 1; |
| 260 | field->usage[i].hid = parser->local.usage[j]; |
| 261 | field->usage[i].collection_index = |
| 262 | parser->local.collection_index[j]; |
| 263 | } |
| 264 | |
| 265 | field->maxusage = usages; |
| 266 | field->flags = flags; |
| 267 | field->report_offset = offset; |
| 268 | field->report_type = report_type; |
| 269 | field->report_size = parser->global.report_size; |
| 270 | field->report_count = parser->global.report_count; |
| 271 | field->logical_minimum = parser->global.logical_minimum; |
| 272 | field->logical_maximum = parser->global.logical_maximum; |
| 273 | field->physical_minimum = parser->global.physical_minimum; |
| 274 | field->physical_maximum = parser->global.physical_maximum; |
| 275 | field->unit_exponent = parser->global.unit_exponent; |
| 276 | field->unit = parser->global.unit; |
| 277 | |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | /* |
| 282 | * Read data value from item. |
| 283 | */ |
| 284 | |
| 285 | static u32 item_udata(struct hid_item *item) |
| 286 | { |
| 287 | switch (item->size) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 288 | case 1: return item->data.u8; |
| 289 | case 2: return item->data.u16; |
| 290 | case 4: return item->data.u32; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 291 | } |
| 292 | return 0; |
| 293 | } |
| 294 | |
| 295 | static s32 item_sdata(struct hid_item *item) |
| 296 | { |
| 297 | switch (item->size) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 298 | case 1: return item->data.s8; |
| 299 | case 2: return item->data.s16; |
| 300 | case 4: return item->data.s32; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 301 | } |
| 302 | return 0; |
| 303 | } |
| 304 | |
| 305 | /* |
| 306 | * Process a global item. |
| 307 | */ |
| 308 | |
| 309 | static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) |
| 310 | { |
| 311 | switch (item->tag) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 312 | case HID_GLOBAL_ITEM_TAG_PUSH: |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 313 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 314 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 315 | hid_err(parser->device, "global environment stack overflow\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 316 | return -1; |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | memcpy(parser->global_stack + parser->global_stack_ptr++, |
| 320 | &parser->global, sizeof(struct hid_global)); |
| 321 | return 0; |
| 322 | |
| 323 | case HID_GLOBAL_ITEM_TAG_POP: |
| 324 | |
| 325 | if (!parser->global_stack_ptr) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 326 | hid_err(parser->device, "global environment stack underflow\n"); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 327 | return -1; |
| 328 | } |
| 329 | |
| 330 | memcpy(&parser->global, parser->global_stack + |
| 331 | --parser->global_stack_ptr, sizeof(struct hid_global)); |
| 332 | return 0; |
| 333 | |
| 334 | case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: |
| 335 | parser->global.usage_page = item_udata(item); |
| 336 | return 0; |
| 337 | |
| 338 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: |
| 339 | parser->global.logical_minimum = item_sdata(item); |
| 340 | return 0; |
| 341 | |
| 342 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: |
| 343 | if (parser->global.logical_minimum < 0) |
| 344 | parser->global.logical_maximum = item_sdata(item); |
| 345 | else |
| 346 | parser->global.logical_maximum = item_udata(item); |
| 347 | return 0; |
| 348 | |
| 349 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: |
| 350 | parser->global.physical_minimum = item_sdata(item); |
| 351 | return 0; |
| 352 | |
| 353 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: |
| 354 | if (parser->global.physical_minimum < 0) |
| 355 | parser->global.physical_maximum = item_sdata(item); |
| 356 | else |
| 357 | parser->global.physical_maximum = item_udata(item); |
| 358 | return 0; |
| 359 | |
| 360 | case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: |
| 361 | parser->global.unit_exponent = item_sdata(item); |
| 362 | return 0; |
| 363 | |
| 364 | case HID_GLOBAL_ITEM_TAG_UNIT: |
| 365 | parser->global.unit = item_udata(item); |
| 366 | return 0; |
| 367 | |
| 368 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: |
| 369 | parser->global.report_size = item_udata(item); |
Chase Douglas | e46e927 | 2011-11-07 11:08:05 -0800 | [diff] [blame] | 370 | if (parser->global.report_size > 96) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 371 | hid_err(parser->device, "invalid report_size %d\n", |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 372 | parser->global.report_size); |
| 373 | return -1; |
| 374 | } |
| 375 | return 0; |
| 376 | |
| 377 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: |
| 378 | parser->global.report_count = item_udata(item); |
| 379 | if (parser->global.report_count > HID_MAX_USAGES) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 380 | hid_err(parser->device, "invalid report_count %d\n", |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 381 | parser->global.report_count); |
| 382 | return -1; |
| 383 | } |
| 384 | return 0; |
| 385 | |
| 386 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: |
| 387 | parser->global.report_id = item_udata(item); |
| 388 | if (parser->global.report_id == 0) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 389 | hid_err(parser->device, "report_id 0 is invalid\n"); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 390 | return -1; |
| 391 | } |
| 392 | return 0; |
| 393 | |
| 394 | default: |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 395 | hid_err(parser->device, "unknown global tag 0x%x\n", item->tag); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 396 | return -1; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 397 | } |
| 398 | } |
| 399 | |
| 400 | /* |
| 401 | * Process a local item. |
| 402 | */ |
| 403 | |
| 404 | static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
| 405 | { |
| 406 | __u32 data; |
| 407 | unsigned n; |
| 408 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 409 | data = item_udata(item); |
| 410 | |
| 411 | switch (item->tag) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 412 | case HID_LOCAL_ITEM_TAG_DELIMITER: |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 413 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 414 | if (data) { |
| 415 | /* |
| 416 | * We treat items before the first delimiter |
| 417 | * as global to all usage sets (branch 0). |
| 418 | * In the moment we process only these global |
| 419 | * items and the first delimiter set. |
| 420 | */ |
| 421 | if (parser->local.delimiter_depth != 0) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 422 | hid_err(parser->device, "nested delimiters\n"); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 423 | return -1; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 424 | } |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 425 | parser->local.delimiter_depth++; |
| 426 | parser->local.delimiter_branch++; |
| 427 | } else { |
| 428 | if (parser->local.delimiter_depth < 1) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 429 | hid_err(parser->device, "bogus close delimiter\n"); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 430 | return -1; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 431 | } |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 432 | parser->local.delimiter_depth--; |
| 433 | } |
| 434 | return 1; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 435 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 436 | case HID_LOCAL_ITEM_TAG_USAGE: |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 437 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 438 | if (parser->local.delimiter_branch > 1) { |
| 439 | dbg_hid("alternative usage ignored\n"); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 440 | return 0; |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 441 | } |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 442 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 443 | if (item->size <= 2) |
| 444 | data = (parser->global.usage_page << 16) + data; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 445 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 446 | return hid_add_usage(parser, data); |
| 447 | |
| 448 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
| 449 | |
| 450 | if (parser->local.delimiter_branch > 1) { |
| 451 | dbg_hid("alternative usage ignored\n"); |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | if (item->size <= 2) |
| 456 | data = (parser->global.usage_page << 16) + data; |
| 457 | |
| 458 | parser->local.usage_minimum = data; |
| 459 | return 0; |
| 460 | |
| 461 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: |
| 462 | |
| 463 | if (parser->local.delimiter_branch > 1) { |
| 464 | dbg_hid("alternative usage ignored\n"); |
| 465 | return 0; |
| 466 | } |
| 467 | |
| 468 | if (item->size <= 2) |
| 469 | data = (parser->global.usage_page << 16) + data; |
| 470 | |
| 471 | for (n = parser->local.usage_minimum; n <= data; n++) |
| 472 | if (hid_add_usage(parser, n)) { |
| 473 | dbg_hid("hid_add_usage failed\n"); |
| 474 | return -1; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 475 | } |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 476 | return 0; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 477 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 478 | default: |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 479 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 480 | dbg_hid("unknown local item tag 0x%x\n", item->tag); |
| 481 | return 0; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 482 | } |
| 483 | return 0; |
| 484 | } |
| 485 | |
| 486 | /* |
| 487 | * Process a main item. |
| 488 | */ |
| 489 | |
| 490 | static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) |
| 491 | { |
| 492 | __u32 data; |
| 493 | int ret; |
| 494 | |
| 495 | data = item_udata(item); |
| 496 | |
| 497 | switch (item->tag) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 498 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: |
| 499 | ret = open_collection(parser, data & 0xff); |
| 500 | break; |
| 501 | case HID_MAIN_ITEM_TAG_END_COLLECTION: |
| 502 | ret = close_collection(parser); |
| 503 | break; |
| 504 | case HID_MAIN_ITEM_TAG_INPUT: |
| 505 | ret = hid_add_field(parser, HID_INPUT_REPORT, data); |
| 506 | break; |
| 507 | case HID_MAIN_ITEM_TAG_OUTPUT: |
| 508 | ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); |
| 509 | break; |
| 510 | case HID_MAIN_ITEM_TAG_FEATURE: |
| 511 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); |
| 512 | break; |
| 513 | default: |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 514 | hid_err(parser->device, "unknown main item tag 0x%x\n", item->tag); |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 515 | ret = 0; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ |
| 519 | |
| 520 | return ret; |
| 521 | } |
| 522 | |
| 523 | /* |
| 524 | * Process a reserved item. |
| 525 | */ |
| 526 | |
| 527 | static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) |
| 528 | { |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 529 | dbg_hid("reserved item type, tag 0x%x\n", item->tag); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 530 | return 0; |
| 531 | } |
| 532 | |
| 533 | /* |
| 534 | * Free a report and all registered fields. The field->usage and |
| 535 | * field->value table's are allocated behind the field, so we need |
| 536 | * only to free(field) itself. |
| 537 | */ |
| 538 | |
| 539 | static void hid_free_report(struct hid_report *report) |
| 540 | { |
| 541 | unsigned n; |
| 542 | |
| 543 | for (n = 0; n < report->maxfield; n++) |
| 544 | kfree(report->field[n]); |
| 545 | kfree(report); |
| 546 | } |
| 547 | |
| 548 | /* |
| 549 | * Free a device structure, all reports, and all fields. |
| 550 | */ |
| 551 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 552 | static void hid_device_release(struct device *dev) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 553 | { |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 554 | struct hid_device *device = container_of(dev, struct hid_device, dev); |
| 555 | unsigned i, j; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 556 | |
| 557 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
| 558 | struct hid_report_enum *report_enum = device->report_enum + i; |
| 559 | |
| 560 | for (j = 0; j < 256; j++) { |
| 561 | struct hid_report *report = report_enum->report_id_hash[j]; |
| 562 | if (report) |
| 563 | hid_free_report(report); |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | kfree(device->rdesc); |
Jiri Kosina | 767fe78 | 2007-01-24 23:05:07 +0100 | [diff] [blame] | 568 | kfree(device->collection); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 569 | kfree(device); |
| 570 | } |
| 571 | |
| 572 | /* |
| 573 | * Fetch a report description item from the data stream. We support long |
| 574 | * items, though they are not used yet. |
| 575 | */ |
| 576 | |
| 577 | static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) |
| 578 | { |
| 579 | u8 b; |
| 580 | |
| 581 | if ((end - start) <= 0) |
| 582 | return NULL; |
| 583 | |
| 584 | b = *start++; |
| 585 | |
| 586 | item->type = (b >> 2) & 3; |
| 587 | item->tag = (b >> 4) & 15; |
| 588 | |
| 589 | if (item->tag == HID_ITEM_TAG_LONG) { |
| 590 | |
| 591 | item->format = HID_ITEM_FORMAT_LONG; |
| 592 | |
| 593 | if ((end - start) < 2) |
| 594 | return NULL; |
| 595 | |
| 596 | item->size = *start++; |
| 597 | item->tag = *start++; |
| 598 | |
| 599 | if ((end - start) < item->size) |
| 600 | return NULL; |
| 601 | |
| 602 | item->data.longdata = start; |
| 603 | start += item->size; |
| 604 | return start; |
| 605 | } |
| 606 | |
| 607 | item->format = HID_ITEM_FORMAT_SHORT; |
| 608 | item->size = b & 3; |
| 609 | |
| 610 | switch (item->size) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 611 | case 0: |
| 612 | return start; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 613 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 614 | case 1: |
| 615 | if ((end - start) < 1) |
| 616 | return NULL; |
| 617 | item->data.u8 = *start++; |
| 618 | return start; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 619 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 620 | case 2: |
| 621 | if ((end - start) < 2) |
| 622 | return NULL; |
| 623 | item->data.u16 = get_unaligned_le16(start); |
| 624 | start = (__u8 *)((__le16 *)start + 1); |
| 625 | return start; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 626 | |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 627 | case 3: |
| 628 | item->size++; |
| 629 | if ((end - start) < 4) |
| 630 | return NULL; |
| 631 | item->data.u32 = get_unaligned_le32(start); |
| 632 | start = (__u8 *)((__le32 *)start + 1); |
| 633 | return start; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | return NULL; |
| 637 | } |
| 638 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 639 | /** |
| 640 | * hid_parse_report - parse device report |
| 641 | * |
| 642 | * @device: hid device |
| 643 | * @start: report start |
| 644 | * @size: report size |
| 645 | * |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 646 | * Parse a report description into a hid_device structure. Reports are |
| 647 | * enumerated, fields are attached to these reports. |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 648 | * 0 returned on success, otherwise nonzero error value. |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 649 | */ |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 650 | int hid_parse_report(struct hid_device *device, __u8 *start, |
| 651 | unsigned size) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 652 | { |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 653 | struct hid_parser *parser; |
| 654 | struct hid_item item; |
| 655 | __u8 *end; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 656 | int ret; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 657 | static int (*dispatch_type[])(struct hid_parser *parser, |
| 658 | struct hid_item *item) = { |
| 659 | hid_parser_main, |
| 660 | hid_parser_global, |
| 661 | hid_parser_local, |
| 662 | hid_parser_reserved |
| 663 | }; |
| 664 | |
Jiri Slaby | c500c97 | 2008-05-16 11:49:16 +0200 | [diff] [blame] | 665 | if (device->driver->report_fixup) |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 666 | start = device->driver->report_fixup(device, start, &size); |
Jiri Slaby | c500c97 | 2008-05-16 11:49:16 +0200 | [diff] [blame] | 667 | |
Julia Lawall | 1721a23 | 2010-05-15 23:19:30 +0200 | [diff] [blame] | 668 | device->rdesc = kmemdup(start, size, GFP_KERNEL); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 669 | if (device->rdesc == NULL) |
| 670 | return -ENOMEM; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 671 | device->rsize = size; |
| 672 | |
Joe Perches | fe25802 | 2010-12-09 19:29:04 -0800 | [diff] [blame] | 673 | parser = vzalloc(sizeof(struct hid_parser)); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 674 | if (!parser) { |
| 675 | ret = -ENOMEM; |
| 676 | goto err; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 677 | } |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 678 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 679 | parser->device = device; |
| 680 | |
| 681 | end = start + size; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 682 | ret = -EINVAL; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 683 | while ((start = fetch_item(start, end, &item)) != NULL) { |
| 684 | |
| 685 | if (item.format != HID_ITEM_FORMAT_SHORT) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 686 | hid_err(device, "unexpected long global item\n"); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 687 | goto err; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 688 | } |
| 689 | |
| 690 | if (dispatch_type[item.type](parser, &item)) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 691 | hid_err(device, "item %u %u %u %u parsing failed\n", |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 692 | item.format, (unsigned)item.size, |
| 693 | (unsigned)item.type, (unsigned)item.tag); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 694 | goto err; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | if (start == end) { |
| 698 | if (parser->collection_stack_ptr) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 699 | hid_err(device, "unbalanced collection at end of report description\n"); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 700 | goto err; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 701 | } |
| 702 | if (parser->local.delimiter_depth) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 703 | hid_err(device, "unbalanced delimiter at end of report description\n"); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 704 | goto err; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 705 | } |
Jiri Kosina | 47a80ed | 2007-03-12 14:55:12 +0100 | [diff] [blame] | 706 | vfree(parser); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 707 | return 0; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 708 | } |
| 709 | } |
| 710 | |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 711 | hid_err(device, "item fetching failed at offset %d\n", (int)(end - start)); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 712 | err: |
Jiri Kosina | 47a80ed | 2007-03-12 14:55:12 +0100 | [diff] [blame] | 713 | vfree(parser); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 714 | return ret; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 715 | } |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 716 | EXPORT_SYMBOL_GPL(hid_parse_report); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 717 | |
| 718 | /* |
| 719 | * Convert a signed n-bit integer to signed 32-bit integer. Common |
| 720 | * cases are done through the compiler, the screwed things has to be |
| 721 | * done by hand. |
| 722 | */ |
| 723 | |
| 724 | static s32 snto32(__u32 value, unsigned n) |
| 725 | { |
| 726 | switch (n) { |
Jiri Slaby | 880d29f | 2008-06-18 23:55:41 +0200 | [diff] [blame] | 727 | case 8: return ((__s8)value); |
| 728 | case 16: return ((__s16)value); |
| 729 | case 32: return ((__s32)value); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 730 | } |
| 731 | return value & (1 << (n - 1)) ? value | (-1 << n) : value; |
| 732 | } |
| 733 | |
| 734 | /* |
| 735 | * Convert a signed 32-bit integer to a signed n-bit integer. |
| 736 | */ |
| 737 | |
| 738 | static u32 s32ton(__s32 value, unsigned n) |
| 739 | { |
| 740 | s32 a = value >> (n - 1); |
| 741 | if (a && a != -1) |
| 742 | return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; |
| 743 | return value & ((1 << n) - 1); |
| 744 | } |
| 745 | |
| 746 | /* |
| 747 | * Extract/implement a data field from/to a little endian report (bit array). |
| 748 | * |
| 749 | * Code sort-of follows HID spec: |
| 750 | * http://www.usb.org/developers/devclass_docs/HID1_11.pdf |
| 751 | * |
| 752 | * While the USB HID spec allows unlimited length bit fields in "report |
| 753 | * descriptors", most devices never use more than 16 bits. |
| 754 | * One model of UPS is claimed to report "LINEV" as a 32-bit field. |
| 755 | * Search linux-kernel and linux-usb-devel archives for "hid-core extract". |
| 756 | */ |
| 757 | |
Joe Perches | 16ee4cc | 2010-12-09 19:29:05 -0800 | [diff] [blame] | 758 | static __u32 extract(const struct hid_device *hid, __u8 *report, |
| 759 | unsigned offset, unsigned n) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 760 | { |
| 761 | u64 x; |
| 762 | |
Jiri Kosina | c4124c9 | 2007-11-30 11:12:58 +0100 | [diff] [blame] | 763 | if (n > 32) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 764 | hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", |
| 765 | n, current->comm); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 766 | |
| 767 | report += offset >> 3; /* adjust byte index */ |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 768 | offset &= 7; /* now only need bit offset into one byte */ |
Harvey Harrison | c105068 | 2008-04-29 01:03:31 -0700 | [diff] [blame] | 769 | x = get_unaligned_le64(report); |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 770 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 771 | return (u32) x; |
| 772 | } |
| 773 | |
| 774 | /* |
| 775 | * "implement" : set bits in a little endian bit stream. |
| 776 | * Same concepts as "extract" (see comments above). |
| 777 | * The data mangled in the bit stream remains in little endian |
| 778 | * order the whole time. It make more sense to talk about |
| 779 | * endianness of register values by considering a register |
| 780 | * a "cached" copy of the little endiad bit stream. |
| 781 | */ |
Joe Perches | 16ee4cc | 2010-12-09 19:29:05 -0800 | [diff] [blame] | 782 | static void implement(const struct hid_device *hid, __u8 *report, |
| 783 | unsigned offset, unsigned n, __u32 value) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 784 | { |
Harvey Harrison | 6f0168d | 2008-05-16 11:00:23 +0200 | [diff] [blame] | 785 | u64 x; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 786 | u64 m = (1ULL << n) - 1; |
| 787 | |
Jiri Kosina | c4124c9 | 2007-11-30 11:12:58 +0100 | [diff] [blame] | 788 | if (n > 32) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 789 | hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", |
| 790 | __func__, n, current->comm); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 791 | |
Jiri Kosina | c4124c9 | 2007-11-30 11:12:58 +0100 | [diff] [blame] | 792 | if (value > m) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 793 | hid_warn(hid, "%s() called with too large value %d! (%s)\n", |
| 794 | __func__, value, current->comm); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 795 | WARN_ON(value > m); |
| 796 | value &= m; |
| 797 | |
| 798 | report += offset >> 3; |
| 799 | offset &= 7; |
| 800 | |
Harvey Harrison | 6f0168d | 2008-05-16 11:00:23 +0200 | [diff] [blame] | 801 | x = get_unaligned_le64(report); |
| 802 | x &= ~(m << offset); |
| 803 | x |= ((u64)value) << offset; |
| 804 | put_unaligned_le64(x, report); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | /* |
| 808 | * Search an array for a value. |
| 809 | */ |
| 810 | |
Joe Perches | 16ee4cc | 2010-12-09 19:29:05 -0800 | [diff] [blame] | 811 | static int search(__s32 *array, __s32 value, unsigned n) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 812 | { |
| 813 | while (n--) { |
| 814 | if (*array++ == value) |
| 815 | return 0; |
| 816 | } |
| 817 | return -1; |
| 818 | } |
| 819 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 820 | /** |
| 821 | * hid_match_report - check if driver's raw_event should be called |
| 822 | * |
| 823 | * @hid: hid device |
| 824 | * @report_type: type to match against |
| 825 | * |
| 826 | * compare hid->driver->report_table->report_type to report->type |
| 827 | */ |
| 828 | static int hid_match_report(struct hid_device *hid, struct hid_report *report) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 829 | { |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 830 | const struct hid_report_id *id = hid->driver->report_table; |
| 831 | |
| 832 | if (!id) /* NULL means all */ |
| 833 | return 1; |
| 834 | |
| 835 | for (; id->report_type != HID_TERMINATOR; id++) |
| 836 | if (id->report_type == HID_ANY_ID || |
| 837 | id->report_type == report->type) |
| 838 | return 1; |
| 839 | return 0; |
| 840 | } |
| 841 | |
| 842 | /** |
| 843 | * hid_match_usage - check if driver's event should be called |
| 844 | * |
| 845 | * @hid: hid device |
| 846 | * @usage: usage to match against |
| 847 | * |
| 848 | * compare hid->driver->usage_table->usage_{type,code} to |
| 849 | * usage->usage_{type,code} |
| 850 | */ |
| 851 | static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) |
| 852 | { |
| 853 | const struct hid_usage_id *id = hid->driver->usage_table; |
| 854 | |
| 855 | if (!id) /* NULL means all */ |
| 856 | return 1; |
| 857 | |
| 858 | for (; id->usage_type != HID_ANY_ID - 1; id++) |
| 859 | if ((id->usage_hid == HID_ANY_ID || |
| 860 | id->usage_hid == usage->hid) && |
| 861 | (id->usage_type == HID_ANY_ID || |
| 862 | id->usage_type == usage->type) && |
| 863 | (id->usage_code == HID_ANY_ID || |
| 864 | id->usage_code == usage->code)) |
| 865 | return 1; |
| 866 | return 0; |
| 867 | } |
| 868 | |
| 869 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, |
| 870 | struct hid_usage *usage, __s32 value, int interrupt) |
| 871 | { |
| 872 | struct hid_driver *hdrv = hid->driver; |
| 873 | int ret; |
| 874 | |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 875 | hid_dump_input(hid, usage, value); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 876 | |
| 877 | if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { |
| 878 | ret = hdrv->event(hid, field, usage, value); |
| 879 | if (ret != 0) { |
| 880 | if (ret < 0) |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 881 | hid_err(hid, "%s's event failed with %d\n", |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 882 | hdrv->name, ret); |
| 883 | return; |
| 884 | } |
| 885 | } |
| 886 | |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 887 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 888 | hidinput_hid_event(hid, field, usage, value); |
Jiri Kosina | aa938f7 | 2006-12-08 18:41:10 +0100 | [diff] [blame] | 889 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) |
| 890 | hid->hiddev_hid_event(hid, field, usage, value); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 891 | } |
| 892 | |
| 893 | /* |
| 894 | * Analyse a received field, and fetch the data from it. The field |
| 895 | * content is stored for next report processing (we do differential |
| 896 | * reporting to the layer). |
| 897 | */ |
| 898 | |
Adrian Bunk | abdff0f | 2008-03-31 01:53:56 +0200 | [diff] [blame] | 899 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, |
| 900 | __u8 *data, int interrupt) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 901 | { |
| 902 | unsigned n; |
| 903 | unsigned count = field->report_count; |
| 904 | unsigned offset = field->report_offset; |
| 905 | unsigned size = field->report_size; |
| 906 | __s32 min = field->logical_minimum; |
| 907 | __s32 max = field->logical_maximum; |
| 908 | __s32 *value; |
| 909 | |
Joe Perches | a3789a17 | 2010-12-09 19:29:07 -0800 | [diff] [blame] | 910 | value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); |
| 911 | if (!value) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 912 | return; |
| 913 | |
| 914 | for (n = 0; n < count; n++) { |
| 915 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 916 | value[n] = min < 0 ? |
| 917 | snto32(extract(hid, data, offset + n * size, size), |
| 918 | size) : |
| 919 | extract(hid, data, offset + n * size, size); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 920 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 921 | /* Ignore report if ErrorRollOver */ |
| 922 | if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && |
| 923 | value[n] >= min && value[n] <= max && |
| 924 | field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) |
| 925 | goto exit; |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 926 | } |
| 927 | |
| 928 | for (n = 0; n < count; n++) { |
| 929 | |
| 930 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { |
| 931 | hid_process_event(hid, field, &field->usage[n], value[n], interrupt); |
| 932 | continue; |
| 933 | } |
| 934 | |
| 935 | if (field->value[n] >= min && field->value[n] <= max |
| 936 | && field->usage[field->value[n] - min].hid |
| 937 | && search(value, field->value[n], count)) |
| 938 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); |
| 939 | |
| 940 | if (value[n] >= min && value[n] <= max |
| 941 | && field->usage[value[n] - min].hid |
| 942 | && search(field->value, value[n], count)) |
| 943 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); |
| 944 | } |
| 945 | |
| 946 | memcpy(field->value, value, count * sizeof(__s32)); |
| 947 | exit: |
| 948 | kfree(value); |
| 949 | } |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 950 | |
| 951 | /* |
| 952 | * Output the field into the report. |
| 953 | */ |
| 954 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 955 | static void hid_output_field(const struct hid_device *hid, |
| 956 | struct hid_field *field, __u8 *data) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 957 | { |
| 958 | unsigned count = field->report_count; |
| 959 | unsigned offset = field->report_offset; |
| 960 | unsigned size = field->report_size; |
| 961 | unsigned n; |
| 962 | |
| 963 | for (n = 0; n < count; n++) { |
| 964 | if (field->logical_minimum < 0) /* signed values */ |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 965 | implement(hid, data, offset + n * size, size, |
| 966 | s32ton(field->value[n], size)); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 967 | else /* unsigned values */ |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 968 | implement(hid, data, offset + n * size, size, |
| 969 | field->value[n]); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 970 | } |
| 971 | } |
| 972 | |
| 973 | /* |
| 974 | * Create a report. |
| 975 | */ |
| 976 | |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 977 | void hid_output_report(struct hid_report *report, __u8 *data) |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 978 | { |
| 979 | unsigned n; |
| 980 | |
| 981 | if (report->id > 0) |
| 982 | *data++ = report->id; |
| 983 | |
Pete Zaitcev | 75c28df | 2010-04-12 12:16:11 -0600 | [diff] [blame] | 984 | memset(data, 0, ((report->size - 1) >> 3) + 1); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 985 | for (n = 0; n < report->maxfield; n++) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 986 | hid_output_field(report->device, report->field[n], data); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 987 | } |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 988 | EXPORT_SYMBOL_GPL(hid_output_report); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 989 | |
| 990 | /* |
| 991 | * Set a field value. The report this field belongs to has to be |
| 992 | * created and transferred to the device, to set this value in the |
| 993 | * device. |
| 994 | */ |
| 995 | |
| 996 | int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) |
| 997 | { |
| 998 | unsigned size = field->report_size; |
| 999 | |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1000 | hid_dump_input(field->report->device, field->usage + offset, value); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 1001 | |
| 1002 | if (offset >= field->report_count) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 1003 | hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", |
| 1004 | offset, field->report_count); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 1005 | return -1; |
| 1006 | } |
| 1007 | if (field->logical_minimum < 0) { |
| 1008 | if (value != snto32(s32ton(value, size), size)) { |
Jiri Kosina | 8c3d52f | 2011-12-15 11:00:38 +0100 | [diff] [blame] | 1009 | hid_err(field->report->device, "value %d is out of range\n", value); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 1010 | return -1; |
| 1011 | } |
| 1012 | } |
| 1013 | field->value[offset] = value; |
| 1014 | return 0; |
| 1015 | } |
Jiri Kosina | 229695e | 2006-12-08 18:40:53 +0100 | [diff] [blame] | 1016 | EXPORT_SYMBOL_GPL(hid_set_field); |
Jiri Kosina | dde5845 | 2006-12-08 18:40:44 +0100 | [diff] [blame] | 1017 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1018 | static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, |
| 1019 | const u8 *data) |
| 1020 | { |
| 1021 | struct hid_report *report; |
| 1022 | unsigned int n = 0; /* Normally report number is 0 */ |
| 1023 | |
| 1024 | /* Device uses numbered reports, data[0] is report number */ |
| 1025 | if (report_enum->numbered) |
| 1026 | n = *data; |
| 1027 | |
| 1028 | report = report_enum->report_id_hash[n]; |
| 1029 | if (report == NULL) |
| 1030 | dbg_hid("undefined report_id %u received\n", n); |
| 1031 | |
| 1032 | return report; |
| 1033 | } |
| 1034 | |
| 1035 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
| 1036 | int interrupt) |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1037 | { |
| 1038 | struct hid_report_enum *report_enum = hid->report_enum + type; |
| 1039 | struct hid_report *report; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1040 | unsigned int a; |
| 1041 | int rsize, csize = size; |
| 1042 | u8 *cdata = data; |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1043 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1044 | report = hid_get_report(report_enum, data); |
| 1045 | if (!report) |
| 1046 | return; |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1047 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1048 | if (report_enum->numbered) { |
| 1049 | cdata++; |
| 1050 | csize--; |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | rsize = ((report->size - 1) >> 3) + 1; |
| 1054 | |
Armando Visconti | 966922f | 2011-05-19 21:41:22 +0200 | [diff] [blame] | 1055 | if (rsize > HID_MAX_BUFFER_SIZE) |
| 1056 | rsize = HID_MAX_BUFFER_SIZE; |
| 1057 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1058 | if (csize < rsize) { |
| 1059 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, |
| 1060 | csize, rsize); |
| 1061 | memset(cdata + csize, 0, rsize - csize); |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1062 | } |
| 1063 | |
| 1064 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) |
| 1065 | hid->hiddev_report_event(hid, report); |
Alan Ott | 5a38f2c | 2010-04-26 18:34:46 -0400 | [diff] [blame] | 1066 | if (hid->claimed & HID_CLAIMED_HIDRAW) |
| 1067 | hidraw_report_event(hid, data, size); |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1068 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1069 | for (a = 0; a < report->maxfield; a++) |
| 1070 | hid_input_field(hid, report->field[a], cdata, interrupt); |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1071 | |
| 1072 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 1073 | hidinput_report_event(hid, report); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1074 | } |
| 1075 | EXPORT_SYMBOL_GPL(hid_report_raw_event); |
| 1076 | |
| 1077 | /** |
| 1078 | * hid_input_report - report data from lower layer (usb, bt...) |
| 1079 | * |
| 1080 | * @hid: hid device |
| 1081 | * @type: HID report type (HID_*_REPORT) |
| 1082 | * @data: report contents |
| 1083 | * @size: size of data parameter |
Jiri Kosina | ff9b00a | 2009-10-01 16:03:13 +0200 | [diff] [blame] | 1084 | * @interrupt: distinguish between interrupt and control transfers |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1085 | * |
| 1086 | * This is data entry for lower layers. |
| 1087 | */ |
| 1088 | int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) |
| 1089 | { |
Julia Lawall | 76c317d | 2009-07-19 17:26:13 +0200 | [diff] [blame] | 1090 | struct hid_report_enum *report_enum; |
| 1091 | struct hid_driver *hdrv; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1092 | struct hid_report *report; |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1093 | char *buf; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1094 | unsigned int i; |
Jiri Kosina | 45dc1ac | 2011-08-10 14:02:59 +0200 | [diff] [blame] | 1095 | int ret = 0; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1096 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1097 | if (!hid) |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1098 | return -ENODEV; |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1099 | |
| 1100 | if (down_trylock(&hid->driver_lock)) |
| 1101 | return -EBUSY; |
| 1102 | |
| 1103 | if (!hid->driver) { |
| 1104 | ret = -ENODEV; |
| 1105 | goto unlock; |
| 1106 | } |
Julia Lawall | 76c317d | 2009-07-19 17:26:13 +0200 | [diff] [blame] | 1107 | report_enum = hid->report_enum + type; |
| 1108 | hdrv = hid->driver; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1109 | |
| 1110 | if (!size) { |
| 1111 | dbg_hid("empty report\n"); |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1112 | ret = -1; |
| 1113 | goto unlock; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1114 | } |
| 1115 | |
Jiri Kosina | d1ff652 | 2009-09-15 11:59:49 +0200 | [diff] [blame] | 1116 | buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1117 | |
Jiri Kosina | f77e347 | 2010-03-18 14:11:53 +0100 | [diff] [blame] | 1118 | if (!buf) |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1119 | goto nomem; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1120 | |
| 1121 | /* dump the report */ |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1122 | snprintf(buf, HID_DEBUG_BUFSIZE - 1, |
Jiri Kosina | 1caea61 | 2010-03-18 12:09:53 +0100 | [diff] [blame] | 1123 | "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un"); |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1124 | hid_debug_event(hid, buf); |
Jiri Kosina | 1caea61 | 2010-03-18 12:09:53 +0100 | [diff] [blame] | 1125 | |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1126 | for (i = 0; i < size; i++) { |
| 1127 | snprintf(buf, HID_DEBUG_BUFSIZE - 1, |
| 1128 | " %02x", data[i]); |
| 1129 | hid_debug_event(hid, buf); |
| 1130 | } |
| 1131 | hid_debug_event(hid, "\n"); |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 1132 | kfree(buf); |
| 1133 | |
| 1134 | nomem: |
Jiri Kosina | f77e347 | 2010-03-18 14:11:53 +0100 | [diff] [blame] | 1135 | report = hid_get_report(report_enum, data); |
| 1136 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1137 | if (!report) { |
| 1138 | ret = -1; |
| 1139 | goto unlock; |
| 1140 | } |
Jiri Kosina | f77e347 | 2010-03-18 14:11:53 +0100 | [diff] [blame] | 1141 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1142 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { |
| 1143 | ret = hdrv->raw_event(hid, report, data, size); |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1144 | if (ret != 0) { |
| 1145 | ret = ret < 0 ? ret : 0; |
| 1146 | goto unlock; |
| 1147 | } |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1148 | } |
| 1149 | |
| 1150 | hid_report_raw_event(hid, type, data, size, interrupt); |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1151 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1152 | unlock: |
| 1153 | up(&hid->driver_lock); |
Jiri Kosina | 45dc1ac | 2011-08-10 14:02:59 +0200 | [diff] [blame] | 1154 | return ret; |
Jiri Kosina | aa8de2f | 2006-12-08 18:41:17 +0100 | [diff] [blame] | 1155 | } |
| 1156 | EXPORT_SYMBOL_GPL(hid_input_report); |
| 1157 | |
Jiri Kosina | 0f37cd0 | 2008-08-20 19:13:52 +0200 | [diff] [blame] | 1158 | static bool hid_match_one_id(struct hid_device *hdev, |
| 1159 | const struct hid_device_id *id) |
| 1160 | { |
| 1161 | return id->bus == hdev->bus && |
| 1162 | (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && |
| 1163 | (id->product == HID_ANY_ID || id->product == hdev->product); |
| 1164 | } |
| 1165 | |
Jeremy Fitzhardinge | bbc21cf | 2011-12-02 11:12:36 -0800 | [diff] [blame] | 1166 | const struct hid_device_id *hid_match_id(struct hid_device *hdev, |
Jiri Kosina | 0f37cd0 | 2008-08-20 19:13:52 +0200 | [diff] [blame] | 1167 | const struct hid_device_id *id) |
| 1168 | { |
| 1169 | for (; id->bus; id++) |
| 1170 | if (hid_match_one_id(hdev, id)) |
| 1171 | return id; |
| 1172 | |
| 1173 | return NULL; |
| 1174 | } |
| 1175 | |
| 1176 | static const struct hid_device_id hid_hiddev_list[] = { |
Richard Hughes | c0bd6a4 | 2008-08-27 11:19:37 +0200 | [diff] [blame] | 1177 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, |
| 1178 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, |
Jiri Kosina | 0f37cd0 | 2008-08-20 19:13:52 +0200 | [diff] [blame] | 1179 | { } |
| 1180 | }; |
| 1181 | |
| 1182 | static bool hid_hiddev(struct hid_device *hdev) |
| 1183 | { |
| 1184 | return !!hid_match_id(hdev, hid_hiddev_list); |
| 1185 | } |
| 1186 | |
Alan Ott | 6d3bfb7 | 2011-01-23 22:50:18 -0500 | [diff] [blame] | 1187 | |
| 1188 | static ssize_t |
| 1189 | read_report_descriptor(struct file *filp, struct kobject *kobj, |
| 1190 | struct bin_attribute *attr, |
| 1191 | char *buf, loff_t off, size_t count) |
| 1192 | { |
| 1193 | struct device *dev = container_of(kobj, struct device, kobj); |
| 1194 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 1195 | |
| 1196 | if (off >= hdev->rsize) |
| 1197 | return 0; |
| 1198 | |
| 1199 | if (off + count > hdev->rsize) |
| 1200 | count = hdev->rsize - off; |
| 1201 | |
| 1202 | memcpy(buf, hdev->rdesc + off, count); |
| 1203 | |
| 1204 | return count; |
| 1205 | } |
| 1206 | |
| 1207 | static struct bin_attribute dev_bin_attr_report_desc = { |
| 1208 | .attr = { .name = "report_descriptor", .mode = 0444 }, |
| 1209 | .read = read_report_descriptor, |
| 1210 | .size = HID_MAX_DESCRIPTOR_SIZE, |
| 1211 | }; |
| 1212 | |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1213 | int hid_connect(struct hid_device *hdev, unsigned int connect_mask) |
| 1214 | { |
| 1215 | static const char *types[] = { "Device", "Pointer", "Mouse", "Device", |
| 1216 | "Joystick", "Gamepad", "Keyboard", "Keypad", |
| 1217 | "Multi-Axis Controller" |
| 1218 | }; |
| 1219 | const char *type, *bus; |
| 1220 | char buf[64]; |
| 1221 | unsigned int i; |
| 1222 | int len; |
Alan Ott | 6d3bfb7 | 2011-01-23 22:50:18 -0500 | [diff] [blame] | 1223 | int ret; |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1224 | |
Bastien Nocera | b5e5a37 | 2010-04-16 17:19:50 +0100 | [diff] [blame] | 1225 | if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) |
| 1226 | connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); |
Daniel Mack | 3a343ee | 2010-07-12 19:28:27 +0200 | [diff] [blame] | 1227 | if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) |
| 1228 | connect_mask |= HID_CONNECT_HIDINPUT_FORCE; |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1229 | if (hdev->bus != BUS_USB) |
| 1230 | connect_mask &= ~HID_CONNECT_HIDDEV; |
Jiri Kosina | 0f37cd0 | 2008-08-20 19:13:52 +0200 | [diff] [blame] | 1231 | if (hid_hiddev(hdev)) |
| 1232 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1233 | |
| 1234 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, |
| 1235 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) |
| 1236 | hdev->claimed |= HID_CLAIMED_INPUT; |
Benjamin Tissoires | b77c392 | 2011-09-21 16:56:54 +0200 | [diff] [blame] | 1237 | if (hdev->quirks & HID_QUIRK_MULTITOUCH) { |
| 1238 | /* this device should be handled by hid-multitouch, skip it */ |
Benjamin Tissoires | b77c392 | 2011-09-21 16:56:54 +0200 | [diff] [blame] | 1239 | return -ENODEV; |
| 1240 | } |
| 1241 | |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1242 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && |
| 1243 | !hdev->hiddev_connect(hdev, |
| 1244 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) |
| 1245 | hdev->claimed |= HID_CLAIMED_HIDDEV; |
| 1246 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) |
| 1247 | hdev->claimed |= HID_CLAIMED_HIDRAW; |
| 1248 | |
| 1249 | if (!hdev->claimed) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 1250 | hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n"); |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1251 | return -ENODEV; |
| 1252 | } |
| 1253 | |
| 1254 | if ((hdev->claimed & HID_CLAIMED_INPUT) && |
| 1255 | (connect_mask & HID_CONNECT_FF) && hdev->ff_init) |
| 1256 | hdev->ff_init(hdev); |
| 1257 | |
| 1258 | len = 0; |
| 1259 | if (hdev->claimed & HID_CLAIMED_INPUT) |
| 1260 | len += sprintf(buf + len, "input"); |
| 1261 | if (hdev->claimed & HID_CLAIMED_HIDDEV) |
| 1262 | len += sprintf(buf + len, "%shiddev%d", len ? "," : "", |
| 1263 | hdev->minor); |
| 1264 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
| 1265 | len += sprintf(buf + len, "%shidraw%d", len ? "," : "", |
| 1266 | ((struct hidraw *)hdev->hidraw)->minor); |
| 1267 | |
| 1268 | type = "Device"; |
| 1269 | for (i = 0; i < hdev->maxcollection; i++) { |
| 1270 | struct hid_collection *col = &hdev->collection[i]; |
| 1271 | if (col->type == HID_COLLECTION_APPLICATION && |
| 1272 | (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && |
| 1273 | (col->usage & 0xffff) < ARRAY_SIZE(types)) { |
| 1274 | type = types[col->usage & 0xffff]; |
| 1275 | break; |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | switch (hdev->bus) { |
| 1280 | case BUS_USB: |
| 1281 | bus = "USB"; |
| 1282 | break; |
| 1283 | case BUS_BLUETOOTH: |
| 1284 | bus = "BLUETOOTH"; |
| 1285 | break; |
| 1286 | default: |
| 1287 | bus = "<UNKNOWN>"; |
| 1288 | } |
| 1289 | |
Alan Ott | 6d3bfb7 | 2011-01-23 22:50:18 -0500 | [diff] [blame] | 1290 | ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc); |
| 1291 | if (ret) |
| 1292 | hid_warn(hdev, |
| 1293 | "can't create sysfs report descriptor attribute err: %d\n", ret); |
| 1294 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 1295 | hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", |
| 1296 | buf, bus, hdev->version >> 8, hdev->version & 0xff, |
| 1297 | type, hdev->name, hdev->phys); |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1298 | |
| 1299 | return 0; |
| 1300 | } |
| 1301 | EXPORT_SYMBOL_GPL(hid_connect); |
| 1302 | |
Jiri Kosina | c4c259b | 2009-09-15 16:27:45 +0200 | [diff] [blame] | 1303 | void hid_disconnect(struct hid_device *hdev) |
| 1304 | { |
Alan Ott | 6d3bfb7 | 2011-01-23 22:50:18 -0500 | [diff] [blame] | 1305 | device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc); |
Jiri Kosina | c4c259b | 2009-09-15 16:27:45 +0200 | [diff] [blame] | 1306 | if (hdev->claimed & HID_CLAIMED_INPUT) |
| 1307 | hidinput_disconnect(hdev); |
| 1308 | if (hdev->claimed & HID_CLAIMED_HIDDEV) |
| 1309 | hdev->hiddev_disconnect(hdev); |
| 1310 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
| 1311 | hidraw_disconnect(hdev); |
| 1312 | } |
| 1313 | EXPORT_SYMBOL_GPL(hid_disconnect); |
| 1314 | |
Jiri Kosina | bae7eb3 | 2009-01-28 23:06:37 +0100 | [diff] [blame] | 1315 | /* a list of devices for which there is a specialized driver on HID bus */ |
Dmitry Torokhov | ce06b9d | 2010-11-28 16:37:14 +0100 | [diff] [blame] | 1316 | static const struct hid_device_id hid_have_special_driver[] = { |
Stephane Chatty | b6353f4 | 2009-12-22 23:04:17 +0100 | [diff] [blame] | 1317 | { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, |
Stephane Chatty | 6dec143 | 2010-04-11 14:51:24 +0200 | [diff] [blame] | 1318 | { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, |
Jiri Slaby | 14a21cd | 2008-06-23 23:31:09 +0200 | [diff] [blame] | 1319 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
| 1320 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
Lech Perczak | b7e1b20 | 2010-09-16 23:19:33 +0200 | [diff] [blame] | 1321 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
Sergei Kolzun | c0dbcc3 | 2010-07-19 12:13:23 +0200 | [diff] [blame] | 1322 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
Benjamin Tissoires | e6aac34 | 2011-05-19 14:18:13 +0200 | [diff] [blame] | 1323 | { HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, USB_DEVICE_ID_ACTIONSTAR_1011) }, |
Jiri Kosina | df9bcac | 2008-10-14 22:45:40 +0200 | [diff] [blame] | 1324 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1325 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, |
| 1326 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
Michael Poole | 128537c | 2010-02-06 12:24:36 -0500 | [diff] [blame] | 1327 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, |
Chase Douglas | a462230 | 2010-08-31 21:56:23 -0400 | [diff] [blame] | 1328 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1329 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
| 1330 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
| 1331 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
| 1332 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, |
| 1333 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, |
| 1334 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, |
| 1335 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, |
| 1336 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, |
| 1337 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, |
| 1338 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, |
| 1339 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, |
Ryan Finnie | fef3f57 | 2009-03-05 10:18:01 +0100 | [diff] [blame] | 1340 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) }, |
| 1341 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) }, |
| 1342 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1343 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, |
| 1344 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, |
| 1345 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, |
| 1346 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
| 1347 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
| 1348 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 1349 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, |
| 1350 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, |
| 1351 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1352 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, |
| 1353 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, |
| 1354 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, |
| 1355 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, |
| 1356 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, |
| 1357 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, |
Henrik Rydberg | a96d6ef | 2008-11-04 20:03:45 +0100 | [diff] [blame] | 1358 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, |
| 1359 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, |
| 1360 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 1361 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, |
| 1362 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, |
| 1363 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, |
| 1364 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, |
| 1365 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, |
| 1366 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, |
Andy Botting | 47340bd | 2011-03-12 20:27:22 -0800 | [diff] [blame] | 1367 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, |
| 1368 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, |
| 1369 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, |
Gökçen Eraslan | 213f9da | 2011-10-22 22:39:06 +0300 | [diff] [blame] | 1370 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, |
| 1371 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, |
| 1372 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, |
Dan Bastone | 4a4c879 | 2011-07-31 07:40:49 -0400 | [diff] [blame] | 1373 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, |
| 1374 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, |
| 1375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, |
Jiri Kosina | f6f554f | 2011-08-10 14:12:52 +0200 | [diff] [blame] | 1376 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, |
| 1377 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, |
| 1378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, |
Jiri Kosina | b3aec7b | 2011-10-25 09:59:04 +0200 | [diff] [blame] | 1379 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
| 1380 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
| 1381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
Christian Schuerer-Waldheim | 23aeb61 | 2010-01-06 14:49:57 +0100 | [diff] [blame] | 1382 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
| 1383 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
| 1384 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
Andreas Krist | ad734bc | 2011-10-28 18:50:39 +0200 | [diff] [blame] | 1385 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1386 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
| 1387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
Jiri Kosina | eaca138 | 2010-09-08 14:31:47 +0200 | [diff] [blame] | 1388 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, |
Roland Baum | cec15a0 | 2010-09-08 14:27:55 +0200 | [diff] [blame] | 1389 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, |
Jiri Slaby | b5635b1 | 2008-06-24 23:24:57 +0200 | [diff] [blame] | 1390 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 1391 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, |
Jiri Kosina | c3dc66d | 2010-08-30 15:43:25 +0200 | [diff] [blame] | 1392 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, |
Benjamin Tissoires | 5519cab | 2011-01-07 23:45:50 +0100 | [diff] [blame] | 1393 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, |
Stephane Chatty | 36213e1 | 2010-04-15 00:28:11 +0200 | [diff] [blame] | 1394 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
Benjamin Tissoires | bc5ab08 | 2011-01-08 12:15:41 +0100 | [diff] [blame] | 1395 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, |
Stephane Chatty | ba4d8ab | 2010-04-22 23:24:36 +0200 | [diff] [blame] | 1396 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, |
François Jaouen | 272036e | 2010-10-13 10:47:32 +0200 | [diff] [blame] | 1397 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, |
Jiri Slaby | 3b239cd | 2008-06-24 20:42:25 +0200 | [diff] [blame] | 1398 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
Raphaël Doursenaud | 1ce31b2 | 2010-04-08 13:40:52 +0200 | [diff] [blame] | 1399 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
Jiri Slaby | fcfacfd | 2008-06-24 22:48:52 +0200 | [diff] [blame] | 1400 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
Dennis Kügler | b9e4b1e | 2010-11-23 21:40:09 +0100 | [diff] [blame] | 1401 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
Keng-Yu Lin | 3596bb9 | 2012-02-02 10:31:26 +0100 | [diff] [blame] | 1402 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
Austin Zhang | 942fd42 | 2011-05-28 02:03:47 +0800 | [diff] [blame] | 1403 | { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, |
Don Prince | 3a370ca | 2010-05-12 15:18:59 +0200 | [diff] [blame] | 1404 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
Benjamin Tissoires | 79603dc | 2011-05-19 14:18:14 +0200 | [diff] [blame] | 1405 | { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
Jiri Slaby | 0f22132 | 2008-06-23 22:54:08 +0200 | [diff] [blame] | 1406 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
| 1407 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
Jiri Kosina | e8d0eab | 2009-12-02 22:54:11 +0100 | [diff] [blame] | 1408 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
Jiri Slaby | 0f22132 | 2008-06-23 22:54:08 +0200 | [diff] [blame] | 1409 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, |
Benjamin Tissoires | a3b5e57 | 2011-01-07 23:46:30 +0100 | [diff] [blame] | 1410 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, |
Richard Walmsley | 3f866fb | 2009-03-04 22:12:04 +1300 | [diff] [blame] | 1411 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
Nikolai Kondrashov | e05eefb | 2011-01-28 14:50:52 +0300 | [diff] [blame] | 1412 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
Benjamin Tissoires | e36f690 | 2011-11-23 10:54:31 +0100 | [diff] [blame] | 1413 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, |
| 1414 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, |
| 1415 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, |
Benjamin Tissoires | fd1d152 | 2012-03-06 10:53:47 +0100 | [diff] [blame] | 1416 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) }, |
| 1417 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) }, |
Benjamin Tissoires | e36f690 | 2011-11-23 10:54:31 +0100 | [diff] [blame] | 1418 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, |
| 1419 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, |
Marek Vasut | bb9ff21 | 2011-11-23 10:54:32 +0100 | [diff] [blame] | 1420 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, |
Benjamin Tissoires | e36f690 | 2011-11-23 10:54:31 +0100 | [diff] [blame] | 1421 | { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, |
Richard Nauber | 64b386e | 2010-06-28 18:54:25 +0200 | [diff] [blame] | 1422 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, |
Benjamin Tissoires | c04abee | 2011-05-19 11:37:29 +0200 | [diff] [blame] | 1423 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) }, |
Ignaz Forster | 04561c5 | 2010-11-01 15:13:37 -0400 | [diff] [blame] | 1424 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, |
Jiri Slaby | 1f243e3 | 2008-06-24 21:11:21 +0200 | [diff] [blame] | 1425 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, |
Andreas Nielsen | 4d5df5d | 2012-03-19 15:41:03 +0100 | [diff] [blame] | 1426 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_FRUCTEL, USB_DEVICE_ID_GAMETEL_MT_MODE) }, |
Jiri Kosina | 5181e59 | 2008-11-17 01:44:38 +0100 | [diff] [blame] | 1427 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, |
Jiri Kosina | 578f3a3 | 2008-11-20 15:55:38 +0100 | [diff] [blame] | 1428 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, |
Benjamin Tissoires | 5572da0 | 2011-01-07 23:47:27 +0100 | [diff] [blame] | 1429 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, |
Benjamin Tissoires | ee0fbd1 | 2011-05-19 14:18:15 +0200 | [diff] [blame] | 1430 | { HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, USB_DEVICE_ID_GOODTOUCH_000f) }, |
Jiri Kosina | 5181e59 | 2008-11-17 01:44:38 +0100 | [diff] [blame] | 1431 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, |
Lukasz Lubojanski | 42859e0 | 2008-12-11 22:07:59 +0100 | [diff] [blame] | 1432 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, |
Jiri Slaby | 949f8fe | 2008-07-24 23:35:13 +0200 | [diff] [blame] | 1433 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, |
Jiri Kosina | 1e09320 | 2008-10-17 11:52:23 +0200 | [diff] [blame] | 1434 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, |
Cory Maccarrone | c2fd1a4 | 2010-05-22 13:00:28 -0700 | [diff] [blame] | 1435 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, |
Benjamin Tissoires | 5519cab | 2011-01-07 23:45:50 +0100 | [diff] [blame] | 1436 | { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) }, |
Benjamin Tissoires | 5458036 | 2011-11-29 13:13:12 +0100 | [diff] [blame] | 1437 | { HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, |
Stephane Chatty | a062cc5 | 2011-09-17 22:27:30 +0200 | [diff] [blame] | 1438 | { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6650) }, |
Anssi Hannula | d946e65 | 2011-06-27 00:07:31 +0300 | [diff] [blame] | 1439 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, |
Austin Zhang | 4e61f0d | 2011-05-09 23:54:14 +0800 | [diff] [blame] | 1440 | { HID_USB_DEVICE(USB_VENDOR_ID_ILITEK, USB_DEVICE_ID_ILITEK_MULTITOUCH) }, |
Benjamin Tissoires | b2e7617 | 2011-02-15 15:33:48 +0100 | [diff] [blame] | 1441 | { HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, |
Jiri Kosina | fdf93aa | 2009-03-04 16:09:40 +0100 | [diff] [blame] | 1442 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
Jiri Kosina | 177900e | 2011-02-17 15:12:45 +0100 | [diff] [blame] | 1443 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 1444 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
Nikolai Kondrashov | 22ca20b | 2012-02-28 13:01:46 +0200 | [diff] [blame] | 1445 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, |
| 1446 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, |
| 1447 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
Jiri Slaby | b5635b1 | 2008-06-24 23:24:57 +0200 | [diff] [blame] | 1448 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
Chris Schlund | 75b0702 | 2011-02-03 16:41:47 +0100 | [diff] [blame] | 1449 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
Jeff Brown | c50bb1a | 2011-08-15 21:12:09 -0700 | [diff] [blame] | 1450 | { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MULTITOUCH) }, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 1451 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
| 1452 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
| 1453 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, |
| 1454 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, |
| 1455 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, |
| 1456 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, |
| 1457 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 1458 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, |
| 1459 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 1460 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, |
| 1461 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, |
Hendrik Iben | 2c6118e | 2010-10-04 15:39:49 +0200 | [diff] [blame] | 1462 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 1463 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, |
| 1464 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, |
| 1465 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, |
Jiri Kosina | fd30ea8 | 2009-06-23 12:11:31 +0200 | [diff] [blame] | 1466 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 1467 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, |
Gary Stein | 74f292c | 2010-01-13 00:25:58 +0100 | [diff] [blame] | 1468 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 1469 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, |
| 1470 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, |
Jiri Kosina | 5623a24 | 2011-03-17 00:43:23 +0100 | [diff] [blame] | 1471 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, |
Michal Malý | e00ddc9 | 2011-09-10 21:28:23 +0200 | [diff] [blame] | 1472 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, |
Christophe Borivant | 243b706 | 2009-04-17 11:39:39 +0200 | [diff] [blame] | 1473 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
Peter Gundermann | fdc6807 | 2011-05-03 10:15:03 +0200 | [diff] [blame] | 1474 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, |
Konstantin Khlebnikov | 0944e96 | 2012-02-13 14:13:03 +0400 | [diff] [blame] | 1475 | #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) |
Nestor Lopez Casado | 534a7b8 | 2011-09-15 11:34:49 +0200 | [diff] [blame] | 1476 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, |
| 1477 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, |
Konstantin Khlebnikov | 0944e96 | 2012-02-13 14:13:03 +0400 | [diff] [blame] | 1478 | #endif |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 1479 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 1480 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 1481 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, |
| 1482 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, |
Benjamin Tissoires | df167c4 | 2011-05-18 15:27:24 +0200 | [diff] [blame] | 1483 | { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH) }, |
Benjamin Tissoires | c3ead6d | 2011-06-21 15:01:55 +0200 | [diff] [blame] | 1484 | { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH_DUAL) }, |
Bruno Prémont | 236db47 | 2010-03-30 22:33:50 +0200 | [diff] [blame] | 1485 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, |
| 1486 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, |
Jiri Kosina | b580169 | 2011-07-22 12:11:15 +0200 | [diff] [blame] | 1487 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, |
Jiri Slaby | 78a849a | 2008-06-20 21:26:11 +0200 | [diff] [blame] | 1488 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
| 1489 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, |
| 1490 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, |
| 1491 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
Jiri Kosina | f3b83d7 | 2011-06-13 23:08:18 +0300 | [diff] [blame] | 1492 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
Jiri Slaby | 78a849a | 2008-06-20 21:26:11 +0200 | [diff] [blame] | 1493 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
Jiri Slaby | 3b8006e | 2008-06-25 00:07:50 +0200 | [diff] [blame] | 1494 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
Rafi Rubin | 94011f9 | 2008-11-19 15:54:46 +0100 | [diff] [blame] | 1495 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
micki | 6e32819 | 2010-06-19 11:37:29 +0300 | [diff] [blame] | 1496 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, |
| 1497 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, |
| 1498 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3) }, |
| 1499 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4) }, |
| 1500 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5) }, |
| 1501 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6) }, |
| 1502 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7) }, |
| 1503 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8) }, |
| 1504 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9) }, |
| 1505 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10) }, |
| 1506 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11) }, |
| 1507 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12) }, |
| 1508 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13) }, |
| 1509 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14) }, |
| 1510 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15) }, |
| 1511 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, |
| 1512 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, |
| 1513 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, |
Herton Ronaldo Krzesinski | 270fdc0 | 2011-03-16 14:13:53 -0300 | [diff] [blame] | 1514 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, |
Johnathon Harris | cd9ec30 | 2010-01-21 14:36:52 +0000 | [diff] [blame] | 1515 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, |
Denis Kovalev | 2258e86 | 2012-02-14 00:50:33 -0800 | [diff] [blame] | 1516 | { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT780) }, |
| 1517 | { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT880) }, |
John Sung | 6ab3a9a | 2011-04-21 16:21:52 +0200 | [diff] [blame] | 1518 | { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_PCI) }, |
Jiri Slaby | 1e76253 | 2008-06-24 23:46:21 +0200 | [diff] [blame] | 1519 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
Aaron Tian | b7ea95f | 2011-12-15 11:09:06 +0800 | [diff] [blame] | 1520 | { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, |
| 1521 | { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, |
| 1522 | { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, |
Terry Lambert | f6a0460 | 2011-10-14 17:18:54 -0700 | [diff] [blame] | 1523 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, |
Stephane Chatty | 49e4739 | 2010-01-13 00:29:16 +0100 | [diff] [blame] | 1524 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, |
Alex Neblett | f54405d | 2010-02-02 21:16:03 -0800 | [diff] [blame] | 1525 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, |
Stefan Achatz | 14bf62c | 2010-03-18 16:19:43 +0100 | [diff] [blame] | 1526 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, |
Stefan Achatz | e68cc60 | 2011-01-06 09:00:34 +0100 | [diff] [blame] | 1527 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
Stefan Achatz | d41c2a7 | 2011-11-24 17:46:24 +0100 | [diff] [blame] | 1528 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
Stefan Achatz | 47dbdbf | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 1529 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, |
Stefan Achatz | 0e70f97 | 2011-01-30 13:38:24 +0100 | [diff] [blame] | 1530 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
Stefan Achatz | cb7cf3d | 2010-08-29 12:30:18 +0200 | [diff] [blame] | 1531 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
Stefan Achatz | 3fce224 | 2011-03-23 18:11:36 +0100 | [diff] [blame] | 1532 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, |
Andreas Hübner | 1e93674 | 2012-02-22 02:10:06 +0100 | [diff] [blame] | 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, |
Jiri Slaby | 980a3da | 2008-06-25 22:31:48 +0200 | [diff] [blame] | 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
Don Prince | b355850 | 2010-05-17 11:42:39 +0100 | [diff] [blame] | 1535 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
Jiri Kosina | d586dca | 2011-03-21 13:54:22 +0100 | [diff] [blame] | 1536 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, |
Jiri Slaby | bd28ce0 | 2008-06-25 23:47:04 +0200 | [diff] [blame] | 1537 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
Jiri Kosina | 35dca5b | 2011-04-28 15:43:13 +0200 | [diff] [blame] | 1538 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, |
Bastien Nocera | f9ce7c2 | 2010-01-20 12:01:53 +0000 | [diff] [blame] | 1539 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
Jiri Kosina | cc6e0bb | 2008-10-23 12:58:38 +0200 | [diff] [blame] | 1540 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
Stephane Chatty | d3fb545 | 2010-01-04 12:04:08 +0100 | [diff] [blame] | 1541 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, |
Pascal Auriel - Stantum | b6dc799 | 2010-10-01 16:01:28 +0200 | [diff] [blame] | 1542 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) }, |
| 1543 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) }, |
Jiri Slaby | 90231e7 | 2008-06-23 21:56:07 +0200 | [diff] [blame] | 1544 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
Anssi Hannula | daedb3d | 2009-02-14 11:45:05 +0200 | [diff] [blame] | 1545 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
| 1546 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
Ruben Aos Garralda | 7a84b13 | 2009-06-29 09:41:29 +0200 | [diff] [blame] | 1547 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, |
| 1548 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) }, |
Anssi Hannula | daedb3d | 2009-02-14 11:45:05 +0200 | [diff] [blame] | 1549 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, |
Markus Rathgeb | 3ee8f0a | 2010-03-13 17:29:43 +0100 | [diff] [blame] | 1550 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, |
Anssi Hannula | daedb3d | 2009-02-14 11:45:05 +0200 | [diff] [blame] | 1551 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, |
Simon Wood | d65c376 | 2010-11-29 17:41:23 +0100 | [diff] [blame] | 1552 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
Jiri Kosina | 740363f | 2012-03-13 09:36:05 +0100 | [diff] [blame] | 1553 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
Jarod Wilson | 44ea35c | 2011-10-14 16:57:42 -0400 | [diff] [blame] | 1554 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 1555 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
Kees Bakker | 5400108 | 2010-07-13 22:50:51 +0200 | [diff] [blame] | 1556 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
Benjamin Tissoires | 5e74e56 | 2011-05-19 14:18:16 +0200 | [diff] [blame] | 1557 | { HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, |
Bruno Premont | 711a680 | 2009-07-13 14:19:58 +0200 | [diff] [blame] | 1558 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
Benjamin Tissoires | c64f6f9 | 2011-01-08 12:15:42 +0100 | [diff] [blame] | 1559 | { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, |
Nikolai Kondrashov | 41fa923 | 2010-08-23 15:09:01 +0400 | [diff] [blame] | 1560 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, |
Nikolai Kondrashov | f8a489c | 2010-08-09 20:44:17 +0400 | [diff] [blame] | 1561 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, |
| 1562 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, |
| 1563 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, |
Nikolai Kondrashov | 6be914f | 2011-07-06 09:23:41 +0300 | [diff] [blame] | 1564 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, |
Benjamin Tissoires | 617b64f | 2011-05-19 14:18:17 +0200 | [diff] [blame] | 1565 | { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, |
| 1566 | { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, |
Jussi Kivilinna | fac733f | 2009-05-13 11:54:38 +0300 | [diff] [blame] | 1567 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, |
Sean Young | 42fc04e | 2012-02-18 12:53:44 +0000 | [diff] [blame] | 1568 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, |
Sean Young | ad395cc | 2011-08-14 20:42:05 +0100 | [diff] [blame] | 1569 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, |
Sean Young | 1bcc206 | 2011-10-20 21:26:21 +0100 | [diff] [blame] | 1570 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, |
| 1571 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, |
| 1572 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 1573 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 1574 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, |
Nikolai Kondrashov | 72a4634 | 2010-08-20 19:21:11 +0400 | [diff] [blame] | 1575 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, |
Nikolai Kondrashov | 00e7f96 | 2010-09-25 23:16:58 +0400 | [diff] [blame] | 1576 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, |
Nikolai Kondrashov | 4fdc18d | 2012-02-06 22:54:20 +0200 | [diff] [blame] | 1577 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, |
Nikolai Kondrashov | a786e83 | 2012-03-06 09:54:24 +0200 | [diff] [blame] | 1578 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, |
Nikolai Kondrashov | 72a4634 | 2010-08-20 19:21:11 +0400 | [diff] [blame] | 1579 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
Nikolai Kondrashov | 8f1acc3 | 2010-08-30 14:06:36 +0400 | [diff] [blame] | 1580 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
ice chien | bc8a2a9 | 2011-07-15 16:58:06 +0800 | [diff] [blame] | 1581 | { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) }, |
Masatoshi Hoshikawa | 11576c6 | 2012-01-05 11:53:46 +0900 | [diff] [blame] | 1582 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) }, |
| 1583 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) }, |
| 1584 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR) }, |
| 1585 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX1) }, |
| 1586 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX1) }, |
| 1587 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR1) }, |
| 1588 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX2) }, |
| 1589 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX2) }, |
| 1590 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, |
Stefan Kriwanek | 74bc695 | 2011-05-27 18:40:29 +0200 | [diff] [blame] | 1591 | { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, |
Anssi Hannula | daedb3d | 2009-02-14 11:45:05 +0200 | [diff] [blame] | 1592 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, |
| 1593 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, |
Don Prince | a9885c8 | 2010-05-14 17:30:59 +0100 | [diff] [blame] | 1594 | { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1595 | |
Jiri Slaby | 78a849a | 2008-06-20 21:26:11 +0200 | [diff] [blame] | 1596 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, |
David Herrmann | 02fb72a | 2011-07-05 13:45:09 +0200 | [diff] [blame] | 1597 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1598 | { } |
| 1599 | }; |
| 1600 | |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 1601 | struct hid_dynid { |
| 1602 | struct list_head list; |
| 1603 | struct hid_device_id id; |
| 1604 | }; |
| 1605 | |
| 1606 | /** |
| 1607 | * store_new_id - add a new HID device ID to this driver and re-probe devices |
| 1608 | * @driver: target device driver |
| 1609 | * @buf: buffer for scanning device ID data |
| 1610 | * @count: input size |
| 1611 | * |
| 1612 | * Adds a new dynamic hid device ID to this driver, |
| 1613 | * and causes the driver to probe for all devices again. |
| 1614 | */ |
| 1615 | static ssize_t store_new_id(struct device_driver *drv, const char *buf, |
| 1616 | size_t count) |
| 1617 | { |
| 1618 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); |
| 1619 | struct hid_dynid *dynid; |
| 1620 | __u32 bus, vendor, product; |
| 1621 | unsigned long driver_data = 0; |
| 1622 | int ret; |
| 1623 | |
| 1624 | ret = sscanf(buf, "%x %x %x %lx", |
| 1625 | &bus, &vendor, &product, &driver_data); |
| 1626 | if (ret < 3) |
| 1627 | return -EINVAL; |
| 1628 | |
| 1629 | dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); |
| 1630 | if (!dynid) |
| 1631 | return -ENOMEM; |
| 1632 | |
| 1633 | dynid->id.bus = bus; |
| 1634 | dynid->id.vendor = vendor; |
| 1635 | dynid->id.product = product; |
| 1636 | dynid->id.driver_data = driver_data; |
| 1637 | |
| 1638 | spin_lock(&hdrv->dyn_lock); |
| 1639 | list_add_tail(&dynid->list, &hdrv->dyn_list); |
| 1640 | spin_unlock(&hdrv->dyn_lock); |
| 1641 | |
Alan Stern | cef9bc5 | 2012-01-24 13:34:41 -0500 | [diff] [blame] | 1642 | ret = driver_attach(&hdrv->driver); |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 1643 | |
| 1644 | return ret ? : count; |
| 1645 | } |
| 1646 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); |
| 1647 | |
| 1648 | static void hid_free_dynids(struct hid_driver *hdrv) |
| 1649 | { |
| 1650 | struct hid_dynid *dynid, *n; |
| 1651 | |
| 1652 | spin_lock(&hdrv->dyn_lock); |
| 1653 | list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { |
| 1654 | list_del(&dynid->list); |
| 1655 | kfree(dynid); |
| 1656 | } |
| 1657 | spin_unlock(&hdrv->dyn_lock); |
| 1658 | } |
| 1659 | |
| 1660 | static const struct hid_device_id *hid_match_device(struct hid_device *hdev, |
| 1661 | struct hid_driver *hdrv) |
| 1662 | { |
| 1663 | struct hid_dynid *dynid; |
| 1664 | |
| 1665 | spin_lock(&hdrv->dyn_lock); |
| 1666 | list_for_each_entry(dynid, &hdrv->dyn_list, list) { |
| 1667 | if (hid_match_one_id(hdev, &dynid->id)) { |
| 1668 | spin_unlock(&hdrv->dyn_lock); |
| 1669 | return &dynid->id; |
| 1670 | } |
| 1671 | } |
| 1672 | spin_unlock(&hdrv->dyn_lock); |
| 1673 | |
| 1674 | return hid_match_id(hdev, hdrv->id_table); |
| 1675 | } |
| 1676 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1677 | static int hid_bus_match(struct device *dev, struct device_driver *drv) |
| 1678 | { |
| 1679 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); |
| 1680 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 1681 | |
Benjamin Tissoires | 8d179a9 | 2012-03-06 17:57:04 +0100 | [diff] [blame] | 1682 | if ((hdev->quirks & HID_QUIRK_MULTITOUCH) && |
| 1683 | !strncmp(hdrv->name, "hid-multitouch", 14)) |
| 1684 | return 1; |
| 1685 | |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 1686 | if (!hid_match_device(hdev, hdrv)) |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1687 | return 0; |
| 1688 | |
Dmitry Torokhov | ce06b9d | 2010-11-28 16:37:14 +0100 | [diff] [blame] | 1689 | /* generic wants all that don't have specialized driver */ |
Jiri Kosina | 6b1968d | 2012-03-09 13:55:43 +0100 | [diff] [blame] | 1690 | if (!strncmp(hdrv->name, "generic-", 8) && !hid_ignore_special_drivers) |
Dmitry Torokhov | ce06b9d | 2010-11-28 16:37:14 +0100 | [diff] [blame] | 1691 | return !hid_match_id(hdev, hid_have_special_driver); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1692 | |
| 1693 | return 1; |
| 1694 | } |
| 1695 | |
| 1696 | static int hid_device_probe(struct device *dev) |
| 1697 | { |
| 1698 | struct hid_driver *hdrv = container_of(dev->driver, |
| 1699 | struct hid_driver, driver); |
| 1700 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 1701 | const struct hid_device_id *id; |
| 1702 | int ret = 0; |
| 1703 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1704 | if (down_interruptible(&hdev->driver_lock)) |
| 1705 | return -EINTR; |
| 1706 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1707 | if (!hdev->driver) { |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 1708 | id = hid_match_device(hdev, hdrv); |
Dan Carpenter | ba623a7 | 2011-08-24 14:27:46 +0300 | [diff] [blame] | 1709 | if (id == NULL) { |
Benjamin Tissoires | 8d179a9 | 2012-03-06 17:57:04 +0100 | [diff] [blame] | 1710 | if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) && |
| 1711 | !strncmp(hdrv->name, "hid-multitouch", 14))) { |
| 1712 | ret = -ENODEV; |
| 1713 | goto unlock; |
| 1714 | } |
Dan Carpenter | ba623a7 | 2011-08-24 14:27:46 +0300 | [diff] [blame] | 1715 | } |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1716 | |
Jiri Slaby | c500c97 | 2008-05-16 11:49:16 +0200 | [diff] [blame] | 1717 | hdev->driver = hdrv; |
| 1718 | if (hdrv->probe) { |
| 1719 | ret = hdrv->probe(hdev, id); |
| 1720 | } else { /* default probe */ |
| 1721 | ret = hid_parse(hdev); |
| 1722 | if (!ret) |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 1723 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1724 | } |
Jiri Slaby | c500c97 | 2008-05-16 11:49:16 +0200 | [diff] [blame] | 1725 | if (ret) |
| 1726 | hdev->driver = NULL; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1727 | } |
Dan Carpenter | ba623a7 | 2011-08-24 14:27:46 +0300 | [diff] [blame] | 1728 | unlock: |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1729 | up(&hdev->driver_lock); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1730 | return ret; |
| 1731 | } |
| 1732 | |
| 1733 | static int hid_device_remove(struct device *dev) |
| 1734 | { |
| 1735 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1736 | struct hid_driver *hdrv; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1737 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1738 | if (down_interruptible(&hdev->driver_lock)) |
| 1739 | return -EINTR; |
| 1740 | |
| 1741 | hdrv = hdev->driver; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1742 | if (hdrv) { |
| 1743 | if (hdrv->remove) |
| 1744 | hdrv->remove(hdev); |
Jiri Slaby | c500c97 | 2008-05-16 11:49:16 +0200 | [diff] [blame] | 1745 | else /* default remove */ |
| 1746 | hid_hw_stop(hdev); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1747 | hdev->driver = NULL; |
| 1748 | } |
| 1749 | |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 1750 | up(&hdev->driver_lock); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 1751 | return 0; |
| 1752 | } |
| 1753 | |
| 1754 | static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 1755 | { |
| 1756 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 1757 | |
| 1758 | if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", |
| 1759 | hdev->bus, hdev->vendor, hdev->product)) |
| 1760 | return -ENOMEM; |
| 1761 | |
| 1762 | if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) |
| 1763 | return -ENOMEM; |
| 1764 | |
| 1765 | if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) |
| 1766 | return -ENOMEM; |
| 1767 | |
| 1768 | if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) |
| 1769 | return -ENOMEM; |
| 1770 | |
| 1771 | if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", |
| 1772 | hdev->bus, hdev->vendor, hdev->product)) |
| 1773 | return -ENOMEM; |
| 1774 | |
| 1775 | return 0; |
| 1776 | } |
| 1777 | |
| 1778 | static struct bus_type hid_bus_type = { |
| 1779 | .name = "hid", |
| 1780 | .match = hid_bus_match, |
| 1781 | .probe = hid_device_probe, |
| 1782 | .remove = hid_device_remove, |
| 1783 | .uevent = hid_uevent, |
| 1784 | }; |
| 1785 | |
Jiri Kosina | bae7eb3 | 2009-01-28 23:06:37 +0100 | [diff] [blame] | 1786 | /* a list of devices that shouldn't be handled by HID core at all */ |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1787 | static const struct hid_device_id hid_ignore_list[] = { |
| 1788 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, |
| 1789 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, |
| 1790 | { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, |
| 1791 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, |
| 1792 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, |
| 1793 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, |
| 1794 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, |
| 1795 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, |
| 1796 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, |
| 1797 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, |
| 1798 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, |
| 1799 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, |
Stephane Chatty | 77f720b | 2010-02-06 15:17:13 +0100 | [diff] [blame] | 1800 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, |
| 1801 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, |
Alexey Klimov | 62a5658 | 2008-11-13 05:44:50 +0300 | [diff] [blame] | 1802 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1803 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, |
| 1804 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, |
| 1805 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, |
| 1806 | { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, |
| 1807 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, |
| 1808 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, |
Alexey Klimov | 5f6108c | 2008-12-08 12:40:14 +0100 | [diff] [blame] | 1809 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1810 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, |
| 1811 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, |
Melchior FRANZ | 73bc7d3 | 2010-12-22 02:04:33 +0100 | [diff] [blame] | 1812 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, |
Dan Delaney | 789aaa2 | 2011-11-20 10:21:30 +0100 | [diff] [blame] | 1813 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x000a) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1814 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, |
Petr Å tetiar | 70c6656 | 2009-12-09 22:09:53 +0100 | [diff] [blame] | 1815 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, |
Petr Å tetiar | df506f2 | 2010-06-28 09:38:54 -0700 | [diff] [blame] | 1816 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, |
Benjamin Tissoires | b180771 | 2011-11-16 11:39:52 +0100 | [diff] [blame] | 1817 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1818 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1819 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, |
| 1820 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, |
| 1821 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, |
| 1822 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, |
| 1823 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, |
| 1824 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, |
| 1825 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, |
| 1826 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, |
| 1827 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, |
| 1828 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, |
| 1829 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, |
| 1830 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, |
| 1831 | { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, |
| 1832 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, |
| 1833 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, |
| 1834 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, |
| 1835 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, |
| 1836 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, |
| 1837 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, |
| 1838 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, |
| 1839 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, |
| 1840 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, |
| 1841 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, |
| 1842 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, |
| 1843 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, |
| 1844 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, |
| 1845 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, |
| 1846 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, |
| 1847 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, |
| 1848 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, |
| 1849 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, |
| 1850 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, |
| 1851 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, |
| 1852 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, |
| 1853 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, |
| 1854 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, |
| 1855 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, |
| 1856 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, |
| 1857 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, |
| 1858 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, |
| 1859 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, |
| 1860 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, |
| 1861 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, |
| 1862 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, |
| 1863 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, |
| 1864 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, |
| 1865 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, |
| 1866 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, |
| 1867 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, |
| 1868 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, |
| 1869 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, |
| 1870 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, |
| 1871 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, |
| 1872 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, |
| 1873 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, |
| 1874 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, |
| 1875 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, |
| 1876 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, |
| 1877 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, |
| 1878 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, |
| 1879 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, |
| 1880 | { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, |
| 1881 | { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, |
Alexey Klimov | c91c21c | 2008-11-13 10:36:11 +0100 | [diff] [blame] | 1882 | { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1883 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, |
Lamarque Vieira Souza | eb8141c | 2009-10-02 15:04:44 +0200 | [diff] [blame] | 1884 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE, 0x0058) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1885 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1886 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY2) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1887 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1888 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY2) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1889 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1890 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY2) }, |
| 1891 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE) }, |
| 1892 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYCURRENT) }, |
| 1893 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) }, |
| 1894 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) }, |
| 1895 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1896 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, |
| 1897 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, |
| 1898 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1899 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIC) }, |
| 1900 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIB) }, |
| 1901 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1902 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, |
| 1903 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1904 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOTOR) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1905 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, |
| 1906 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, |
| 1907 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, |
| 1908 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, |
| 1909 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, |
Michael Hund | ce97cac | 2011-05-03 10:12:00 -0700 | [diff] [blame] | 1910 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER) }, |
| 1911 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER2) }, |
| 1912 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_ABSESP) }, |
| 1913 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_AUTODATABUS) }, |
| 1914 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, |
| 1915 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
| 1916 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1917 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
| 1918 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1919 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
| 1920 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, |
| 1921 | { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, |
| 1922 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, |
| 1923 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, |
| 1924 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, |
| 1925 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, |
| 1926 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, |
| 1927 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, |
| 1928 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, |
| 1929 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, |
| 1930 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, |
| 1931 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, |
| 1932 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, |
| 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, |
| 1934 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, |
| 1935 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, |
Henning Glawe | 4cfae3e | 2009-08-02 22:18:12 +0200 | [diff] [blame] | 1936 | { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, |
Michael Tokarev | 35cfd1d | 2009-02-01 16:11:04 +0100 | [diff] [blame] | 1937 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, |
Jan Steinhoff | 8491ee1 | 2012-02-03 00:21:31 -0800 | [diff] [blame] | 1938 | #if defined(CONFIG_MOUSE_SYNAPTICS_USB) || defined(CONFIG_MOUSE_SYNAPTICS_USB_MODULE) |
| 1939 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, |
| 1940 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) }, |
| 1941 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_CPAD) }, |
| 1942 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_STICK) }, |
| 1943 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WP) }, |
| 1944 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_COMP_TP) }, |
| 1945 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WTP) }, |
| 1946 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, |
| 1947 | #endif |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 1948 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, |
| 1949 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, |
| 1950 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
| 1951 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, |
| 1952 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, |
| 1953 | { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) }, |
| 1954 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, |
| 1955 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, |
| 1956 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, |
| 1957 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, |
| 1958 | { } |
| 1959 | }; |
| 1960 | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 1961 | /** |
| 1962 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer |
| 1963 | * |
| 1964 | * There are composite devices for which we want to ignore only a certain |
| 1965 | * interface. This is a list of devices for which only the mouse interface will |
| 1966 | * be ignored. This allows a dedicated driver to take care of the interface. |
| 1967 | */ |
| 1968 | static const struct hid_device_id hid_mouse_ignore_list[] = { |
| 1969 | /* appletouch driver */ |
| 1970 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
| 1971 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
| 1972 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
| 1973 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, |
| 1974 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, |
| 1975 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, |
| 1976 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, |
| 1977 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, |
| 1978 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, |
| 1979 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, |
| 1980 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, |
| 1981 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
| 1982 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
| 1983 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
| 1984 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, |
| 1985 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, |
| 1986 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, |
| 1987 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, |
| 1988 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, |
| 1989 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, |
Jiri Kosina | ac26fca | 2008-11-20 11:27:02 +0100 | [diff] [blame] | 1990 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, |
| 1991 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, |
| 1992 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 1993 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, |
| 1994 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, |
| 1995 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, |
| 1996 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, |
| 1997 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, |
| 1998 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, |
Andy Botting | 47340bd | 2011-03-12 20:27:22 -0800 | [diff] [blame] | 1999 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, |
| 2000 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, |
| 2001 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, |
Gökçen Eraslan | 213f9da | 2011-10-22 22:39:06 +0300 | [diff] [blame] | 2002 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, |
| 2003 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, |
| 2004 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, |
Jiri Kosina | 4b08691 | 2011-10-04 14:01:12 +0200 | [diff] [blame] | 2005 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, |
| 2006 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, |
| 2007 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, |
| 2008 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
| 2009 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
| 2010 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 2011 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
| 2012 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
| 2013 | { } |
| 2014 | }; |
| 2015 | |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2016 | static bool hid_ignore(struct hid_device *hdev) |
| 2017 | { |
| 2018 | switch (hdev->vendor) { |
| 2019 | case USB_VENDOR_ID_CODEMERCS: |
| 2020 | /* ignore all Code Mercenaries IOWarrior devices */ |
| 2021 | if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && |
| 2022 | hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) |
| 2023 | return true; |
| 2024 | break; |
| 2025 | case USB_VENDOR_ID_LOGITECH: |
| 2026 | if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && |
| 2027 | hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) |
| 2028 | return true; |
Hans Verkuil | 65dd3b6 | 2012-01-13 11:15:22 -0300 | [diff] [blame] | 2029 | /* |
| 2030 | * The Keene FM transmitter USB device has the same USB ID as |
| 2031 | * the Logitech AudioHub Speaker, but it should ignore the hid. |
| 2032 | * Check if the name is that of the Keene device. |
| 2033 | * For reference: the name of the AudioHub is |
| 2034 | * "HOLTEK AudioHub Speaker". |
| 2035 | */ |
| 2036 | if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB && |
| 2037 | !strcmp(hdev->name, "HOLTEK B-LINK USB Audio ")) |
| 2038 | return true; |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2039 | break; |
Jarod Wilson | 31f7fd7 | 2009-07-31 10:56:36 -0400 | [diff] [blame] | 2040 | case USB_VENDOR_ID_SOUNDGRAPH: |
| 2041 | if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && |
| 2042 | hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) |
| 2043 | return true; |
| 2044 | break; |
Xing Wei | bba5394 | 2010-09-01 23:25:35 -0700 | [diff] [blame] | 2045 | case USB_VENDOR_ID_HANWANG: |
| 2046 | if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && |
| 2047 | hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) |
| 2048 | return true; |
| 2049 | break; |
Tomoki Sekiyama | 6dc1418 | 2011-05-23 15:45:44 -0700 | [diff] [blame] | 2050 | case USB_VENDOR_ID_JESS: |
| 2051 | if (hdev->product == USB_DEVICE_ID_JESS_YUREX && |
| 2052 | hdev->type == HID_TYPE_USBNONE) |
| 2053 | return true; |
| 2054 | break; |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2055 | } |
| 2056 | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 2057 | if (hdev->type == HID_TYPE_USBMOUSE && |
| 2058 | hid_match_id(hdev, hid_mouse_ignore_list)) |
| 2059 | return true; |
| 2060 | |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2061 | return !!hid_match_id(hdev, hid_ignore_list); |
| 2062 | } |
| 2063 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2064 | int hid_add_device(struct hid_device *hdev) |
| 2065 | { |
| 2066 | static atomic_t id = ATOMIC_INIT(0); |
| 2067 | int ret; |
| 2068 | |
| 2069 | if (WARN_ON(hdev->status & HID_STAT_ADDED)) |
| 2070 | return -EBUSY; |
| 2071 | |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2072 | /* we need to kill them here, otherwise they will stay allocated to |
| 2073 | * wait for coming driver */ |
Jindrich Makovicka | e5a2a04 | 2010-06-03 12:50:42 +0200 | [diff] [blame] | 2074 | if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) |
| 2075 | && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE))) |
Jiri Slaby | d458a9d | 2008-05-16 11:49:20 +0200 | [diff] [blame] | 2076 | return -ENODEV; |
| 2077 | |
Kay Sievers | 6bbe586 | 2008-10-31 00:12:32 +0100 | [diff] [blame] | 2078 | /* XXX hack, any other cleaner solution after the driver core |
| 2079 | * is converted to allow more than 20 bytes as the device name? */ |
| 2080 | dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, |
| 2081 | hdev->vendor, hdev->product, atomic_inc_return(&id)); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2082 | |
Bruno Prémont | 4da361b | 2010-03-15 14:55:40 +0100 | [diff] [blame] | 2083 | hid_debug_register(hdev, dev_name(&hdev->dev)); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2084 | ret = device_add(&hdev->dev); |
| 2085 | if (!ret) |
| 2086 | hdev->status |= HID_STAT_ADDED; |
Bruno Prémont | 4da361b | 2010-03-15 14:55:40 +0100 | [diff] [blame] | 2087 | else |
| 2088 | hid_debug_unregister(hdev); |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2089 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2090 | return ret; |
| 2091 | } |
| 2092 | EXPORT_SYMBOL_GPL(hid_add_device); |
| 2093 | |
| 2094 | /** |
| 2095 | * hid_allocate_device - allocate new hid device descriptor |
| 2096 | * |
| 2097 | * Allocate and initialize hid device, so that hid_destroy_device might be |
| 2098 | * used to free it. |
| 2099 | * |
| 2100 | * New hid_device pointer is returned on success, otherwise ERR_PTR encoded |
| 2101 | * error value. |
| 2102 | */ |
| 2103 | struct hid_device *hid_allocate_device(void) |
| 2104 | { |
| 2105 | struct hid_device *hdev; |
| 2106 | unsigned int i; |
| 2107 | int ret = -ENOMEM; |
| 2108 | |
| 2109 | hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); |
| 2110 | if (hdev == NULL) |
| 2111 | return ERR_PTR(ret); |
| 2112 | |
| 2113 | device_initialize(&hdev->dev); |
| 2114 | hdev->dev.release = hid_device_release; |
| 2115 | hdev->dev.bus = &hid_bus_type; |
| 2116 | |
| 2117 | hdev->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, |
| 2118 | sizeof(struct hid_collection), GFP_KERNEL); |
| 2119 | if (hdev->collection == NULL) |
| 2120 | goto err; |
| 2121 | hdev->collection_size = HID_DEFAULT_NUM_COLLECTIONS; |
| 2122 | |
| 2123 | for (i = 0; i < HID_REPORT_TYPES; i++) |
| 2124 | INIT_LIST_HEAD(&hdev->report_enum[i].report_list); |
| 2125 | |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 2126 | init_waitqueue_head(&hdev->debug_wait); |
| 2127 | INIT_LIST_HEAD(&hdev->debug_list); |
David Herrmann | 4ea5454 | 2011-08-10 14:02:07 +0200 | [diff] [blame] | 2128 | sema_init(&hdev->driver_lock, 1); |
Jiri Kosina | cd667ce | 2009-06-12 15:20:57 +0200 | [diff] [blame] | 2129 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2130 | return hdev; |
| 2131 | err: |
| 2132 | put_device(&hdev->dev); |
| 2133 | return ERR_PTR(ret); |
| 2134 | } |
| 2135 | EXPORT_SYMBOL_GPL(hid_allocate_device); |
| 2136 | |
| 2137 | static void hid_remove_device(struct hid_device *hdev) |
| 2138 | { |
| 2139 | if (hdev->status & HID_STAT_ADDED) { |
| 2140 | device_del(&hdev->dev); |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2141 | hid_debug_unregister(hdev); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2142 | hdev->status &= ~HID_STAT_ADDED; |
| 2143 | } |
| 2144 | } |
| 2145 | |
| 2146 | /** |
| 2147 | * hid_destroy_device - free previously allocated device |
| 2148 | * |
| 2149 | * @hdev: hid device |
| 2150 | * |
| 2151 | * If you allocate hid_device through hid_allocate_device, you should ever |
| 2152 | * free by this function. |
| 2153 | */ |
| 2154 | void hid_destroy_device(struct hid_device *hdev) |
| 2155 | { |
| 2156 | hid_remove_device(hdev); |
| 2157 | put_device(&hdev->dev); |
| 2158 | } |
| 2159 | EXPORT_SYMBOL_GPL(hid_destroy_device); |
| 2160 | |
| 2161 | int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, |
| 2162 | const char *mod_name) |
| 2163 | { |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 2164 | int ret; |
| 2165 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2166 | hdrv->driver.name = hdrv->name; |
| 2167 | hdrv->driver.bus = &hid_bus_type; |
| 2168 | hdrv->driver.owner = owner; |
| 2169 | hdrv->driver.mod_name = mod_name; |
| 2170 | |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 2171 | INIT_LIST_HEAD(&hdrv->dyn_list); |
| 2172 | spin_lock_init(&hdrv->dyn_lock); |
| 2173 | |
| 2174 | ret = driver_register(&hdrv->driver); |
| 2175 | if (ret) |
| 2176 | return ret; |
| 2177 | |
| 2178 | ret = driver_create_file(&hdrv->driver, &driver_attr_new_id); |
| 2179 | if (ret) |
| 2180 | driver_unregister(&hdrv->driver); |
| 2181 | |
| 2182 | return ret; |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2183 | } |
| 2184 | EXPORT_SYMBOL_GPL(__hid_register_driver); |
| 2185 | |
| 2186 | void hid_unregister_driver(struct hid_driver *hdrv) |
| 2187 | { |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 2188 | driver_remove_file(&hdrv->driver, &driver_attr_new_id); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2189 | driver_unregister(&hdrv->driver); |
Jiri Slaby | 3a6f82f | 2008-11-24 16:20:09 +0100 | [diff] [blame] | 2190 | hid_free_dynids(hdrv); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2191 | } |
| 2192 | EXPORT_SYMBOL_GPL(hid_unregister_driver); |
| 2193 | |
Oliver Neukum | 0361a28 | 2008-12-17 15:38:03 +0100 | [diff] [blame] | 2194 | int hid_check_keys_pressed(struct hid_device *hid) |
| 2195 | { |
| 2196 | struct hid_input *hidinput; |
| 2197 | int i; |
| 2198 | |
Jiri Kosina | e5288eb | 2009-05-02 00:02:57 +0200 | [diff] [blame] | 2199 | if (!(hid->claimed & HID_CLAIMED_INPUT)) |
| 2200 | return 0; |
| 2201 | |
Oliver Neukum | 0361a28 | 2008-12-17 15:38:03 +0100 | [diff] [blame] | 2202 | list_for_each_entry(hidinput, &hid->inputs, list) { |
| 2203 | for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) |
| 2204 | if (hidinput->input->key[i]) |
| 2205 | return 1; |
| 2206 | } |
| 2207 | |
| 2208 | return 0; |
| 2209 | } |
| 2210 | |
| 2211 | EXPORT_SYMBOL_GPL(hid_check_keys_pressed); |
| 2212 | |
Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 2213 | static int __init hid_init(void) |
| 2214 | { |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2215 | int ret; |
| 2216 | |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2217 | if (hid_debug) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 2218 | pr_warn("hid_debug is now used solely for parser and driver debugging.\n" |
| 2219 | "debugfs is now used for inspecting the device (report descriptor, reports)\n"); |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2220 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2221 | ret = bus_register(&hid_bus_type); |
| 2222 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 2223 | pr_err("can't register hid bus\n"); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2224 | goto err; |
| 2225 | } |
| 2226 | |
| 2227 | ret = hidraw_init(); |
| 2228 | if (ret) |
| 2229 | goto err_bus; |
| 2230 | |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2231 | hid_debug_init(); |
| 2232 | |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2233 | return 0; |
| 2234 | err_bus: |
| 2235 | bus_unregister(&hid_bus_type); |
| 2236 | err: |
| 2237 | return ret; |
Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 2238 | } |
| 2239 | |
| 2240 | static void __exit hid_exit(void) |
| 2241 | { |
Jiri Kosina | a635f9d | 2009-06-12 15:20:55 +0200 | [diff] [blame] | 2242 | hid_debug_exit(); |
Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 2243 | hidraw_exit(); |
Jiri Slaby | 85cdaf5 | 2008-05-16 11:49:15 +0200 | [diff] [blame] | 2244 | bus_unregister(&hid_bus_type); |
Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 2245 | } |
| 2246 | |
| 2247 | module_init(hid_init); |
| 2248 | module_exit(hid_exit); |
| 2249 | |
Jiri Kosina | 88adb72 | 2009-10-02 18:29:34 +0200 | [diff] [blame] | 2250 | MODULE_AUTHOR("Andreas Gal"); |
| 2251 | MODULE_AUTHOR("Vojtech Pavlik"); |
| 2252 | MODULE_AUTHOR("Jiri Kosina"); |
Jiri Kosina | aa938f7 | 2006-12-08 18:41:10 +0100 | [diff] [blame] | 2253 | MODULE_LICENSE(DRIVER_LICENSE); |
| 2254 | |