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-2010 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 #include <linux/module.h>
18 #include <linux/slab.h>
19 #include <linux/init.h>
20 #include <linux/kernel.h>
21 #include <linux/list.h>
23 #include <linux/spinlock.h>
24 #include <asm/unaligned.h>
25 #include <asm/byteorder.h>
26 #include <linux/input.h>
27 #include <linux/wait.h>
28 #include <linux/vmalloc.h>
29 #include <linux/sched.h>
31 #include <linux/hid.h>
32 #include <linux/hiddev.h>
33 #include <linux/hid-debug.h>
34 #include <linux/hidraw.h>
42 #define DRIVER_DESC "HID core driver"
43 #define DRIVER_LICENSE "GPL"
46 module_param_named(debug
, hid_debug
, int, 0600);
47 MODULE_PARM_DESC(debug
, "toggle HID debugging messages");
48 EXPORT_SYMBOL_GPL(hid_debug
);
51 * Register a new report for a device.
54 struct hid_report
*hid_register_report(struct hid_device
*device
, unsigned type
, unsigned id
)
56 struct hid_report_enum
*report_enum
= device
->report_enum
+ type
;
57 struct hid_report
*report
;
59 if (report_enum
->report_id_hash
[id
])
60 return report_enum
->report_id_hash
[id
];
62 if (!(report
= kzalloc(sizeof(struct hid_report
), GFP_KERNEL
)))
66 report_enum
->numbered
= 1;
71 report
->device
= device
;
72 report_enum
->report_id_hash
[id
] = report
;
74 list_add_tail(&report
->list
, &report_enum
->report_list
);
78 EXPORT_SYMBOL_GPL(hid_register_report
);
81 * Register a new field for this report.
84 static struct hid_field
*hid_register_field(struct hid_report
*report
, unsigned usages
, unsigned values
)
86 struct hid_field
*field
;
88 if (report
->maxfield
== HID_MAX_FIELDS
) {
89 dbg_hid("too many fields in report\n");
93 if (!(field
= kzalloc(sizeof(struct hid_field
) + usages
* sizeof(struct hid_usage
)
94 + values
* sizeof(unsigned), GFP_KERNEL
))) return NULL
;
96 field
->index
= report
->maxfield
++;
97 report
->field
[field
->index
] = field
;
98 field
->usage
= (struct hid_usage
*)(field
+ 1);
99 field
->value
= (s32
*)(field
->usage
+ usages
);
100 field
->report
= report
;
106 * Open a collection. The type/usage is pushed on the stack.
109 static int open_collection(struct hid_parser
*parser
, unsigned type
)
111 struct hid_collection
*collection
;
114 usage
= parser
->local
.usage
[0];
116 if (parser
->collection_stack_ptr
== HID_COLLECTION_STACK_SIZE
) {
117 dbg_hid("collection stack overflow\n");
121 if (parser
->device
->maxcollection
== parser
->device
->collection_size
) {
122 collection
= kmalloc(sizeof(struct hid_collection
) *
123 parser
->device
->collection_size
* 2, GFP_KERNEL
);
124 if (collection
== NULL
) {
125 dbg_hid("failed to reallocate collection array\n");
128 memcpy(collection
, parser
->device
->collection
,
129 sizeof(struct hid_collection
) *
130 parser
->device
->collection_size
);
131 memset(collection
+ parser
->device
->collection_size
, 0,
132 sizeof(struct hid_collection
) *
133 parser
->device
->collection_size
);
134 kfree(parser
->device
->collection
);
135 parser
->device
->collection
= collection
;
136 parser
->device
->collection_size
*= 2;
139 parser
->collection_stack
[parser
->collection_stack_ptr
++] =
140 parser
->device
->maxcollection
;
142 collection
= parser
->device
->collection
+
143 parser
->device
->maxcollection
++;
144 collection
->type
= type
;
145 collection
->usage
= usage
;
146 collection
->level
= parser
->collection_stack_ptr
- 1;
148 if (type
== HID_COLLECTION_APPLICATION
)
149 parser
->device
->maxapplication
++;
155 * Close a collection.
158 static int close_collection(struct hid_parser
*parser
)
160 if (!parser
->collection_stack_ptr
) {
161 dbg_hid("collection stack underflow\n");
164 parser
->collection_stack_ptr
--;
169 * Climb up the stack, search for the specified collection type
170 * and return the usage.
173 static unsigned hid_lookup_collection(struct hid_parser
*parser
, unsigned type
)
176 for (n
= parser
->collection_stack_ptr
- 1; n
>= 0; n
--)
177 if (parser
->device
->collection
[parser
->collection_stack
[n
]].type
== type
)
178 return parser
->device
->collection
[parser
->collection_stack
[n
]].usage
;
179 return 0; /* we know nothing about this usage type */
183 * Add a usage to the temporary parser table.
186 static int hid_add_usage(struct hid_parser
*parser
, unsigned usage
)
188 if (parser
->local
.usage_index
>= HID_MAX_USAGES
) {
189 dbg_hid("usage index exceeded\n");
192 parser
->local
.usage
[parser
->local
.usage_index
] = usage
;
193 parser
->local
.collection_index
[parser
->local
.usage_index
] =
194 parser
->collection_stack_ptr
?
195 parser
->collection_stack
[parser
->collection_stack_ptr
- 1] : 0;
196 parser
->local
.usage_index
++;
201 * Register a new field for this report.
204 static int hid_add_field(struct hid_parser
*parser
, unsigned report_type
, unsigned flags
)
206 struct hid_report
*report
;
207 struct hid_field
*field
;
212 if (!(report
= hid_register_report(parser
->device
, report_type
, parser
->global
.report_id
))) {
213 dbg_hid("hid_register_report failed\n");
217 if (parser
->global
.logical_maximum
< parser
->global
.logical_minimum
) {
218 dbg_hid("logical range invalid %d %d\n", parser
->global
.logical_minimum
, parser
->global
.logical_maximum
);
222 offset
= report
->size
;
223 report
->size
+= parser
->global
.report_size
* parser
->global
.report_count
;
225 if (!parser
->local
.usage_index
) /* Ignore padding fields */
228 usages
= max_t(int, parser
->local
.usage_index
, parser
->global
.report_count
);
230 if ((field
= hid_register_field(report
, usages
, parser
->global
.report_count
)) == NULL
)
233 field
->physical
= hid_lookup_collection(parser
, HID_COLLECTION_PHYSICAL
);
234 field
->logical
= hid_lookup_collection(parser
, HID_COLLECTION_LOGICAL
);
235 field
->application
= hid_lookup_collection(parser
, HID_COLLECTION_APPLICATION
);
237 for (i
= 0; i
< usages
; i
++) {
239 /* Duplicate the last usage we parsed if we have excess values */
240 if (i
>= parser
->local
.usage_index
)
241 j
= parser
->local
.usage_index
- 1;
242 field
->usage
[i
].hid
= parser
->local
.usage
[j
];
243 field
->usage
[i
].collection_index
=
244 parser
->local
.collection_index
[j
];
247 field
->maxusage
= usages
;
248 field
->flags
= flags
;
249 field
->report_offset
= offset
;
250 field
->report_type
= report_type
;
251 field
->report_size
= parser
->global
.report_size
;
252 field
->report_count
= parser
->global
.report_count
;
253 field
->logical_minimum
= parser
->global
.logical_minimum
;
254 field
->logical_maximum
= parser
->global
.logical_maximum
;
255 field
->physical_minimum
= parser
->global
.physical_minimum
;
256 field
->physical_maximum
= parser
->global
.physical_maximum
;
257 field
->unit_exponent
= parser
->global
.unit_exponent
;
258 field
->unit
= parser
->global
.unit
;
264 * Read data value from item.
267 static u32
item_udata(struct hid_item
*item
)
269 switch (item
->size
) {
270 case 1: return item
->data
.u8
;
271 case 2: return item
->data
.u16
;
272 case 4: return item
->data
.u32
;
277 static s32
item_sdata(struct hid_item
*item
)
279 switch (item
->size
) {
280 case 1: return item
->data
.s8
;
281 case 2: return item
->data
.s16
;
282 case 4: return item
->data
.s32
;
288 * Process a global item.
291 static int hid_parser_global(struct hid_parser
*parser
, struct hid_item
*item
)
294 case HID_GLOBAL_ITEM_TAG_PUSH
:
296 if (parser
->global_stack_ptr
== HID_GLOBAL_STACK_SIZE
) {
297 dbg_hid("global enviroment stack overflow\n");
301 memcpy(parser
->global_stack
+ parser
->global_stack_ptr
++,
302 &parser
->global
, sizeof(struct hid_global
));
305 case HID_GLOBAL_ITEM_TAG_POP
:
307 if (!parser
->global_stack_ptr
) {
308 dbg_hid("global enviroment stack underflow\n");
312 memcpy(&parser
->global
, parser
->global_stack
+
313 --parser
->global_stack_ptr
, sizeof(struct hid_global
));
316 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE
:
317 parser
->global
.usage_page
= item_udata(item
);
320 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM
:
321 parser
->global
.logical_minimum
= item_sdata(item
);
324 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM
:
325 if (parser
->global
.logical_minimum
< 0)
326 parser
->global
.logical_maximum
= item_sdata(item
);
328 parser
->global
.logical_maximum
= item_udata(item
);
331 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM
:
332 parser
->global
.physical_minimum
= item_sdata(item
);
335 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM
:
336 if (parser
->global
.physical_minimum
< 0)
337 parser
->global
.physical_maximum
= item_sdata(item
);
339 parser
->global
.physical_maximum
= item_udata(item
);
342 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT
:
343 parser
->global
.unit_exponent
= item_sdata(item
);
346 case HID_GLOBAL_ITEM_TAG_UNIT
:
347 parser
->global
.unit
= item_udata(item
);
350 case HID_GLOBAL_ITEM_TAG_REPORT_SIZE
:
351 parser
->global
.report_size
= item_udata(item
);
352 if (parser
->global
.report_size
> 32) {
353 dbg_hid("invalid report_size %d\n",
354 parser
->global
.report_size
);
359 case HID_GLOBAL_ITEM_TAG_REPORT_COUNT
:
360 parser
->global
.report_count
= item_udata(item
);
361 if (parser
->global
.report_count
> HID_MAX_USAGES
) {
362 dbg_hid("invalid report_count %d\n",
363 parser
->global
.report_count
);
368 case HID_GLOBAL_ITEM_TAG_REPORT_ID
:
369 parser
->global
.report_id
= item_udata(item
);
370 if (parser
->global
.report_id
== 0) {
371 dbg_hid("report_id 0 is invalid\n");
377 dbg_hid("unknown global tag 0x%x\n", item
->tag
);
383 * Process a local item.
386 static int hid_parser_local(struct hid_parser
*parser
, struct hid_item
*item
)
391 data
= item_udata(item
);
394 case HID_LOCAL_ITEM_TAG_DELIMITER
:
398 * We treat items before the first delimiter
399 * as global to all usage sets (branch 0).
400 * In the moment we process only these global
401 * items and the first delimiter set.
403 if (parser
->local
.delimiter_depth
!= 0) {
404 dbg_hid("nested delimiters\n");
407 parser
->local
.delimiter_depth
++;
408 parser
->local
.delimiter_branch
++;
410 if (parser
->local
.delimiter_depth
< 1) {
411 dbg_hid("bogus close delimiter\n");
414 parser
->local
.delimiter_depth
--;
418 case HID_LOCAL_ITEM_TAG_USAGE
:
420 if (parser
->local
.delimiter_branch
> 1) {
421 dbg_hid("alternative usage ignored\n");
426 data
= (parser
->global
.usage_page
<< 16) + data
;
428 return hid_add_usage(parser
, data
);
430 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM
:
432 if (parser
->local
.delimiter_branch
> 1) {
433 dbg_hid("alternative usage ignored\n");
438 data
= (parser
->global
.usage_page
<< 16) + data
;
440 parser
->local
.usage_minimum
= data
;
443 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM
:
445 if (parser
->local
.delimiter_branch
> 1) {
446 dbg_hid("alternative usage ignored\n");
451 data
= (parser
->global
.usage_page
<< 16) + data
;
453 for (n
= parser
->local
.usage_minimum
; n
<= data
; n
++)
454 if (hid_add_usage(parser
, n
)) {
455 dbg_hid("hid_add_usage failed\n");
462 dbg_hid("unknown local item tag 0x%x\n", item
->tag
);
469 * Process a main item.
472 static int hid_parser_main(struct hid_parser
*parser
, struct hid_item
*item
)
477 data
= item_udata(item
);
480 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION
:
481 ret
= open_collection(parser
, data
& 0xff);
483 case HID_MAIN_ITEM_TAG_END_COLLECTION
:
484 ret
= close_collection(parser
);
486 case HID_MAIN_ITEM_TAG_INPUT
:
487 ret
= hid_add_field(parser
, HID_INPUT_REPORT
, data
);
489 case HID_MAIN_ITEM_TAG_OUTPUT
:
490 ret
= hid_add_field(parser
, HID_OUTPUT_REPORT
, data
);
492 case HID_MAIN_ITEM_TAG_FEATURE
:
493 ret
= hid_add_field(parser
, HID_FEATURE_REPORT
, data
);
496 dbg_hid("unknown main item tag 0x%x\n", item
->tag
);
500 memset(&parser
->local
, 0, sizeof(parser
->local
)); /* Reset the local parser environment */
506 * Process a reserved item.
509 static int hid_parser_reserved(struct hid_parser
*parser
, struct hid_item
*item
)
511 dbg_hid("reserved item type, tag 0x%x\n", item
->tag
);
516 * Free a report and all registered fields. The field->usage and
517 * field->value table's are allocated behind the field, so we need
518 * only to free(field) itself.
521 static void hid_free_report(struct hid_report
*report
)
525 for (n
= 0; n
< report
->maxfield
; n
++)
526 kfree(report
->field
[n
]);
531 * Free a device structure, all reports, and all fields.
534 static void hid_device_release(struct device
*dev
)
536 struct hid_device
*device
= container_of(dev
, struct hid_device
, dev
);
539 for (i
= 0; i
< HID_REPORT_TYPES
; i
++) {
540 struct hid_report_enum
*report_enum
= device
->report_enum
+ i
;
542 for (j
= 0; j
< 256; j
++) {
543 struct hid_report
*report
= report_enum
->report_id_hash
[j
];
545 hid_free_report(report
);
549 kfree(device
->rdesc
);
550 kfree(device
->collection
);
555 * Fetch a report description item from the data stream. We support long
556 * items, though they are not used yet.
559 static u8
*fetch_item(__u8
*start
, __u8
*end
, struct hid_item
*item
)
563 if ((end
- start
) <= 0)
568 item
->type
= (b
>> 2) & 3;
569 item
->tag
= (b
>> 4) & 15;
571 if (item
->tag
== HID_ITEM_TAG_LONG
) {
573 item
->format
= HID_ITEM_FORMAT_LONG
;
575 if ((end
- start
) < 2)
578 item
->size
= *start
++;
579 item
->tag
= *start
++;
581 if ((end
- start
) < item
->size
)
584 item
->data
.longdata
= start
;
589 item
->format
= HID_ITEM_FORMAT_SHORT
;
592 switch (item
->size
) {
597 if ((end
- start
) < 1)
599 item
->data
.u8
= *start
++;
603 if ((end
- start
) < 2)
605 item
->data
.u16
= get_unaligned_le16(start
);
606 start
= (__u8
*)((__le16
*)start
+ 1);
611 if ((end
- start
) < 4)
613 item
->data
.u32
= get_unaligned_le32(start
);
614 start
= (__u8
*)((__le32
*)start
+ 1);
622 * hid_parse_report - parse device report
624 * @device: hid device
625 * @start: report start
628 * Parse a report description into a hid_device structure. Reports are
629 * enumerated, fields are attached to these reports.
630 * 0 returned on success, otherwise nonzero error value.
632 int hid_parse_report(struct hid_device
*device
, __u8
*start
,
635 struct hid_parser
*parser
;
636 struct hid_item item
;
639 static int (*dispatch_type
[])(struct hid_parser
*parser
,
640 struct hid_item
*item
) = {
647 if (device
->driver
->report_fixup
)
648 start
= device
->driver
->report_fixup(device
, start
, &size
);
650 device
->rdesc
= kmemdup(start
, size
, GFP_KERNEL
);
651 if (device
->rdesc
== NULL
)
653 device
->rsize
= size
;
655 parser
= vmalloc(sizeof(struct hid_parser
));
661 memset(parser
, 0, sizeof(struct hid_parser
));
662 parser
->device
= device
;
666 while ((start
= fetch_item(start
, end
, &item
)) != NULL
) {
668 if (item
.format
!= HID_ITEM_FORMAT_SHORT
) {
669 dbg_hid("unexpected long global item\n");
673 if (dispatch_type
[item
.type
](parser
, &item
)) {
674 dbg_hid("item %u %u %u %u parsing failed\n",
675 item
.format
, (unsigned)item
.size
, (unsigned)item
.type
, (unsigned)item
.tag
);
680 if (parser
->collection_stack_ptr
) {
681 dbg_hid("unbalanced collection at end of report description\n");
684 if (parser
->local
.delimiter_depth
) {
685 dbg_hid("unbalanced delimiter at end of report description\n");
693 dbg_hid("item fetching failed at offset %d\n", (int)(end
- start
));
698 EXPORT_SYMBOL_GPL(hid_parse_report
);
701 * Convert a signed n-bit integer to signed 32-bit integer. Common
702 * cases are done through the compiler, the screwed things has to be
706 static s32
snto32(__u32 value
, unsigned n
)
709 case 8: return ((__s8
)value
);
710 case 16: return ((__s16
)value
);
711 case 32: return ((__s32
)value
);
713 return value
& (1 << (n
- 1)) ? value
| (-1 << n
) : value
;
717 * Convert a signed 32-bit integer to a signed n-bit integer.
720 static u32
s32ton(__s32 value
, unsigned n
)
722 s32 a
= value
>> (n
- 1);
724 return value
< 0 ? 1 << (n
- 1) : (1 << (n
- 1)) - 1;
725 return value
& ((1 << n
) - 1);
729 * Extract/implement a data field from/to a little endian report (bit array).
731 * Code sort-of follows HID spec:
732 * http://www.usb.org/developers/devclass_docs/HID1_11.pdf
734 * While the USB HID spec allows unlimited length bit fields in "report
735 * descriptors", most devices never use more than 16 bits.
736 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
737 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
740 static __inline__ __u32
extract(__u8
*report
, unsigned offset
, unsigned n
)
745 printk(KERN_WARNING
"HID: extract() called with n (%d) > 32! (%s)\n",
748 report
+= offset
>> 3; /* adjust byte index */
749 offset
&= 7; /* now only need bit offset into one byte */
750 x
= get_unaligned_le64(report
);
751 x
= (x
>> offset
) & ((1ULL << n
) - 1); /* extract bit field */
756 * "implement" : set bits in a little endian bit stream.
757 * Same concepts as "extract" (see comments above).
758 * The data mangled in the bit stream remains in little endian
759 * order the whole time. It make more sense to talk about
760 * endianness of register values by considering a register
761 * a "cached" copy of the little endiad bit stream.
763 static __inline__
void implement(__u8
*report
, unsigned offset
, unsigned n
, __u32 value
)
766 u64 m
= (1ULL << n
) - 1;
769 printk(KERN_WARNING
"HID: implement() called with n (%d) > 32! (%s)\n",
773 printk(KERN_WARNING
"HID: implement() called with too large value %d! (%s)\n",
774 value
, current
->comm
);
778 report
+= offset
>> 3;
781 x
= get_unaligned_le64(report
);
783 x
|= ((u64
)value
) << offset
;
784 put_unaligned_le64(x
, report
);
788 * Search an array for a value.
791 static __inline__
int search(__s32
*array
, __s32 value
, unsigned n
)
794 if (*array
++ == value
)
801 * hid_match_report - check if driver's raw_event should be called
804 * @report_type: type to match against
806 * compare hid->driver->report_table->report_type to report->type
808 static int hid_match_report(struct hid_device
*hid
, struct hid_report
*report
)
810 const struct hid_report_id
*id
= hid
->driver
->report_table
;
812 if (!id
) /* NULL means all */
815 for (; id
->report_type
!= HID_TERMINATOR
; id
++)
816 if (id
->report_type
== HID_ANY_ID
||
817 id
->report_type
== report
->type
)
823 * hid_match_usage - check if driver's event should be called
826 * @usage: usage to match against
828 * compare hid->driver->usage_table->usage_{type,code} to
829 * usage->usage_{type,code}
831 static int hid_match_usage(struct hid_device
*hid
, struct hid_usage
*usage
)
833 const struct hid_usage_id
*id
= hid
->driver
->usage_table
;
835 if (!id
) /* NULL means all */
838 for (; id
->usage_type
!= HID_ANY_ID
- 1; id
++)
839 if ((id
->usage_hid
== HID_ANY_ID
||
840 id
->usage_hid
== usage
->hid
) &&
841 (id
->usage_type
== HID_ANY_ID
||
842 id
->usage_type
== usage
->type
) &&
843 (id
->usage_code
== HID_ANY_ID
||
844 id
->usage_code
== usage
->code
))
849 static void hid_process_event(struct hid_device
*hid
, struct hid_field
*field
,
850 struct hid_usage
*usage
, __s32 value
, int interrupt
)
852 struct hid_driver
*hdrv
= hid
->driver
;
855 hid_dump_input(hid
, usage
, value
);
857 if (hdrv
&& hdrv
->event
&& hid_match_usage(hid
, usage
)) {
858 ret
= hdrv
->event(hid
, field
, usage
, value
);
861 dbg_hid("%s's event failed with %d\n",
867 if (hid
->claimed
& HID_CLAIMED_INPUT
)
868 hidinput_hid_event(hid
, field
, usage
, value
);
869 if (hid
->claimed
& HID_CLAIMED_HIDDEV
&& interrupt
&& hid
->hiddev_hid_event
)
870 hid
->hiddev_hid_event(hid
, field
, usage
, value
);
874 * Analyse a received field, and fetch the data from it. The field
875 * content is stored for next report processing (we do differential
876 * reporting to the layer).
879 static void hid_input_field(struct hid_device
*hid
, struct hid_field
*field
,
880 __u8
*data
, int interrupt
)
883 unsigned count
= field
->report_count
;
884 unsigned offset
= field
->report_offset
;
885 unsigned size
= field
->report_size
;
886 __s32 min
= field
->logical_minimum
;
887 __s32 max
= field
->logical_maximum
;
890 if (!(value
= kmalloc(sizeof(__s32
) * count
, GFP_ATOMIC
)))
893 for (n
= 0; n
< count
; n
++) {
895 value
[n
] = min
< 0 ? snto32(extract(data
, offset
+ n
* size
, size
), size
) :
896 extract(data
, offset
+ n
* size
, size
);
898 if (!(field
->flags
& HID_MAIN_ITEM_VARIABLE
) /* Ignore report if ErrorRollOver */
899 && value
[n
] >= min
&& value
[n
] <= max
900 && field
->usage
[value
[n
] - min
].hid
== HID_UP_KEYBOARD
+ 1)
904 for (n
= 0; n
< count
; n
++) {
906 if (HID_MAIN_ITEM_VARIABLE
& field
->flags
) {
907 hid_process_event(hid
, field
, &field
->usage
[n
], value
[n
], interrupt
);
911 if (field
->value
[n
] >= min
&& field
->value
[n
] <= max
912 && field
->usage
[field
->value
[n
] - min
].hid
913 && search(value
, field
->value
[n
], count
))
914 hid_process_event(hid
, field
, &field
->usage
[field
->value
[n
] - min
], 0, interrupt
);
916 if (value
[n
] >= min
&& value
[n
] <= max
917 && field
->usage
[value
[n
] - min
].hid
918 && search(field
->value
, value
[n
], count
))
919 hid_process_event(hid
, field
, &field
->usage
[value
[n
] - min
], 1, interrupt
);
922 memcpy(field
->value
, value
, count
* sizeof(__s32
));
928 * Output the field into the report.
931 static void hid_output_field(struct hid_field
*field
, __u8
*data
)
933 unsigned count
= field
->report_count
;
934 unsigned offset
= field
->report_offset
;
935 unsigned size
= field
->report_size
;
938 for (n
= 0; n
< count
; n
++) {
939 if (field
->logical_minimum
< 0) /* signed values */
940 implement(data
, offset
+ n
* size
, size
, s32ton(field
->value
[n
], size
));
941 else /* unsigned values */
942 implement(data
, offset
+ n
* size
, size
, field
->value
[n
]);
950 void hid_output_report(struct hid_report
*report
, __u8
*data
)
955 *data
++ = report
->id
;
957 memset(data
, 0, ((report
->size
- 1) >> 3) + 1);
958 for (n
= 0; n
< report
->maxfield
; n
++)
959 hid_output_field(report
->field
[n
], data
);
961 EXPORT_SYMBOL_GPL(hid_output_report
);
964 * Set a field value. The report this field belongs to has to be
965 * created and transferred to the device, to set this value in the
969 int hid_set_field(struct hid_field
*field
, unsigned offset
, __s32 value
)
971 unsigned size
= field
->report_size
;
973 hid_dump_input(field
->report
->device
, field
->usage
+ offset
, value
);
975 if (offset
>= field
->report_count
) {
976 dbg_hid("offset (%d) exceeds report_count (%d)\n", offset
, field
->report_count
);
979 if (field
->logical_minimum
< 0) {
980 if (value
!= snto32(s32ton(value
, size
), size
)) {
981 dbg_hid("value %d is out of range\n", value
);
985 field
->value
[offset
] = value
;
988 EXPORT_SYMBOL_GPL(hid_set_field
);
990 static struct hid_report
*hid_get_report(struct hid_report_enum
*report_enum
,
993 struct hid_report
*report
;
994 unsigned int n
= 0; /* Normally report number is 0 */
996 /* Device uses numbered reports, data[0] is report number */
997 if (report_enum
->numbered
)
1000 report
= report_enum
->report_id_hash
[n
];
1002 dbg_hid("undefined report_id %u received\n", n
);
1007 void hid_report_raw_event(struct hid_device
*hid
, int type
, u8
*data
, int size
,
1010 struct hid_report_enum
*report_enum
= hid
->report_enum
+ type
;
1011 struct hid_report
*report
;
1013 int rsize
, csize
= size
;
1016 report
= hid_get_report(report_enum
, data
);
1020 if (report_enum
->numbered
) {
1025 rsize
= ((report
->size
- 1) >> 3) + 1;
1027 if (csize
< rsize
) {
1028 dbg_hid("report %d is too short, (%d < %d)\n", report
->id
,
1030 memset(cdata
+ csize
, 0, rsize
- csize
);
1033 if ((hid
->claimed
& HID_CLAIMED_HIDDEV
) && hid
->hiddev_report_event
)
1034 hid
->hiddev_report_event(hid
, report
);
1035 if (hid
->claimed
& HID_CLAIMED_HIDRAW
)
1036 hidraw_report_event(hid
, data
, size
);
1038 for (a
= 0; a
< report
->maxfield
; a
++)
1039 hid_input_field(hid
, report
->field
[a
], cdata
, interrupt
);
1041 if (hid
->claimed
& HID_CLAIMED_INPUT
)
1042 hidinput_report_event(hid
, report
);
1044 EXPORT_SYMBOL_GPL(hid_report_raw_event
);
1047 * hid_input_report - report data from lower layer (usb, bt...)
1050 * @type: HID report type (HID_*_REPORT)
1051 * @data: report contents
1052 * @size: size of data parameter
1053 * @interrupt: distinguish between interrupt and control transfers
1055 * This is data entry for lower layers.
1057 int hid_input_report(struct hid_device
*hid
, int type
, u8
*data
, int size
, int interrupt
)
1059 struct hid_report_enum
*report_enum
;
1060 struct hid_driver
*hdrv
;
1061 struct hid_report
*report
;
1066 if (!hid
|| !hid
->driver
)
1068 report_enum
= hid
->report_enum
+ type
;
1072 dbg_hid("empty report\n");
1076 buf
= kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE
, GFP_ATOMIC
);
1081 /* dump the report */
1082 snprintf(buf
, HID_DEBUG_BUFSIZE
- 1,
1083 "\nreport (size %u) (%snumbered) = ", size
, report_enum
->numbered
? "" : "un");
1084 hid_debug_event(hid
, buf
);
1086 for (i
= 0; i
< size
; i
++) {
1087 snprintf(buf
, HID_DEBUG_BUFSIZE
- 1,
1089 hid_debug_event(hid
, buf
);
1091 hid_debug_event(hid
, "\n");
1095 report
= hid_get_report(report_enum
, data
);
1100 if (hdrv
&& hdrv
->raw_event
&& hid_match_report(hid
, report
)) {
1101 ret
= hdrv
->raw_event(hid
, report
, data
, size
);
1103 return ret
< 0 ? ret
: 0;
1106 hid_report_raw_event(hid
, type
, data
, size
, interrupt
);
1110 EXPORT_SYMBOL_GPL(hid_input_report
);
1112 static bool hid_match_one_id(struct hid_device
*hdev
,
1113 const struct hid_device_id
*id
)
1115 return id
->bus
== hdev
->bus
&&
1116 (id
->vendor
== HID_ANY_ID
|| id
->vendor
== hdev
->vendor
) &&
1117 (id
->product
== HID_ANY_ID
|| id
->product
== hdev
->product
);
1120 static const struct hid_device_id
*hid_match_id(struct hid_device
*hdev
,
1121 const struct hid_device_id
*id
)
1123 for (; id
->bus
; id
++)
1124 if (hid_match_one_id(hdev
, id
))
1130 static const struct hid_device_id hid_hiddev_list
[] = {
1131 { HID_USB_DEVICE(USB_VENDOR_ID_MGE
, USB_DEVICE_ID_MGE_UPS
) },
1132 { HID_USB_DEVICE(USB_VENDOR_ID_MGE
, USB_DEVICE_ID_MGE_UPS1
) },
1136 static bool hid_hiddev(struct hid_device
*hdev
)
1138 return !!hid_match_id(hdev
, hid_hiddev_list
);
1141 int hid_connect(struct hid_device
*hdev
, unsigned int connect_mask
)
1143 static const char *types
[] = { "Device", "Pointer", "Mouse", "Device",
1144 "Joystick", "Gamepad", "Keyboard", "Keypad",
1145 "Multi-Axis Controller"
1147 const char *type
, *bus
;
1152 if (hdev
->quirks
& HID_QUIRK_HIDDEV_FORCE
)
1153 connect_mask
|= (HID_CONNECT_HIDDEV_FORCE
| HID_CONNECT_HIDDEV
);
1154 if (hdev
->quirks
& HID_QUIRK_HIDINPUT_FORCE
)
1155 connect_mask
|= HID_CONNECT_HIDINPUT_FORCE
;
1156 if (hdev
->bus
!= BUS_USB
)
1157 connect_mask
&= ~HID_CONNECT_HIDDEV
;
1158 if (hid_hiddev(hdev
))
1159 connect_mask
|= HID_CONNECT_HIDDEV_FORCE
;
1161 if ((connect_mask
& HID_CONNECT_HIDINPUT
) && !hidinput_connect(hdev
,
1162 connect_mask
& HID_CONNECT_HIDINPUT_FORCE
))
1163 hdev
->claimed
|= HID_CLAIMED_INPUT
;
1164 if ((connect_mask
& HID_CONNECT_HIDDEV
) && hdev
->hiddev_connect
&&
1165 !hdev
->hiddev_connect(hdev
,
1166 connect_mask
& HID_CONNECT_HIDDEV_FORCE
))
1167 hdev
->claimed
|= HID_CLAIMED_HIDDEV
;
1168 if ((connect_mask
& HID_CONNECT_HIDRAW
) && !hidraw_connect(hdev
))
1169 hdev
->claimed
|= HID_CLAIMED_HIDRAW
;
1171 if (!hdev
->claimed
) {
1172 dev_err(&hdev
->dev
, "claimed by neither input, hiddev nor "
1177 if ((hdev
->claimed
& HID_CLAIMED_INPUT
) &&
1178 (connect_mask
& HID_CONNECT_FF
) && hdev
->ff_init
)
1179 hdev
->ff_init(hdev
);
1182 if (hdev
->claimed
& HID_CLAIMED_INPUT
)
1183 len
+= sprintf(buf
+ len
, "input");
1184 if (hdev
->claimed
& HID_CLAIMED_HIDDEV
)
1185 len
+= sprintf(buf
+ len
, "%shiddev%d", len
? "," : "",
1187 if (hdev
->claimed
& HID_CLAIMED_HIDRAW
)
1188 len
+= sprintf(buf
+ len
, "%shidraw%d", len
? "," : "",
1189 ((struct hidraw
*)hdev
->hidraw
)->minor
);
1192 for (i
= 0; i
< hdev
->maxcollection
; i
++) {
1193 struct hid_collection
*col
= &hdev
->collection
[i
];
1194 if (col
->type
== HID_COLLECTION_APPLICATION
&&
1195 (col
->usage
& HID_USAGE_PAGE
) == HID_UP_GENDESK
&&
1196 (col
->usage
& 0xffff) < ARRAY_SIZE(types
)) {
1197 type
= types
[col
->usage
& 0xffff];
1202 switch (hdev
->bus
) {
1213 dev_info(&hdev
->dev
, "%s: %s HID v%x.%02x %s [%s] on %s\n",
1214 buf
, bus
, hdev
->version
>> 8, hdev
->version
& 0xff,
1215 type
, hdev
->name
, hdev
->phys
);
1219 EXPORT_SYMBOL_GPL(hid_connect
);
1221 void hid_disconnect(struct hid_device
*hdev
)
1223 if (hdev
->claimed
& HID_CLAIMED_INPUT
)
1224 hidinput_disconnect(hdev
);
1225 if (hdev
->claimed
& HID_CLAIMED_HIDDEV
)
1226 hdev
->hiddev_disconnect(hdev
);
1227 if (hdev
->claimed
& HID_CLAIMED_HIDRAW
)
1228 hidraw_disconnect(hdev
);
1230 EXPORT_SYMBOL_GPL(hid_disconnect
);
1232 /* a list of devices for which there is a specialized driver on HID bus */
1233 static const struct hid_device_id hid_blacklist
[] = {
1234 { HID_USB_DEVICE(USB_VENDOR_ID_3M
, USB_DEVICE_ID_3M1968
) },
1235 { HID_USB_DEVICE(USB_VENDOR_ID_3M
, USB_DEVICE_ID_3M2256
) },
1236 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH
, USB_DEVICE_ID_A4TECH_WCP32PU
) },
1237 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH
, USB_DEVICE_ID_A4TECH_X5_005D
) },
1238 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH
, USB_DEVICE_ID_A4TECH_RP_649
) },
1239 #if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE)
1240 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX
, 0x0802) },
1242 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ATV_IRCONTROL
) },
1243 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_IRCONTROL4
) },
1244 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MIGHTYMOUSE
) },
1245 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGICMOUSE
) },
1246 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGICTRACKPAD
) },
1247 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI
) },
1248 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO
) },
1249 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ANSI
) },
1250 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ISO
) },
1251 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_JIS
) },
1252 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ANSI
) },
1253 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ISO
) },
1254 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_JIS
) },
1255 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ANSI
) },
1256 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ISO
) },
1257 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_JIS
) },
1258 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI
) },
1259 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_ISO
) },
1260 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_JIS
) },
1261 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_ANSI
) },
1262 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_ISO
) },
1263 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_JIS
) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI
) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO
) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS
) },
1267 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI
) },
1268 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO
) },
1269 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS
) },
1270 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI
) },
1271 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ISO
) },
1272 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_JIS
) },
1273 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI
) },
1274 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO
) },
1275 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS
) },
1276 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI
) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO
) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS
) },
1279 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI
) },
1280 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO
) },
1281 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS
) },
1282 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY
) },
1283 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY
) },
1284 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS
, USB_DEVICE_ID_ASUS_T91MT
) },
1285 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS
, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO
) },
1286 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN
, USB_DEVICE_ID_FLIP_KVM
) },
1287 { HID_USB_DEVICE(USB_VENDOR_ID_BTC
, USB_DEVICE_ID_BTC_EMPREX_REMOTE
) },
1288 { HID_USB_DEVICE(USB_VENDOR_ID_BTC
, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2
) },
1289 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH
) },
1290 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6
) },
1291 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO
, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6
) },
1292 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY
, USB_DEVICE_ID_CHERRY_CYMOTION
) },
1293 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY
, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR
) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_CHICONY_TACTICAL_PAD
) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS
, USB_DEVICE_ID_PRODIKEYS_PCMIDI
) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_1
) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_2
) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_BARCODE_3
) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_MOUSE
) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE
, 0x0006) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH
) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV
, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1
) },
1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM
, USB_DEVICE_ID_ELECOM_BM084
) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_EMS
, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II
) },
1305 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY
, USB_DEVICE_ID_BTC_8193
) },
1306 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON
, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR
) },
1307 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON
, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR
) },
1308 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA
, 0x0003) },
1309 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA
, 0x0012) },
1310 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE
) },
1311 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE_2
) },
1312 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION
, USB_DEVICE_ID_GYRATION_REMOTE_3
) },
1313 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON
, USB_DEVICE_ID_KS_SLIMBLADE
) },
1314 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_ERGO_525V
) },
1315 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC
, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD
) },
1316 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_MX3000_RECEIVER
) },
1317 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_S510_RECEIVER
) },
1318 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_S510_RECEIVER_2
) },
1319 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RECEIVER
) },
1320 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_DESKTOP
) },
1321 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_EDGE
) },
1322 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_DINOVO_MINI
) },
1323 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_ELITE_KBD
) },
1324 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500
) },
1325 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_EXTREME_3D
) },
1326 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WHEEL
) },
1327 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD
) },
1328 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD
) },
1329 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2
) },
1330 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D
) },
1331 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG
) },
1332 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO
) },
1333 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940
) },
1334 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL
) },
1335 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2
) },
1336 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_G25_WHEEL
) },
1337 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_WII_WHEEL
) },
1338 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2
) },
1339 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_SPACETRAVELLER
) },
1340 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH
, USB_DEVICE_ID_SPACENAVIGATOR
) },
1341 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICOLCD
) },
1342 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICOLCD_BOOTLOADER
) },
1343 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_SIDEWINDER_GV
) },
1344 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_NE4K
) },
1345 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_LK6K
) },
1346 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_PRESENTER_8K_USB
) },
1347 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0
) },
1348 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY
, USB_DEVICE_ID_GENIUS_KB29E
) },
1349 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN
) },
1350 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1
) },
1351 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2
) },
1352 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3
) },
1353 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4
) },
1354 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5
) },
1355 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6
) },
1356 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7
) },
1357 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8
) },
1358 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9
) },
1359 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10
) },
1360 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11
) },
1361 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12
) },
1362 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13
) },
1363 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14
) },
1364 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15
) },
1365 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16
) },
1366 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17
) },
1367 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG
, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18
) },
1368 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK
, USB_DEVICE_ID_ORTEK_WKB2000
) },
1369 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX
, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE
) },
1370 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH
) },
1371 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA
, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN
) },
1372 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_KONE
) },
1373 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_PYRA_WIRED
) },
1374 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG
, USB_DEVICE_ID_SAMSUNG_IR_REMOTE
) },
1375 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG
, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE
) },
1376 { HID_USB_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_PS3_CONTROLLER
) },
1377 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_PS3_CONTROLLER
) },
1378 { HID_USB_DEVICE(USB_VENDOR_ID_SONY
, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE
) },
1379 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM
, USB_DEVICE_ID_MTP
) },
1380 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM
, USB_DEVICE_ID_MTP_STM
) },
1381 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX
, USB_DEVICE_ID_MTP_SITRONIX
) },
1382 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS
, USB_DEVICE_ID_SUNPLUS_WDESKTOP
) },
1383 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb300) },
1384 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb304) },
1385 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb323) },
1386 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb324) },
1387 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb651) },
1388 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb653) },
1389 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER
, 0xb654) },
1390 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED
, USB_DEVICE_ID_TOPSEED_CYBERLINK
) },
1391 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2
, USB_DEVICE_ID_TOPSEED2_RF_COMBO
) },
1392 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN
, USB_DEVICE_ID_TWINHAN_IR_REMOTE
) },
1393 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209
) },
1394 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U
) },
1395 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U
) },
1396 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC
, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U
) },
1397 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_SMARTJOY_PLUS
) },
1398 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM
, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH
) },
1399 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH
) },
1400 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH
) },
1401 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH
) },
1402 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP
, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH
) },
1403 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS
, 0x0005) },
1404 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS
, 0x0030) },
1405 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON
, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL
) },
1407 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT
, USB_DEVICE_ID_MS_PRESENTER_8K_BT
) },
1412 struct list_head list
;
1413 struct hid_device_id id
;
1417 * store_new_id - add a new HID device ID to this driver and re-probe devices
1418 * @driver: target device driver
1419 * @buf: buffer for scanning device ID data
1420 * @count: input size
1422 * Adds a new dynamic hid device ID to this driver,
1423 * and causes the driver to probe for all devices again.
1425 static ssize_t
store_new_id(struct device_driver
*drv
, const char *buf
,
1428 struct hid_driver
*hdrv
= container_of(drv
, struct hid_driver
, driver
);
1429 struct hid_dynid
*dynid
;
1430 __u32 bus
, vendor
, product
;
1431 unsigned long driver_data
= 0;
1434 ret
= sscanf(buf
, "%x %x %x %lx",
1435 &bus
, &vendor
, &product
, &driver_data
);
1439 dynid
= kzalloc(sizeof(*dynid
), GFP_KERNEL
);
1443 dynid
->id
.bus
= bus
;
1444 dynid
->id
.vendor
= vendor
;
1445 dynid
->id
.product
= product
;
1446 dynid
->id
.driver_data
= driver_data
;
1448 spin_lock(&hdrv
->dyn_lock
);
1449 list_add_tail(&dynid
->list
, &hdrv
->dyn_list
);
1450 spin_unlock(&hdrv
->dyn_lock
);
1453 if (get_driver(&hdrv
->driver
)) {
1454 ret
= driver_attach(&hdrv
->driver
);
1455 put_driver(&hdrv
->driver
);
1458 return ret
? : count
;
1460 static DRIVER_ATTR(new_id
, S_IWUSR
, NULL
, store_new_id
);
1462 static void hid_free_dynids(struct hid_driver
*hdrv
)
1464 struct hid_dynid
*dynid
, *n
;
1466 spin_lock(&hdrv
->dyn_lock
);
1467 list_for_each_entry_safe(dynid
, n
, &hdrv
->dyn_list
, list
) {
1468 list_del(&dynid
->list
);
1471 spin_unlock(&hdrv
->dyn_lock
);
1474 static const struct hid_device_id
*hid_match_device(struct hid_device
*hdev
,
1475 struct hid_driver
*hdrv
)
1477 struct hid_dynid
*dynid
;
1479 spin_lock(&hdrv
->dyn_lock
);
1480 list_for_each_entry(dynid
, &hdrv
->dyn_list
, list
) {
1481 if (hid_match_one_id(hdev
, &dynid
->id
)) {
1482 spin_unlock(&hdrv
->dyn_lock
);
1486 spin_unlock(&hdrv
->dyn_lock
);
1488 return hid_match_id(hdev
, hdrv
->id_table
);
1491 static int hid_bus_match(struct device
*dev
, struct device_driver
*drv
)
1493 struct hid_driver
*hdrv
= container_of(drv
, struct hid_driver
, driver
);
1494 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1496 if (!hid_match_device(hdev
, hdrv
))
1499 /* generic wants all non-blacklisted */
1500 if (!strncmp(hdrv
->name
, "generic-", 8))
1501 return !hid_match_id(hdev
, hid_blacklist
);
1506 static int hid_device_probe(struct device
*dev
)
1508 struct hid_driver
*hdrv
= container_of(dev
->driver
,
1509 struct hid_driver
, driver
);
1510 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1511 const struct hid_device_id
*id
;
1514 if (!hdev
->driver
) {
1515 id
= hid_match_device(hdev
, hdrv
);
1519 hdev
->driver
= hdrv
;
1521 ret
= hdrv
->probe(hdev
, id
);
1522 } else { /* default probe */
1523 ret
= hid_parse(hdev
);
1525 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
1528 hdev
->driver
= NULL
;
1533 static int hid_device_remove(struct device
*dev
)
1535 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1536 struct hid_driver
*hdrv
= hdev
->driver
;
1541 else /* default remove */
1543 hdev
->driver
= NULL
;
1549 static int hid_uevent(struct device
*dev
, struct kobj_uevent_env
*env
)
1551 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1553 if (add_uevent_var(env
, "HID_ID=%04X:%08X:%08X",
1554 hdev
->bus
, hdev
->vendor
, hdev
->product
))
1557 if (add_uevent_var(env
, "HID_NAME=%s", hdev
->name
))
1560 if (add_uevent_var(env
, "HID_PHYS=%s", hdev
->phys
))
1563 if (add_uevent_var(env
, "HID_UNIQ=%s", hdev
->uniq
))
1566 if (add_uevent_var(env
, "MODALIAS=hid:b%04Xv%08Xp%08X",
1567 hdev
->bus
, hdev
->vendor
, hdev
->product
))
1573 static struct bus_type hid_bus_type
= {
1575 .match
= hid_bus_match
,
1576 .probe
= hid_device_probe
,
1577 .remove
= hid_device_remove
,
1578 .uevent
= hid_uevent
,
1581 /* a list of devices that shouldn't be handled by HID core at all */
1582 static const struct hid_device_id hid_ignore_list
[] = {
1583 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD
, USB_DEVICE_ID_ACECAD_FLAIR
) },
1584 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD
, USB_DEVICE_ID_ACECAD_302
) },
1585 { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH
, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X
) },
1586 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_01
) },
1587 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_10
) },
1588 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_20
) },
1589 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_21
) },
1590 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_22
) },
1591 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_23
) },
1592 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK
, USB_DEVICE_ID_AIPTEK_24
) },
1593 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE
, USB_DEVICE_ID_AIRCABLE1
) },
1594 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR
, USB_DEVICE_ID_ALCOR_USBRS232
) },
1595 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
, USB_DEVICE_ID_ASUSTEK_LCM
)},
1596 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
, USB_DEVICE_ID_ASUSTEK_LCM2
)},
1597 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA
, USB_DEVICE_ID_AVER_FM_MR800
) },
1598 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE
, USB_DEVICE_ID_BERKSHIRE_PCWD
) },
1599 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC
, 0x0103) },
1600 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL
, USB_DEVICE_ID_CYGNAL_RADIO_SI470X
) },
1601 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA
, USB_DEVICE_ID_CM109
) },
1602 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_HIDCOM
) },
1603 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS
, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE
) },
1604 { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME
, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701
) },
1605 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME
, USB_DEVICE_ID_DELORME_EARTHMATE
) },
1606 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME
, USB_DEVICE_ID_DELORME_EM_LT20
) },
1607 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY
, USB_DEVICE_ID_ESSENTIAL_REALITY_P5
) },
1608 { HID_USB_DEVICE(USB_VENDOR_ID_ETT
, USB_DEVICE_ID_TC5UH
) },
1609 { HID_USB_DEVICE(USB_VENDOR_ID_ETT
, USB_DEVICE_ID_TC4UM
) },
1610 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0001) },
1611 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0002) },
1612 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0003) },
1613 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH
, 0x0004) },
1614 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_4_PHIDGETSERVO_30
) },
1615 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_1_PHIDGETSERVO_30
) },
1616 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_0_4_IF_KIT
) },
1617 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_16_16_IF_KIT
) },
1618 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_8_8_8_IF_KIT
) },
1619 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_8_7_IF_KIT
) },
1620 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_0_8_8_IF_KIT
) },
1621 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB
, USB_DEVICE_ID_PHIDGET_MOTORCONTROL
) },
1622 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_SUPER_Q2
) },
1623 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_GOGOPEN
) },
1624 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP
, USB_DEVICE_ID_PENPOWER
) },
1625 { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH
, USB_DEVICE_ID_GRETAGMACBETH_HUEY
) },
1626 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN
, USB_DEVICE_ID_POWERMATE
) },
1627 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN
, USB_DEVICE_ID_SOUNDKNOB
) },
1628 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_90
) },
1629 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_100
) },
1630 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_101
) },
1631 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_103
) },
1632 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_104
) },
1633 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_105
) },
1634 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_106
) },
1635 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_107
) },
1636 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_108
) },
1637 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_200
) },
1638 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_201
) },
1639 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_202
) },
1640 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_203
) },
1641 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_204
) },
1642 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_205
) },
1643 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_206
) },
1644 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_207
) },
1645 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_300
) },
1646 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_301
) },
1647 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_302
) },
1648 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_303
) },
1649 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_304
) },
1650 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_305
) },
1651 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_306
) },
1652 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_307
) },
1653 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_308
) },
1654 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_309
) },
1655 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_400
) },
1656 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_401
) },
1657 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_402
) },
1658 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_403
) },
1659 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_404
) },
1660 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_405
) },
1661 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_500
) },
1662 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_501
) },
1663 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_502
) },
1664 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_503
) },
1665 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_504
) },
1666 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1000
) },
1667 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1001
) },
1668 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1002
) },
1669 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1003
) },
1670 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1004
) },
1671 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1005
) },
1672 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1006
) },
1673 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO
, USB_DEVICE_ID_GTCO_1007
) },
1674 { HID_USB_DEVICE(USB_VENDOR_ID_IMATION
, USB_DEVICE_ID_DISC_STAKKA
) },
1675 { HID_USB_DEVICE(USB_VENDOR_ID_JESS
, USB_DEVICE_ID_JESS_YUREX
) },
1676 { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR
, USB_DEVICE_ID_KBGEAR_JAMSTUDIO
) },
1677 { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD
, USB_DEVICE_ID_KWORLD_RADIO_FM700
) },
1678 { HID_USB_DEVICE(USB_VENDOR_ID_KYE
, USB_DEVICE_ID_KYE_GPEN_560
) },
1679 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE
, 0x0058) },
1680 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_CASSY
) },
1681 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_POCKETCASSY
) },
1682 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MOBILECASSY
) },
1683 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_JWM
) },
1684 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_DMMP
) },
1685 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_UMIP
) },
1686 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_XRAY1
) },
1687 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_XRAY2
) },
1688 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_VIDEOCOM
) },
1689 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_COM3LAB
) },
1690 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_TELEPORT
) },
1691 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_NETWORKANALYSER
) },
1692 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_POWERCONTROL
) },
1693 { HID_USB_DEVICE(USB_VENDOR_ID_LD
, USB_DEVICE_ID_LD_MACHINETEST
) },
1694 { HID_USB_DEVICE(USB_VENDOR_ID_MCC
, USB_DEVICE_ID_MCC_PMD1024LS
) },
1695 { HID_USB_DEVICE(USB_VENDOR_ID_MCC
, USB_DEVICE_ID_MCC_PMD1208LS
) },
1696 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICKIT1
) },
1697 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP
, USB_DEVICE_ID_PICKIT2
) },
1698 { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR
, USB_DEVICE_ID_N_S_HARMONY
) },
1699 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
) },
1700 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 20) },
1701 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 30) },
1702 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 100) },
1703 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 108) },
1704 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 118) },
1705 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 200) },
1706 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 300) },
1707 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 400) },
1708 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK
, USB_DEVICE_ID_ONTRAK_ADU100
+ 500) },
1709 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0001) },
1710 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0002) },
1711 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0003) },
1712 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT
, 0x0004) },
1713 { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS
, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE
) },
1714 { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM
, USB_DEVICE_ID_POWERCOM_UPS
) },
1715 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_LABPRO
) },
1716 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_GOTEMP
) },
1717 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_SKIP
) },
1718 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_CYCLOPS
) },
1719 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER
, USB_DEVICE_ID_VERNIER_LCSPEC
) },
1720 { HID_USB_DEVICE(USB_VENDOR_ID_WACOM
, HID_ANY_ID
) },
1721 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_4_PHIDGETSERVO_20
) },
1722 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_1_PHIDGETSERVO_20
) },
1723 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP
, USB_DEVICE_ID_8_8_4_IF_KIT
) },
1724 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK
, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K
) },
1729 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
1731 * There are composite devices for which we want to ignore only a certain
1732 * interface. This is a list of devices for which only the mouse interface will
1733 * be ignored. This allows a dedicated driver to take care of the interface.
1735 static const struct hid_device_id hid_mouse_ignore_list
[] = {
1736 /* appletouch driver */
1737 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI
) },
1738 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO
) },
1739 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ANSI
) },
1740 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ISO
) },
1741 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_JIS
) },
1742 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ANSI
) },
1743 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ISO
) },
1744 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_JIS
) },
1745 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ANSI
) },
1746 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ISO
) },
1747 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_JIS
) },
1748 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI
) },
1749 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO
) },
1750 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS
) },
1751 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI
) },
1752 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ISO
) },
1753 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_JIS
) },
1754 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI
) },
1755 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO
) },
1756 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS
) },
1757 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI
) },
1758 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO
) },
1759 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS
) },
1760 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY
) },
1761 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY
) },
1765 static bool hid_ignore(struct hid_device
*hdev
)
1767 switch (hdev
->vendor
) {
1768 case USB_VENDOR_ID_CODEMERCS
:
1769 /* ignore all Code Mercenaries IOWarrior devices */
1770 if (hdev
->product
>= USB_DEVICE_ID_CODEMERCS_IOW_FIRST
&&
1771 hdev
->product
<= USB_DEVICE_ID_CODEMERCS_IOW_LAST
)
1774 case USB_VENDOR_ID_LOGITECH
:
1775 if (hdev
->product
>= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST
&&
1776 hdev
->product
<= USB_DEVICE_ID_LOGITECH_HARMONY_LAST
)
1779 case USB_VENDOR_ID_SOUNDGRAPH
:
1780 if (hdev
->product
>= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST
&&
1781 hdev
->product
<= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST
)
1786 if (hdev
->type
== HID_TYPE_USBMOUSE
&&
1787 hid_match_id(hdev
, hid_mouse_ignore_list
))
1790 return !!hid_match_id(hdev
, hid_ignore_list
);
1793 int hid_add_device(struct hid_device
*hdev
)
1795 static atomic_t id
= ATOMIC_INIT(0);
1798 if (WARN_ON(hdev
->status
& HID_STAT_ADDED
))
1801 /* we need to kill them here, otherwise they will stay allocated to
1802 * wait for coming driver */
1803 if (!(hdev
->quirks
& HID_QUIRK_NO_IGNORE
)
1804 && (hid_ignore(hdev
) || (hdev
->quirks
& HID_QUIRK_IGNORE
)))
1807 /* XXX hack, any other cleaner solution after the driver core
1808 * is converted to allow more than 20 bytes as the device name? */
1809 dev_set_name(&hdev
->dev
, "%04X:%04X:%04X.%04X", hdev
->bus
,
1810 hdev
->vendor
, hdev
->product
, atomic_inc_return(&id
));
1812 hid_debug_register(hdev
, dev_name(&hdev
->dev
));
1813 ret
= device_add(&hdev
->dev
);
1815 hdev
->status
|= HID_STAT_ADDED
;
1817 hid_debug_unregister(hdev
);
1821 EXPORT_SYMBOL_GPL(hid_add_device
);
1824 * hid_allocate_device - allocate new hid device descriptor
1826 * Allocate and initialize hid device, so that hid_destroy_device might be
1829 * New hid_device pointer is returned on success, otherwise ERR_PTR encoded
1832 struct hid_device
*hid_allocate_device(void)
1834 struct hid_device
*hdev
;
1838 hdev
= kzalloc(sizeof(*hdev
), GFP_KERNEL
);
1840 return ERR_PTR(ret
);
1842 device_initialize(&hdev
->dev
);
1843 hdev
->dev
.release
= hid_device_release
;
1844 hdev
->dev
.bus
= &hid_bus_type
;
1846 hdev
->collection
= kcalloc(HID_DEFAULT_NUM_COLLECTIONS
,
1847 sizeof(struct hid_collection
), GFP_KERNEL
);
1848 if (hdev
->collection
== NULL
)
1850 hdev
->collection_size
= HID_DEFAULT_NUM_COLLECTIONS
;
1852 for (i
= 0; i
< HID_REPORT_TYPES
; i
++)
1853 INIT_LIST_HEAD(&hdev
->report_enum
[i
].report_list
);
1855 init_waitqueue_head(&hdev
->debug_wait
);
1856 INIT_LIST_HEAD(&hdev
->debug_list
);
1860 put_device(&hdev
->dev
);
1861 return ERR_PTR(ret
);
1863 EXPORT_SYMBOL_GPL(hid_allocate_device
);
1865 static void hid_remove_device(struct hid_device
*hdev
)
1867 if (hdev
->status
& HID_STAT_ADDED
) {
1868 device_del(&hdev
->dev
);
1869 hid_debug_unregister(hdev
);
1870 hdev
->status
&= ~HID_STAT_ADDED
;
1875 * hid_destroy_device - free previously allocated device
1879 * If you allocate hid_device through hid_allocate_device, you should ever
1880 * free by this function.
1882 void hid_destroy_device(struct hid_device
*hdev
)
1884 hid_remove_device(hdev
);
1885 put_device(&hdev
->dev
);
1887 EXPORT_SYMBOL_GPL(hid_destroy_device
);
1889 int __hid_register_driver(struct hid_driver
*hdrv
, struct module
*owner
,
1890 const char *mod_name
)
1894 hdrv
->driver
.name
= hdrv
->name
;
1895 hdrv
->driver
.bus
= &hid_bus_type
;
1896 hdrv
->driver
.owner
= owner
;
1897 hdrv
->driver
.mod_name
= mod_name
;
1899 INIT_LIST_HEAD(&hdrv
->dyn_list
);
1900 spin_lock_init(&hdrv
->dyn_lock
);
1902 ret
= driver_register(&hdrv
->driver
);
1906 ret
= driver_create_file(&hdrv
->driver
, &driver_attr_new_id
);
1908 driver_unregister(&hdrv
->driver
);
1912 EXPORT_SYMBOL_GPL(__hid_register_driver
);
1914 void hid_unregister_driver(struct hid_driver
*hdrv
)
1916 driver_remove_file(&hdrv
->driver
, &driver_attr_new_id
);
1917 driver_unregister(&hdrv
->driver
);
1918 hid_free_dynids(hdrv
);
1920 EXPORT_SYMBOL_GPL(hid_unregister_driver
);
1922 int hid_check_keys_pressed(struct hid_device
*hid
)
1924 struct hid_input
*hidinput
;
1927 if (!(hid
->claimed
& HID_CLAIMED_INPUT
))
1930 list_for_each_entry(hidinput
, &hid
->inputs
, list
) {
1931 for (i
= 0; i
< BITS_TO_LONGS(KEY_MAX
); i
++)
1932 if (hidinput
->input
->key
[i
])
1939 EXPORT_SYMBOL_GPL(hid_check_keys_pressed
);
1941 static int __init
hid_init(void)
1946 printk(KERN_WARNING
"HID: hid_debug is now used solely for parser and driver debugging.\n"
1947 "HID: debugfs is now used for inspecting the device (report descriptor, reports)\n");
1949 ret
= bus_register(&hid_bus_type
);
1951 printk(KERN_ERR
"HID: can't register hid bus\n");
1955 ret
= hidraw_init();
1963 bus_unregister(&hid_bus_type
);
1968 static void __exit
hid_exit(void)
1972 bus_unregister(&hid_bus_type
);
1975 module_init(hid_init
);
1976 module_exit(hid_exit
);
1978 MODULE_AUTHOR("Andreas Gal");
1979 MODULE_AUTHOR("Vojtech Pavlik");
1980 MODULE_AUTHOR("Jiri Kosina");
1981 MODULE_LICENSE(DRIVER_LICENSE
);