2 * HID support for Linux
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
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)
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
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>
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>
34 #include <linux/hid.h>
35 #include <linux/hiddev.h>
36 #include <linux/hid-debug.h>
37 #include <linux/hidraw.h>
45 #define DRIVER_DESC "HID core driver"
46 #define DRIVER_LICENSE "GPL"
49 module_param_named(debug
, hid_debug
, int, 0600);
50 MODULE_PARM_DESC(debug
, "toggle HID debugging messages");
51 EXPORT_SYMBOL_GPL(hid_debug
);
53 static int hid_ignore_special_drivers
= 0;
54 module_param_named(ignore_special_drivers
, hid_ignore_special_drivers
, int, 0600);
55 MODULE_PARM_DESC(debug
, "Ignore any special drivers and handle all devices by generic driver");
58 * Register a new report for a device.
61 struct hid_report
*hid_register_report(struct hid_device
*device
, unsigned type
, unsigned id
)
63 struct hid_report_enum
*report_enum
= device
->report_enum
+ type
;
64 struct hid_report
*report
;
66 if (report_enum
->report_id_hash
[id
])
67 return report_enum
->report_id_hash
[id
];
69 report
= kzalloc(sizeof(struct hid_report
), GFP_KERNEL
);
74 report_enum
->numbered
= 1;
79 report
->device
= device
;
80 report_enum
->report_id_hash
[id
] = report
;
82 list_add_tail(&report
->list
, &report_enum
->report_list
);
86 EXPORT_SYMBOL_GPL(hid_register_report
);
89 * Register a new field for this report.
92 static struct hid_field
*hid_register_field(struct hid_report
*report
, unsigned usages
, unsigned values
)
94 struct hid_field
*field
;
96 if (report
->maxfield
== HID_MAX_FIELDS
) {
97 hid_err(report
->device
, "too many fields in report\n");
101 field
= kzalloc((sizeof(struct hid_field
) +
102 usages
* sizeof(struct hid_usage
) +
103 values
* sizeof(unsigned)), GFP_KERNEL
);
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
;
117 * Open a collection. The type/usage is pushed on the stack.
120 static int open_collection(struct hid_parser
*parser
, unsigned type
)
122 struct hid_collection
*collection
;
125 usage
= parser
->local
.usage
[0];
127 if (parser
->collection_stack_ptr
== HID_COLLECTION_STACK_SIZE
) {
128 hid_err(parser
->device
, "collection stack overflow\n");
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");
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;
150 parser
->collection_stack
[parser
->collection_stack_ptr
++] =
151 parser
->device
->maxcollection
;
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;
159 if (type
== HID_COLLECTION_APPLICATION
)
160 parser
->device
->maxapplication
++;
166 * Close a collection.
169 static int close_collection(struct hid_parser
*parser
)
171 if (!parser
->collection_stack_ptr
) {
172 hid_err(parser
->device
, "collection stack underflow\n");
175 parser
->collection_stack_ptr
--;
180 * Climb up the stack, search for the specified collection type
181 * and return the usage.
184 static unsigned hid_lookup_collection(struct hid_parser
*parser
, unsigned type
)
186 struct hid_collection
*collection
= parser
->device
->collection
;
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
;
194 return 0; /* we know nothing about this usage type */
198 * Add a usage to the temporary parser table.
201 static int hid_add_usage(struct hid_parser
*parser
, unsigned usage
)
203 if (parser
->local
.usage_index
>= HID_MAX_USAGES
) {
204 hid_err(parser
->device
, "usage index exceeded\n");
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
++;
216 * Register a new field for this report.
219 static int hid_add_field(struct hid_parser
*parser
, unsigned report_type
, unsigned flags
)
221 struct hid_report
*report
;
222 struct hid_field
*field
;
227 report
= hid_register_report(parser
->device
, report_type
, parser
->global
.report_id
);
229 hid_err(parser
->device
, "hid_register_report failed\n");
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
);
239 offset
= report
->size
;
240 report
->size
+= parser
->global
.report_size
* parser
->global
.report_count
;
242 if (!parser
->local
.usage_index
) /* Ignore padding fields */
245 usages
= max_t(int, parser
->local
.usage_index
, parser
->global
.report_count
);
247 field
= hid_register_field(report
, usages
, parser
->global
.report_count
);
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
);
255 for (i
= 0; i
< usages
; 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
];
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
;
282 * Read data value from item.
285 static u32
item_udata(struct hid_item
*item
)
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
;
295 static s32
item_sdata(struct hid_item
*item
)
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
;
306 * Process a global item.
309 static int hid_parser_global(struct hid_parser
*parser
, struct hid_item
*item
)
312 case HID_GLOBAL_ITEM_TAG_PUSH
:
314 if (parser
->global_stack_ptr
== HID_GLOBAL_STACK_SIZE
) {
315 hid_err(parser
->device
, "global environment stack overflow\n");
319 memcpy(parser
->global_stack
+ parser
->global_stack_ptr
++,
320 &parser
->global
, sizeof(struct hid_global
));
323 case HID_GLOBAL_ITEM_TAG_POP
:
325 if (!parser
->global_stack_ptr
) {
326 hid_err(parser
->device
, "global environment stack underflow\n");
330 memcpy(&parser
->global
, parser
->global_stack
+
331 --parser
->global_stack_ptr
, sizeof(struct hid_global
));
334 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE
:
335 parser
->global
.usage_page
= item_udata(item
);
338 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM
:
339 parser
->global
.logical_minimum
= item_sdata(item
);
342 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM
:
343 if (parser
->global
.logical_minimum
< 0)
344 parser
->global
.logical_maximum
= item_sdata(item
);
346 parser
->global
.logical_maximum
= item_udata(item
);
349 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM
:
350 parser
->global
.physical_minimum
= item_sdata(item
);
353 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM
:
354 if (parser
->global
.physical_minimum
< 0)
355 parser
->global
.physical_maximum
= item_sdata(item
);
357 parser
->global
.physical_maximum
= item_udata(item
);
360 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT
:
361 parser
->global
.unit_exponent
= item_sdata(item
);
364 case HID_GLOBAL_ITEM_TAG_UNIT
:
365 parser
->global
.unit
= item_udata(item
);
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
);
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
);
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");
395 hid_err(parser
->device
, "unknown global tag 0x%x\n", item
->tag
);
401 * Process a local item.
404 static int hid_parser_local(struct hid_parser
*parser
, struct hid_item
*item
)
409 data
= item_udata(item
);
412 case HID_LOCAL_ITEM_TAG_DELIMITER
:
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.
421 if (parser
->local
.delimiter_depth
!= 0) {
422 hid_err(parser
->device
, "nested delimiters\n");
425 parser
->local
.delimiter_depth
++;
426 parser
->local
.delimiter_branch
++;
428 if (parser
->local
.delimiter_depth
< 1) {
429 hid_err(parser
->device
, "bogus close delimiter\n");
432 parser
->local
.delimiter_depth
--;
436 case HID_LOCAL_ITEM_TAG_USAGE
:
438 if (parser
->local
.delimiter_branch
> 1) {
439 dbg_hid("alternative usage ignored\n");
444 data
= (parser
->global
.usage_page
<< 16) + data
;
446 return hid_add_usage(parser
, data
);
448 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM
:
450 if (parser
->local
.delimiter_branch
> 1) {
451 dbg_hid("alternative usage ignored\n");
456 data
= (parser
->global
.usage_page
<< 16) + data
;
458 parser
->local
.usage_minimum
= data
;
461 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM
:
463 if (parser
->local
.delimiter_branch
> 1) {
464 dbg_hid("alternative usage ignored\n");
469 data
= (parser
->global
.usage_page
<< 16) + data
;
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");
480 dbg_hid("unknown local item tag 0x%x\n", item
->tag
);
487 * Process a main item.
490 static int hid_parser_main(struct hid_parser
*parser
, struct hid_item
*item
)
495 data
= item_udata(item
);
498 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION
:
499 ret
= open_collection(parser
, data
& 0xff);
501 case HID_MAIN_ITEM_TAG_END_COLLECTION
:
502 ret
= close_collection(parser
);
504 case HID_MAIN_ITEM_TAG_INPUT
:
505 ret
= hid_add_field(parser
, HID_INPUT_REPORT
, data
);
507 case HID_MAIN_ITEM_TAG_OUTPUT
:
508 ret
= hid_add_field(parser
, HID_OUTPUT_REPORT
, data
);
510 case HID_MAIN_ITEM_TAG_FEATURE
:
511 ret
= hid_add_field(parser
, HID_FEATURE_REPORT
, data
);
514 hid_err(parser
->device
, "unknown main item tag 0x%x\n", item
->tag
);
518 memset(&parser
->local
, 0, sizeof(parser
->local
)); /* Reset the local parser environment */
524 * Process a reserved item.
527 static int hid_parser_reserved(struct hid_parser
*parser
, struct hid_item
*item
)
529 dbg_hid("reserved item type, tag 0x%x\n", item
->tag
);
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.
539 static void hid_free_report(struct hid_report
*report
)
543 for (n
= 0; n
< report
->maxfield
; n
++)
544 kfree(report
->field
[n
]);
549 * Free a device structure, all reports, and all fields.
552 static void hid_device_release(struct device
*dev
)
554 struct hid_device
*device
= container_of(dev
, struct hid_device
, dev
);
557 for (i
= 0; i
< HID_REPORT_TYPES
; i
++) {
558 struct hid_report_enum
*report_enum
= device
->report_enum
+ i
;
560 for (j
= 0; j
< 256; j
++) {
561 struct hid_report
*report
= report_enum
->report_id_hash
[j
];
563 hid_free_report(report
);
567 kfree(device
->rdesc
);
568 kfree(device
->collection
);
573 * Fetch a report description item from the data stream. We support long
574 * items, though they are not used yet.
577 static u8
*fetch_item(__u8
*start
, __u8
*end
, struct hid_item
*item
)
581 if ((end
- start
) <= 0)
586 item
->type
= (b
>> 2) & 3;
587 item
->tag
= (b
>> 4) & 15;
589 if (item
->tag
== HID_ITEM_TAG_LONG
) {
591 item
->format
= HID_ITEM_FORMAT_LONG
;
593 if ((end
- start
) < 2)
596 item
->size
= *start
++;
597 item
->tag
= *start
++;
599 if ((end
- start
) < item
->size
)
602 item
->data
.longdata
= start
;
607 item
->format
= HID_ITEM_FORMAT_SHORT
;
610 switch (item
->size
) {
615 if ((end
- start
) < 1)
617 item
->data
.u8
= *start
++;
621 if ((end
- start
) < 2)
623 item
->data
.u16
= get_unaligned_le16(start
);
624 start
= (__u8
*)((__le16
*)start
+ 1);
629 if ((end
- start
) < 4)
631 item
->data
.u32
= get_unaligned_le32(start
);
632 start
= (__u8
*)((__le32
*)start
+ 1);
640 * hid_parse_report - parse device report
642 * @device: hid device
643 * @start: report start
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.
650 int hid_parse_report(struct hid_device
*device
, __u8
*start
,
653 struct hid_parser
*parser
;
654 struct hid_item item
;
657 static int (*dispatch_type
[])(struct hid_parser
*parser
,
658 struct hid_item
*item
) = {
665 if (device
->driver
->report_fixup
)
666 start
= device
->driver
->report_fixup(device
, start
, &size
);
668 device
->rdesc
= kmemdup(start
, size
, GFP_KERNEL
);
669 if (device
->rdesc
== NULL
)
671 device
->rsize
= size
;
673 parser
= vzalloc(sizeof(struct hid_parser
));
679 parser
->device
= device
;
683 while ((start
= fetch_item(start
, end
, &item
)) != NULL
) {
685 if (item
.format
!= HID_ITEM_FORMAT_SHORT
) {
686 hid_err(device
, "unexpected long global item\n");
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
);
698 if (parser
->collection_stack_ptr
) {
699 hid_err(device
, "unbalanced collection at end of report description\n");
702 if (parser
->local
.delimiter_depth
) {
703 hid_err(device
, "unbalanced delimiter at end of report description\n");
711 hid_err(device
, "item fetching failed at offset %d\n", (int)(end
- start
));
716 EXPORT_SYMBOL_GPL(hid_parse_report
);
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
724 static s32
snto32(__u32 value
, unsigned n
)
727 case 8: return ((__s8
)value
);
728 case 16: return ((__s16
)value
);
729 case 32: return ((__s32
)value
);
731 return value
& (1 << (n
- 1)) ? value
| (-1 << n
) : value
;
735 * Convert a signed 32-bit integer to a signed n-bit integer.
738 static u32
s32ton(__s32 value
, unsigned n
)
740 s32 a
= value
>> (n
- 1);
742 return value
< 0 ? 1 << (n
- 1) : (1 << (n
- 1)) - 1;
743 return value
& ((1 << n
) - 1);
747 * Extract/implement a data field from/to a little endian report (bit array).
749 * Code sort-of follows HID spec:
750 * http://www.usb.org/developers/devclass_docs/HID1_11.pdf
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".
758 static __u32
extract(const struct hid_device
*hid
, __u8
*report
,
759 unsigned offset
, unsigned n
)
764 hid_warn(hid
, "extract() called with n (%d) > 32! (%s)\n",
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 */
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.
782 static void implement(const struct hid_device
*hid
, __u8
*report
,
783 unsigned offset
, unsigned n
, __u32 value
)
786 u64 m
= (1ULL << n
) - 1;
789 hid_warn(hid
, "%s() called with n (%d) > 32! (%s)\n",
790 __func__
, n
, current
->comm
);
793 hid_warn(hid
, "%s() called with too large value %d! (%s)\n",
794 __func__
, value
, current
->comm
);
798 report
+= offset
>> 3;
801 x
= get_unaligned_le64(report
);
803 x
|= ((u64
)value
) << offset
;
804 put_unaligned_le64(x
, report
);
808 * Search an array for a value.
811 static int search(__s32
*array
, __s32 value
, unsigned n
)
814 if (*array
++ == value
)
821 * hid_match_report - check if driver's raw_event should be called
824 * @report_type: type to match against
826 * compare hid->driver->report_table->report_type to report->type
828 static int hid_match_report(struct hid_device
*hid
, struct hid_report
*report
)
830 const struct hid_report_id
*id
= hid
->driver
->report_table
;
832 if (!id
) /* NULL means all */
835 for (; id
->report_type
!= HID_TERMINATOR
; id
++)
836 if (id
->report_type
== HID_ANY_ID
||
837 id
->report_type
== report
->type
)
843 * hid_match_usage - check if driver's event should be called
846 * @usage: usage to match against
848 * compare hid->driver->usage_table->usage_{type,code} to
849 * usage->usage_{type,code}
851 static int hid_match_usage(struct hid_device
*hid
, struct hid_usage
*usage
)
853 const struct hid_usage_id
*id
= hid
->driver
->usage_table
;
855 if (!id
) /* NULL means all */
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
))
869 static void hid_process_event(struct hid_device
*hid
, struct hid_field
*field
,
870 struct hid_usage
*usage
, __s32 value
, int interrupt
)
872 struct hid_driver
*hdrv
= hid
->driver
;
875 hid_dump_input(hid
, usage
, value
);
877 if (hdrv
&& hdrv
->event
&& hid_match_usage(hid
, usage
)) {
878 ret
= hdrv
->event(hid
, field
, usage
, value
);
881 hid_err(hid
, "%s's event failed with %d\n",
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
);
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).
899 static void hid_input_field(struct hid_device
*hid
, struct hid_field
*field
,
900 __u8
*data
, int interrupt
)
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
;
910 value
= kmalloc(sizeof(__s32
) * count
, GFP_ATOMIC
);
914 for (n
= 0; n
< count
; n
++) {
917 snto32(extract(hid
, data
, offset
+ n
* size
, size
),
919 extract(hid
, data
, offset
+ n
* size
, size
);
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)
928 for (n
= 0; n
< count
; n
++) {
930 if (HID_MAIN_ITEM_VARIABLE
& field
->flags
) {
931 hid_process_event(hid
, field
, &field
->usage
[n
], value
[n
], interrupt
);
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
);
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
);
946 memcpy(field
->value
, value
, count
* sizeof(__s32
));
952 * Output the field into the report.
955 static void hid_output_field(const struct hid_device
*hid
,
956 struct hid_field
*field
, __u8
*data
)
958 unsigned count
= field
->report_count
;
959 unsigned offset
= field
->report_offset
;
960 unsigned size
= field
->report_size
;
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
,
977 void hid_output_report(struct hid_report
*report
, __u8
*data
)
982 *data
++ = report
->id
;
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
);
988 EXPORT_SYMBOL_GPL(hid_output_report
);
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
996 int hid_set_field(struct hid_field
*field
, unsigned offset
, __s32 value
)
998 unsigned size
= field
->report_size
;
1000 hid_dump_input(field
->report
->device
, field
->usage
+ offset
, value
);
1002 if (offset
>= field
->report_count
) {
1003 hid_err(field
->report
->device
, "offset (%d) exceeds report_count (%d)\n",
1004 offset
, field
->report_count
);
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
);
1013 field
->value
[offset
] = value
;
1016 EXPORT_SYMBOL_GPL(hid_set_field
);
1018 static struct hid_report
*hid_get_report(struct hid_report_enum
*report_enum
,
1021 struct hid_report
*report
;
1022 unsigned int n
= 0; /* Normally report number is 0 */
1024 /* Device uses numbered reports, data[0] is report number */
1025 if (report_enum
->numbered
)
1028 report
= report_enum
->report_id_hash
[n
];
1030 dbg_hid("undefined report_id %u received\n", n
);
1035 void hid_report_raw_event(struct hid_device
*hid
, int type
, u8
*data
, int size
,
1038 struct hid_report_enum
*report_enum
= hid
->report_enum
+ type
;
1039 struct hid_report
*report
;
1041 int rsize
, csize
= size
;
1044 report
= hid_get_report(report_enum
, data
);
1048 if (report_enum
->numbered
) {
1053 rsize
= ((report
->size
- 1) >> 3) + 1;
1055 if (rsize
> HID_MAX_BUFFER_SIZE
)
1056 rsize
= HID_MAX_BUFFER_SIZE
;
1058 if (csize
< rsize
) {
1059 dbg_hid("report %d is too short, (%d < %d)\n", report
->id
,
1061 memset(cdata
+ csize
, 0, rsize
- csize
);
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
);
1069 for (a
= 0; a
< report
->maxfield
; a
++)
1070 hid_input_field(hid
, report
->field
[a
], cdata
, interrupt
);
1072 if (hid
->claimed
& HID_CLAIMED_INPUT
)
1073 hidinput_report_event(hid
, report
);
1075 EXPORT_SYMBOL_GPL(hid_report_raw_event
);
1078 * hid_input_report - report data from lower layer (usb, bt...)
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
1086 * This is data entry for lower layers.
1088 int hid_input_report(struct hid_device
*hid
, int type
, u8
*data
, int size
, int interrupt
)
1090 struct hid_report_enum
*report_enum
;
1091 struct hid_driver
*hdrv
;
1092 struct hid_report
*report
;
1100 if (down_trylock(&hid
->driver_lock
))
1107 report_enum
= hid
->report_enum
+ type
;
1111 dbg_hid("empty report\n");
1116 buf
= kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE
, GFP_ATOMIC
);
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
);
1126 for (i
= 0; i
< size
; i
++) {
1127 snprintf(buf
, HID_DEBUG_BUFSIZE
- 1,
1129 hid_debug_event(hid
, buf
);
1131 hid_debug_event(hid
, "\n");
1135 report
= hid_get_report(report_enum
, data
);
1142 if (hdrv
&& hdrv
->raw_event
&& hid_match_report(hid
, report
)) {
1143 ret
= hdrv
->raw_event(hid
, report
, data
, size
);
1145 ret
= ret
< 0 ? ret
: 0;
1150 hid_report_raw_event(hid
, type
, data
, size
, interrupt
);
1153 up(&hid
->driver_lock
);
1156 EXPORT_SYMBOL_GPL(hid_input_report
);
1158 static bool hid_match_one_id(struct hid_device
*hdev
,
1159 const struct hid_device_id
*id
)
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
);
1166 const struct hid_device_id
*hid_match_id(struct hid_device
*hdev
,
1167 const struct hid_device_id
*id
)
1169 for (; id
->bus
; id
++)
1170 if (hid_match_one_id(hdev
, id
))
1176 static 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
) },
1182 static bool hid_hiddev(struct hid_device
*hdev
)
1184 return !!hid_match_id(hdev
, hid_hiddev_list
);
1189 read_report_descriptor(struct file
*filp
, struct kobject
*kobj
,
1190 struct bin_attribute
*attr
,
1191 char *buf
, loff_t off
, size_t count
)
1193 struct device
*dev
= container_of(kobj
, struct device
, kobj
);
1194 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1196 if (off
>= hdev
->rsize
)
1199 if (off
+ count
> hdev
->rsize
)
1200 count
= hdev
->rsize
- off
;
1202 memcpy(buf
, hdev
->rdesc
+ off
, count
);
1207 static struct bin_attribute dev_bin_attr_report_desc
= {
1208 .attr
= { .name
= "report_descriptor", .mode
= 0444 },
1209 .read
= read_report_descriptor
,
1210 .size
= HID_MAX_DESCRIPTOR_SIZE
,
1213 int hid_connect(struct hid_device
*hdev
, unsigned int connect_mask
)
1215 static const char *types
[] = { "Device", "Pointer", "Mouse", "Device",
1216 "Joystick", "Gamepad", "Keyboard", "Keypad",
1217 "Multi-Axis Controller"
1219 const char *type
, *bus
;
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
;
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 */
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
;
1249 if (!hdev
->claimed
) {
1250 hid_err(hdev
, "claimed by neither input, hiddev nor hidraw\n");
1254 if ((hdev
->claimed
& HID_CLAIMED_INPUT
) &&
1255 (connect_mask
& HID_CONNECT_FF
) && hdev
->ff_init
)
1256 hdev
->ff_init(hdev
);
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
? "," : "",
1264 if (hdev
->claimed
& HID_CLAIMED_HIDRAW
)
1265 len
+= sprintf(buf
+ len
, "%shidraw%d", len
? "," : "",
1266 ((struct hidraw
*)hdev
->hidraw
)->minor
);
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];
1279 switch (hdev
->bus
) {
1290 ret
= device_create_bin_file(&hdev
->dev
, &dev_bin_attr_report_desc
);
1293 "can't create sysfs report descriptor attribute err: %d\n", ret
);
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
);
1301 EXPORT_SYMBOL_GPL(hid_connect
);
1303 void hid_disconnect(struct hid_device
*hdev
)
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
);
1313 EXPORT_SYMBOL_GPL(hid_disconnect
);
1315 /* a list of devices for which there is a specialized driver on HID bus */
1316 static 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_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI
) },
1383 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO
) },
1384 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS
) },
1385 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI
) },
1386 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO
) },
1387 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS
) },
1388 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI
) },
1389 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO
) },
1390 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY
) },
1391 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY
) },
1392 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS
, USB_DEVICE_ID_ASUS_T91MT
) },
1393 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS
, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
1394 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN
, USB_DEVICE_ID_FLIP_KVM
) },
1395 { HID_USB_DEVICE(USB_VENDOR_ID_BAANTO
, USB_DEVICE_ID_BAANTO_MT_190W2
), },
1396 { HID_USB_DEVICE(USB_VENDOR_ID_BTC
, USB_DEVICE_ID_BTC_EMPREX_REMOTE
) },
1397 { HID_USB_DEVICE(USB_VENDOR_ID_BTC
, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2
) },
1398 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH
) },
1399 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
1400 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1
) },
1401 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
1402 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
1403 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY
, USB_DEVICE_ID_CHERRY_CYMOTION
) },
1404 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY
, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR
) },
1405 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_CHICONY_TACTICAL_PAD
) },
1406 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_CHICONY_WIRELESS
) },
1407 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_CHICONY_WIRELESS2
) },
1408 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_CHICONY_AK1D
) },
1409 { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT
, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH
) },
1410 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS
, USB_DEVICE_ID_PRODIKEYS_PCMIDI
) },
1411 { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH
, USB_DEVICE_ID_CVTOUCH_SCREEN
) },
1412 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_1
) },
1413 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_2
) },
1414 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_3
) },
1415 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_4
) },
1416 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_MOUSE
) },
1417 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_TRUETOUCH
) },
1418 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE
, 0x0006) },
1419 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE
, 0x0011) },
1420 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D
) },
1421 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E
) },
1422 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C
) },
1423 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224
) },
1424 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E
) },
1425 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B
) },
1426 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1
) },
1427 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302
) },
1428 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001
) },
1429 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM
, USB_DEVICE_ID_ELECOM_BM084
) },
1430 { HID_USB_DEVICE(USB_VENDOR_ID_ELO
, USB_DEVICE_ID_ELO_TS2515
) },
1431 { HID_USB_DEVICE(USB_VENDOR_ID_EMS
, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II
) },
1432 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY
, USB_DEVICE_ID_BTC_8193
) },
1433 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_FRUCTEL
, USB_DEVICE_ID_GAMETEL_MT_MODE
) },
1434 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON
, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR
) },
1435 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON
, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR
) },
1436 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS
) },
1437 { HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH
, USB_DEVICE_ID_GOODTOUCH_000f
) },
1438 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA
, 0x0003) },
1439 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA
, 0x0012) },
1440 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE
) },
1441 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE_2
) },
1442 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE_3
) },
1443 { HID_USB_DEVICE(USB_VENDOR_ID_HANVON
, USB_DEVICE_ID_HANVON_MULTITOUCH
) },
1444 { HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT
, USB_DEVICE_ID_HANVON_ALT_MULTITOUCH
) },
1445 { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM
, USB_DEVICE_ID_IDEACOM_IDC6650
) },
1446 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK
, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP
) },
1447 { HID_USB_DEVICE(USB_VENDOR_ID_ILITEK
, USB_DEVICE_ID_ILITEK_MULTITOUCH
) },
1448 { HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS
, USB_DEVICE_ID_IRTOUCH_INFRARED_USB
) },
1449 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON
, USB_DEVICE_ID_KS_SLIMBLADE
) },
1450 { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH
, USB_DEVICE_ID_KEYTOUCH_IEC
) },
1451 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_ERGO_525V
) },
1452 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_EASYPEN_I405X
) },
1453 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_MOUSEPEN_I608X
) },
1454 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_EASYPEN_M610X
) },
1455 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC
, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD
) },
1456 { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER
, USB_DEVICE_ID_LCPOWER_LC1000
) },
1457 { HID_USB_DEVICE(USB_VENDOR_ID_LG
, USB_DEVICE_ID_LG_MULTITOUCH
) },
1458 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_MX3000_RECEIVER
) },
1459 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_S510_RECEIVER
) },
1460 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_S510_RECEIVER_2
) },
1461 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RECEIVER
) },
1462 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_DESKTOP
) },
1463 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_EDGE
) },
1464 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_MINI
) },
1465 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_ELITE_KBD
) },
1466 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500
) },
1467 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_EXTREME_3D
) },
1468 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WHEEL
) },
1469 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD
) },
1470 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD
) },
1471 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2
) },
1472 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D
) },
1473 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG
) },
1474 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO
) },
1475 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940
) },
1476 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL
) },
1477 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2
) },
1478 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_DFP_WHEEL
) },
1479 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL
) },
1480 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_G25_WHEEL
) },
1481 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_G27_WHEEL
) },
1482 #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
1483 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER
) },
1484 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2
) },
1486 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WII_WHEEL
) },
1487 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2
) },
1488 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_SPACETRAVELLER
) },
1489 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_SPACENAVIGATOR
) },
1490 { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
, USB_DEVICE_ID_CRYSTALTOUCH
) },
1491 { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO
, USB_DEVICE_ID_CRYSTALTOUCH_DUAL
) },
1492 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICOLCD
) },
1493 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICOLCD_BOOTLOADER
) },
1494 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500
) },
1495 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_SIDEWINDER_GV
) },
1496 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_NE4K
) },
1497 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_LK6K
) },
1498 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_PRESENTER_8K_USB
) },
1499 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K
) },
1500 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0
) },
1501 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY
, USB_DEVICE_ID_GENIUS_KB29E
) },
1502 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN
) },
1503 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1
) },
1504 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2
) },
1505 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3
) },
1506 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4
) },
1507 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5
) },
1508 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6
) },
1509 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7
) },
1510 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8
) },
1511 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9
) },
1512 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10
) },
1513 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11
) },
1514 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12
) },
1515 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13
) },
1516 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14
) },
1517 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15
) },
1518 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16
) },
1519 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17
) },
1520 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18
) },
1521 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK
, USB_DEVICE_ID_ORTEK_PKB1700
) },
1522 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK
, USB_DEVICE_ID_ORTEK_WKB2000
) },
1523 { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC
, USB_DEVICE_ID_PANABOARD_UBT780
) },
1524 { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC
, USB_DEVICE_ID_PANABOARD_UBT880
) },
1525 { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT
, USB_DEVICE_ID_PENMOUNT_PCI
) },
1526 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX
, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE
) },
1527 { HID_USB_DEVICE(USB_VENDOR_ID_PIXART
, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN
) },
1528 { HID_USB_DEVICE(USB_VENDOR_ID_PIXART
, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1
) },
1529 { HID_USB_DEVICE(USB_VENDOR_ID_PIXART
, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2
) },
1530 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX
, USB_DEVICE_ID_PRIMAX_KEYBOARD
) },
1531 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH
) },
1532 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN
) },
1533 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_KONE
) },
1534 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_ARVO
) },
1535 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_ISKU
) },
1536 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_KONEPLUS
) },
1537 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_KOVAPLUS
) },
1538 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_PYRA_WIRED
) },
1539 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS
) },
1540 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK
, USB_DEVICE_ID_SAITEK_PS1000
) },
1541 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG
, USB_DEVICE_ID_SAMSUNG_IR_REMOTE
) },
1542 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG
, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE
) },
1543 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE
, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER
) },
1544 { HID_USB_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_PS3_CONTROLLER
) },
1545 { HID_USB_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER
) },
1546 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_PS3_CONTROLLER
) },
1547 { HID_USB_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE
) },
1548 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
, USB_DEVICE_ID_MTP
) },
1549 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM
, USB_DEVICE_ID_MTP_STM
) },
1550 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX
, USB_DEVICE_ID_MTP_SITRONIX
) },
1551 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS
, USB_DEVICE_ID_SUNPLUS_WDESKTOP
) },
1552 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb300) },
1553 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb304) },
1554 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb323) },
1555 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb324) },
1556 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb651) },
1557 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb653) },
1558 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb654) },
1559 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb65a) },
1560 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO
, USB_DEVICE_ID_TIVO_SLIDE_BT
) },
1561 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO
, USB_DEVICE_ID_TIVO_SLIDE
) },
1562 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED
, USB_DEVICE_ID_TOPSEED_CYBERLINK
) },
1563 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2
, USB_DEVICE_ID_TOPSEED2_RF_COMBO
) },
1564 { HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL
, USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH
) },
1565 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN
, USB_DEVICE_ID_TWINHAN_IR_REMOTE
) },
1566 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX
, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART
) },
1567 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209
) },
1568 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U
) },
1569 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U
) },
1570 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U
) },
1571 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062
) },
1572 { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
, USB_DEVICE_ID_UNITEC_USB_TOUCH_0709
) },
1573 { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC
, USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19
) },
1574 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_SMARTJOY_PLUS
) },
1575 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_SUPER_JOY_BOX_3
) },
1576 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_DUAL_USB_JOYPAD
) },
1577 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD
, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO
) },
1578 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD
, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO
) },
1579 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD
, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO
) },
1580 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM
, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH
) },
1581 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM
, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH
) },
1582 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH
) },
1583 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH
) },
1584 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_Q_PAD
) },
1585 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_PID_0038
) },
1586 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH
) },
1587 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH
) },
1588 { HID_USB_DEVICE(USB_VENDOR_ID_XAT
, USB_DEVICE_ID_XAT_CSR
) },
1589 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_SPX
) },
1590 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_MPX
) },
1591 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_CSR
) },
1592 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_SPX1
) },
1593 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_MPX1
) },
1594 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_CSR1
) },
1595 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_SPX2
) },
1596 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_MPX2
) },
1597 { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU
, USB_DEVICE_ID_XIROKU_CSR2
) },
1598 { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS
, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE
) },
1599 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS
, 0x0005) },
1600 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS
, 0x0030) },
1601 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON
, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL
) },
1603 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_PRESENTER_8K_BT
) },
1604 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO
, USB_DEVICE_ID_NINTENDO_WIIMOTE
) },
1609 struct list_head list
;
1610 struct hid_device_id id
;
1614 * store_new_id - add a new HID device ID to this driver and re-probe devices
1615 * @driver: target device driver
1616 * @buf: buffer for scanning device ID data
1617 * @count: input size
1619 * Adds a new dynamic hid device ID to this driver,
1620 * and causes the driver to probe for all devices again.
1622 static ssize_t
store_new_id(struct device_driver
*drv
, const char *buf
,
1625 struct hid_driver
*hdrv
= container_of(drv
, struct hid_driver
, driver
);
1626 struct hid_dynid
*dynid
;
1627 __u32 bus
, vendor
, product
;
1628 unsigned long driver_data
= 0;
1631 ret
= sscanf(buf
, "%x %x %x %lx",
1632 &bus
, &vendor
, &product
, &driver_data
);
1636 dynid
= kzalloc(sizeof(*dynid
), GFP_KERNEL
);
1640 dynid
->id
.bus
= bus
;
1641 dynid
->id
.vendor
= vendor
;
1642 dynid
->id
.product
= product
;
1643 dynid
->id
.driver_data
= driver_data
;
1645 spin_lock(&hdrv
->dyn_lock
);
1646 list_add_tail(&dynid
->list
, &hdrv
->dyn_list
);
1647 spin_unlock(&hdrv
->dyn_lock
);
1649 ret
= driver_attach(&hdrv
->driver
);
1651 return ret
? : count
;
1653 static DRIVER_ATTR(new_id
, S_IWUSR
, NULL
, store_new_id
);
1655 static void hid_free_dynids(struct hid_driver
*hdrv
)
1657 struct hid_dynid
*dynid
, *n
;
1659 spin_lock(&hdrv
->dyn_lock
);
1660 list_for_each_entry_safe(dynid
, n
, &hdrv
->dyn_list
, list
) {
1661 list_del(&dynid
->list
);
1664 spin_unlock(&hdrv
->dyn_lock
);
1667 static const struct hid_device_id
*hid_match_device(struct hid_device
*hdev
,
1668 struct hid_driver
*hdrv
)
1670 struct hid_dynid
*dynid
;
1672 spin_lock(&hdrv
->dyn_lock
);
1673 list_for_each_entry(dynid
, &hdrv
->dyn_list
, list
) {
1674 if (hid_match_one_id(hdev
, &dynid
->id
)) {
1675 spin_unlock(&hdrv
->dyn_lock
);
1679 spin_unlock(&hdrv
->dyn_lock
);
1681 return hid_match_id(hdev
, hdrv
->id_table
);
1684 static int hid_bus_match(struct device
*dev
, struct device_driver
*drv
)
1686 struct hid_driver
*hdrv
= container_of(drv
, struct hid_driver
, driver
);
1687 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1689 if ((hdev
->quirks
& HID_QUIRK_MULTITOUCH
) &&
1690 !strncmp(hdrv
->name
, "hid-multitouch", 14))
1693 if (!hid_match_device(hdev
, hdrv
))
1696 /* generic wants all that don't have specialized driver */
1697 if (!strncmp(hdrv
->name
, "generic-", 8) && !hid_ignore_special_drivers
)
1698 return !hid_match_id(hdev
, hid_have_special_driver
);
1703 static int hid_device_probe(struct device
*dev
)
1705 struct hid_driver
*hdrv
= container_of(dev
->driver
,
1706 struct hid_driver
, driver
);
1707 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1708 const struct hid_device_id
*id
;
1711 if (down_interruptible(&hdev
->driver_lock
))
1714 if (!hdev
->driver
) {
1715 id
= hid_match_device(hdev
, hdrv
);
1717 if (!((hdev
->quirks
& HID_QUIRK_MULTITOUCH
) &&
1718 !strncmp(hdrv
->name
, "hid-multitouch", 14))) {
1724 hdev
->driver
= hdrv
;
1726 ret
= hdrv
->probe(hdev
, id
);
1727 } else { /* default probe */
1728 ret
= hid_parse(hdev
);
1730 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
1733 hdev
->driver
= NULL
;
1736 up(&hdev
->driver_lock
);
1740 static int hid_device_remove(struct device
*dev
)
1742 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1743 struct hid_driver
*hdrv
;
1745 if (down_interruptible(&hdev
->driver_lock
))
1748 hdrv
= hdev
->driver
;
1752 else /* default remove */
1754 hdev
->driver
= NULL
;
1757 up(&hdev
->driver_lock
);
1761 static int hid_uevent(struct device
*dev
, struct kobj_uevent_env
*env
)
1763 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1765 if (add_uevent_var(env
, "HID_ID=%04X:%08X:%08X",
1766 hdev
->bus
, hdev
->vendor
, hdev
->product
))
1769 if (add_uevent_var(env
, "HID_NAME=%s", hdev
->name
))
1772 if (add_uevent_var(env
, "HID_PHYS=%s", hdev
->phys
))
1775 if (add_uevent_var(env
, "HID_UNIQ=%s", hdev
->uniq
))
1778 if (add_uevent_var(env
, "MODALIAS=hid:b%04Xv%08Xp%08X",
1779 hdev
->bus
, hdev
->vendor
, hdev
->product
))
1785 static struct bus_type hid_bus_type
= {
1787 .match
= hid_bus_match
,
1788 .probe
= hid_device_probe
,
1789 .remove
= hid_device_remove
,
1790 .uevent
= hid_uevent
,
1793 /* a list of devices that shouldn't be handled by HID core at all */
1794 static const struct hid_device_id hid_ignore_list
[] = {
1795 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD
, USB_DEVICE_ID_ACECAD_FLAIR
) },
1796 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD
, USB_DEVICE_ID_ACECAD_302
) },
1797 { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH
, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X
) },
1798 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_01
) },
1799 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_10
) },
1800 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_20
) },
1801 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_21
) },
1802 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_22
) },
1803 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_23
) },
1804 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_24
) },
1805 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE
, USB_DEVICE_ID_AIRCABLE1
) },
1806 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR
, USB_DEVICE_ID_ALCOR_USBRS232
) },
1807 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
, USB_DEVICE_ID_ASUSTEK_LCM
)},
1808 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
, USB_DEVICE_ID_ASUSTEK_LCM2
)},
1809 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA
, USB_DEVICE_ID_AVER_FM_MR800
) },
1810 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE
, USB_DEVICE_ID_BERKSHIRE_PCWD
) },
1811 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC
, 0x0103) },
1812 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL
, USB_DEVICE_ID_CYGNAL_RADIO_SI470X
) },
1813 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA
, USB_DEVICE_ID_CM109
) },
1814 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_HIDCOM
) },
1815 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE
) },
1816 { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME
, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701
) },
1817 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME
, USB_DEVICE_ID_DELORME_EARTHMATE
) },
1818 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME
, USB_DEVICE_ID_DELORME_EM_LT20
) },
1819 { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY
, 0x0004) },
1820 { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY
, 0x000a) },
1821 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY
, USB_DEVICE_ID_ESSENTIAL_REALITY_P5
) },
1822 { HID_USB_DEVICE(USB_VENDOR_ID_ETT
, USB_DEVICE_ID_TC5UH
) },
1823 { HID_USB_DEVICE(USB_VENDOR_ID_ETT
, USB_DEVICE_ID_TC4UM
) },
1824 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0001) },
1825 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0002) },
1826 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0004) },
1827 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_4_PHIDGETSERVO_30
) },
1828 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_1_PHIDGETSERVO_30
) },
1829 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_0_4_IF_KIT
) },
1830 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_16_16_IF_KIT
) },
1831 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_8_8_8_IF_KIT
) },
1832 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_8_7_IF_KIT
) },
1833 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_8_8_IF_KIT
) },
1834 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_PHIDGET_MOTORCONTROL
) },
1835 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_SUPER_Q2
) },
1836 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_GOGOPEN
) },
1837 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_PENPOWER
) },
1838 { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH
, USB_DEVICE_ID_GRETAGMACBETH_HUEY
) },
1839 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN
, USB_DEVICE_ID_POWERMATE
) },
1840 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN
, USB_DEVICE_ID_SOUNDKNOB
) },
1841 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_90
) },
1842 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_100
) },
1843 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_101
) },
1844 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_103
) },
1845 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_104
) },
1846 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_105
) },
1847 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_106
) },
1848 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_107
) },
1849 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_108
) },
1850 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_200
) },
1851 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_201
) },
1852 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_202
) },
1853 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_203
) },
1854 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_204
) },
1855 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_205
) },
1856 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_206
) },
1857 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_207
) },
1858 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_300
) },
1859 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_301
) },
1860 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_302
) },
1861 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_303
) },
1862 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_304
) },
1863 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_305
) },
1864 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_306
) },
1865 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_307
) },
1866 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_308
) },
1867 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_309
) },
1868 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_400
) },
1869 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_401
) },
1870 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_402
) },
1871 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_403
) },
1872 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_404
) },
1873 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_405
) },
1874 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_500
) },
1875 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_501
) },
1876 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_502
) },
1877 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_503
) },
1878 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_504
) },
1879 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1000
) },
1880 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1001
) },
1881 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1002
) },
1882 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1003
) },
1883 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1004
) },
1884 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1005
) },
1885 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1006
) },
1886 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1007
) },
1887 { HID_USB_DEVICE(USB_VENDOR_ID_IMATION
, USB_DEVICE_ID_DISC_STAKKA
) },
1888 { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR
, USB_DEVICE_ID_KBGEAR_JAMSTUDIO
) },
1889 { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD
, USB_DEVICE_ID_KWORLD_RADIO_FM700
) },
1890 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_GPEN_560
) },
1891 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE
, 0x0058) },
1892 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_CASSY
) },
1893 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_CASSY2
) },
1894 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_POCKETCASSY
) },
1895 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_POCKETCASSY2
) },
1896 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOBILECASSY
) },
1897 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOBILECASSY2
) },
1898 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE
) },
1899 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MICROCASSYCURRENT
) },
1900 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MICROCASSYTIME
) },
1901 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE
) },
1902 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MICROCASSYPH
) },
1903 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_JWM
) },
1904 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_DMMP
) },
1905 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_UMIP
) },
1906 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_UMIC
) },
1907 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_UMIB
) },
1908 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_XRAY
) },
1909 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_XRAY2
) },
1910 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_VIDEOCOM
) },
1911 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOTOR
) },
1912 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_COM3LAB
) },
1913 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_TELEPORT
) },
1914 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_NETWORKANALYSER
) },
1915 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_POWERCONTROL
) },
1916 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MACHINETEST
) },
1917 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOSTANALYSER
) },
1918 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOSTANALYSER2
) },
1919 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_ABSESP
) },
1920 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_AUTODATABUS
) },
1921 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MCT
) },
1922 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_HYBRID
) },
1923 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_HEATCONTROL
) },
1924 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ
, USB_DEVICE_ID_MADCATZ_BEATPAD
) },
1925 { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT
, USB_DEVICE_ID_MASTERKIT_MA901RADIO
) },
1926 { HID_USB_DEVICE(USB_VENDOR_ID_MCC
, USB_DEVICE_ID_MCC_PMD1024LS
) },
1927 { HID_USB_DEVICE(USB_VENDOR_ID_MCC
, USB_DEVICE_ID_MCC_PMD1208LS
) },
1928 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICKIT1
) },
1929 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICKIT2
) },
1930 { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR
, USB_DEVICE_ID_N_S_HARMONY
) },
1931 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
) },
1932 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 20) },
1933 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 30) },
1934 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 100) },
1935 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 108) },
1936 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 118) },
1937 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 200) },
1938 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 300) },
1939 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 400) },
1940 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 500) },
1941 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0001) },
1942 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0002) },
1943 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0003) },
1944 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0004) },
1945 { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS
, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE
) },
1946 { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM
, USB_DEVICE_ID_POWERCOM_UPS
) },
1947 #if defined(CONFIG_MOUSE_SYNAPTICS_USB) || defined(CONFIG_MOUSE_SYNAPTICS_USB_MODULE)
1948 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_TP
) },
1949 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_INT_TP
) },
1950 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_CPAD
) },
1951 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_STICK
) },
1952 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_WP
) },
1953 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_COMP_TP
) },
1954 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_WTP
) },
1955 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS
, USB_DEVICE_ID_SYNAPTICS_DPAD
) },
1957 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_LABPRO
) },
1958 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_GOTEMP
) },
1959 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_SKIP
) },
1960 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_CYCLOPS
) },
1961 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_LCSPEC
) },
1962 { HID_USB_DEVICE(USB_VENDOR_ID_WACOM
, HID_ANY_ID
) },
1963 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_4_PHIDGETSERVO_20
) },
1964 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_1_PHIDGETSERVO_20
) },
1965 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_8_8_4_IF_KIT
) },
1966 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK
, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K
) },
1971 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
1973 * There are composite devices for which we want to ignore only a certain
1974 * interface. This is a list of devices for which only the mouse interface will
1975 * be ignored. This allows a dedicated driver to take care of the interface.
1977 static const struct hid_device_id hid_mouse_ignore_list
[] = {
1978 /* appletouch driver */
1979 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI
) },
1980 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO
) },
1981 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ANSI
) },
1982 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ISO
) },
1983 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_JIS
) },
1984 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ANSI
) },
1985 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ISO
) },
1986 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_JIS
) },
1987 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ANSI
) },
1988 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ISO
) },
1989 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_JIS
) },
1990 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI
) },
1991 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO
) },
1992 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS
) },
1993 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI
) },
1994 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ISO
) },
1995 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_JIS
) },
1996 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI
) },
1997 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO
) },
1998 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS
) },
1999 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI
) },
2000 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO
) },
2001 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS
) },
2002 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI
) },
2003 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO
) },
2004 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS
) },
2005 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI
) },
2006 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO
) },
2007 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS
) },
2008 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI
) },
2009 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO
) },
2010 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS
) },
2011 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI
) },
2012 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO
) },
2013 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS
) },
2014 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI
) },
2015 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO
) },
2016 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS
) },
2017 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI
) },
2018 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO
) },
2019 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS
) },
2020 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI
) },
2021 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO
) },
2022 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS
) },
2023 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY
) },
2024 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY
) },
2028 static bool hid_ignore(struct hid_device
*hdev
)
2030 switch (hdev
->vendor
) {
2031 case USB_VENDOR_ID_CODEMERCS
:
2032 /* ignore all Code Mercenaries IOWarrior devices */
2033 if (hdev
->product
>= USB_DEVICE_ID_CODEMERCS_IOW_FIRST
&&
2034 hdev
->product
<= USB_DEVICE_ID_CODEMERCS_IOW_LAST
)
2037 case USB_VENDOR_ID_LOGITECH
:
2038 if (hdev
->product
>= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST
&&
2039 hdev
->product
<= USB_DEVICE_ID_LOGITECH_HARMONY_LAST
)
2042 * The Keene FM transmitter USB device has the same USB ID as
2043 * the Logitech AudioHub Speaker, but it should ignore the hid.
2044 * Check if the name is that of the Keene device.
2045 * For reference: the name of the AudioHub is
2046 * "HOLTEK AudioHub Speaker".
2048 if (hdev
->product
== USB_DEVICE_ID_LOGITECH_AUDIOHUB
&&
2049 !strcmp(hdev
->name
, "HOLTEK B-LINK USB Audio "))
2052 case USB_VENDOR_ID_SOUNDGRAPH
:
2053 if (hdev
->product
>= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST
&&
2054 hdev
->product
<= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST
)
2057 case USB_VENDOR_ID_HANWANG
:
2058 if (hdev
->product
>= USB_DEVICE_ID_HANWANG_TABLET_FIRST
&&
2059 hdev
->product
<= USB_DEVICE_ID_HANWANG_TABLET_LAST
)
2062 case USB_VENDOR_ID_JESS
:
2063 if (hdev
->product
== USB_DEVICE_ID_JESS_YUREX
&&
2064 hdev
->type
== HID_TYPE_USBNONE
)
2069 if (hdev
->type
== HID_TYPE_USBMOUSE
&&
2070 hid_match_id(hdev
, hid_mouse_ignore_list
))
2073 return !!hid_match_id(hdev
, hid_ignore_list
);
2076 int hid_add_device(struct hid_device
*hdev
)
2078 static atomic_t id
= ATOMIC_INIT(0);
2081 if (WARN_ON(hdev
->status
& HID_STAT_ADDED
))
2084 /* we need to kill them here, otherwise they will stay allocated to
2085 * wait for coming driver */
2086 if (!(hdev
->quirks
& HID_QUIRK_NO_IGNORE
)
2087 && (hid_ignore(hdev
) || (hdev
->quirks
& HID_QUIRK_IGNORE
)))
2090 /* XXX hack, any other cleaner solution after the driver core
2091 * is converted to allow more than 20 bytes as the device name? */
2092 dev_set_name(&hdev
->dev
, "%04X:%04X:%04X.%04X", hdev
->bus
,
2093 hdev
->vendor
, hdev
->product
, atomic_inc_return(&id
));
2095 hid_debug_register(hdev
, dev_name(&hdev
->dev
));
2096 ret
= device_add(&hdev
->dev
);
2098 hdev
->status
|= HID_STAT_ADDED
;
2100 hid_debug_unregister(hdev
);
2104 EXPORT_SYMBOL_GPL(hid_add_device
);
2107 * hid_allocate_device - allocate new hid device descriptor
2109 * Allocate and initialize hid device, so that hid_destroy_device might be
2112 * New hid_device pointer is returned on success, otherwise ERR_PTR encoded
2115 struct hid_device
*hid_allocate_device(void)
2117 struct hid_device
*hdev
;
2121 hdev
= kzalloc(sizeof(*hdev
), GFP_KERNEL
);
2123 return ERR_PTR(ret
);
2125 device_initialize(&hdev
->dev
);
2126 hdev
->dev
.release
= hid_device_release
;
2127 hdev
->dev
.bus
= &hid_bus_type
;
2129 hdev
->collection
= kcalloc(HID_DEFAULT_NUM_COLLECTIONS
,
2130 sizeof(struct hid_collection
), GFP_KERNEL
);
2131 if (hdev
->collection
== NULL
)
2133 hdev
->collection_size
= HID_DEFAULT_NUM_COLLECTIONS
;
2135 for (i
= 0; i
< HID_REPORT_TYPES
; i
++)
2136 INIT_LIST_HEAD(&hdev
->report_enum
[i
].report_list
);
2138 init_waitqueue_head(&hdev
->debug_wait
);
2139 INIT_LIST_HEAD(&hdev
->debug_list
);
2140 sema_init(&hdev
->driver_lock
, 1);
2144 put_device(&hdev
->dev
);
2145 return ERR_PTR(ret
);
2147 EXPORT_SYMBOL_GPL(hid_allocate_device
);
2149 static void hid_remove_device(struct hid_device
*hdev
)
2151 if (hdev
->status
& HID_STAT_ADDED
) {
2152 device_del(&hdev
->dev
);
2153 hid_debug_unregister(hdev
);
2154 hdev
->status
&= ~HID_STAT_ADDED
;
2159 * hid_destroy_device - free previously allocated device
2163 * If you allocate hid_device through hid_allocate_device, you should ever
2164 * free by this function.
2166 void hid_destroy_device(struct hid_device
*hdev
)
2168 hid_remove_device(hdev
);
2169 put_device(&hdev
->dev
);
2171 EXPORT_SYMBOL_GPL(hid_destroy_device
);
2173 int __hid_register_driver(struct hid_driver
*hdrv
, struct module
*owner
,
2174 const char *mod_name
)
2178 hdrv
->driver
.name
= hdrv
->name
;
2179 hdrv
->driver
.bus
= &hid_bus_type
;
2180 hdrv
->driver
.owner
= owner
;
2181 hdrv
->driver
.mod_name
= mod_name
;
2183 INIT_LIST_HEAD(&hdrv
->dyn_list
);
2184 spin_lock_init(&hdrv
->dyn_lock
);
2186 ret
= driver_register(&hdrv
->driver
);
2190 ret
= driver_create_file(&hdrv
->driver
, &driver_attr_new_id
);
2192 driver_unregister(&hdrv
->driver
);
2196 EXPORT_SYMBOL_GPL(__hid_register_driver
);
2198 void hid_unregister_driver(struct hid_driver
*hdrv
)
2200 driver_remove_file(&hdrv
->driver
, &driver_attr_new_id
);
2201 driver_unregister(&hdrv
->driver
);
2202 hid_free_dynids(hdrv
);
2204 EXPORT_SYMBOL_GPL(hid_unregister_driver
);
2206 int hid_check_keys_pressed(struct hid_device
*hid
)
2208 struct hid_input
*hidinput
;
2211 if (!(hid
->claimed
& HID_CLAIMED_INPUT
))
2214 list_for_each_entry(hidinput
, &hid
->inputs
, list
) {
2215 for (i
= 0; i
< BITS_TO_LONGS(KEY_MAX
); i
++)
2216 if (hidinput
->input
->key
[i
])
2223 EXPORT_SYMBOL_GPL(hid_check_keys_pressed
);
2225 static int __init
hid_init(void)
2230 pr_warn("hid_debug is now used solely for parser and driver debugging.\n"
2231 "debugfs is now used for inspecting the device (report descriptor, reports)\n");
2233 ret
= bus_register(&hid_bus_type
);
2235 pr_err("can't register hid bus\n");
2239 ret
= hidraw_init();
2247 bus_unregister(&hid_bus_type
);
2252 static void __exit
hid_exit(void)
2256 bus_unregister(&hid_bus_type
);
2259 module_init(hid_init
);
2260 module_exit(hid_exit
);
2262 MODULE_AUTHOR("Andreas Gal");
2263 MODULE_AUTHOR("Vojtech Pavlik");
2264 MODULE_AUTHOR("Jiri Kosina");
2265 MODULE_LICENSE(DRIVER_LICENSE
);