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