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