Commit 578f3a35fecabff49bad808c5301313f785b5462

Authored by Jiri Kosina
1 parent 06d2148ed3

HID: add USB ID for another dual gameron adapter

0x0810/0x0002 needs the very same handling as 0x0001.

Reported-by: Steve Conklin <sconklin@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Showing 3 changed files with 4 additions and 0 deletions Inline Diff

drivers/hid/hid-core.c
1 /* 1 /*
2 * HID support for Linux 2 * HID support for Linux
3 * 3 *
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina 7 * Copyright (c) 2006-2007 Jiri Kosina
8 */ 8 */
9 9
10 /* 10 /*
11 * This program is free software; you can redistribute it and/or modify it 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 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) 13 * Software Foundation; either version 2 of the License, or (at your option)
14 * any later version. 14 * any later version.
15 */ 15 */
16 16
17 #include <linux/module.h> 17 #include <linux/module.h>
18 #include <linux/slab.h> 18 #include <linux/slab.h>
19 #include <linux/init.h> 19 #include <linux/init.h>
20 #include <linux/kernel.h> 20 #include <linux/kernel.h>
21 #include <linux/list.h> 21 #include <linux/list.h>
22 #include <linux/mm.h> 22 #include <linux/mm.h>
23 #include <linux/spinlock.h> 23 #include <linux/spinlock.h>
24 #include <asm/unaligned.h> 24 #include <asm/unaligned.h>
25 #include <asm/byteorder.h> 25 #include <asm/byteorder.h>
26 #include <linux/input.h> 26 #include <linux/input.h>
27 #include <linux/wait.h> 27 #include <linux/wait.h>
28 #include <linux/vmalloc.h> 28 #include <linux/vmalloc.h>
29 #include <linux/sched.h> 29 #include <linux/sched.h>
30 30
31 #include <linux/hid.h> 31 #include <linux/hid.h>
32 #include <linux/hiddev.h> 32 #include <linux/hiddev.h>
33 #include <linux/hid-debug.h> 33 #include <linux/hid-debug.h>
34 #include <linux/hidraw.h> 34 #include <linux/hidraw.h>
35 35
36 #include "hid-ids.h" 36 #include "hid-ids.h"
37 37
38 /* 38 /*
39 * Version Information 39 * Version Information
40 */ 40 */
41 41
42 #define DRIVER_VERSION "v2.6" 42 #define DRIVER_VERSION "v2.6"
43 #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik, Jiri Kosina" 43 #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik, Jiri Kosina"
44 #define DRIVER_DESC "HID core driver" 44 #define DRIVER_DESC "HID core driver"
45 #define DRIVER_LICENSE "GPL" 45 #define DRIVER_LICENSE "GPL"
46 46
47 #ifdef CONFIG_HID_DEBUG 47 #ifdef CONFIG_HID_DEBUG
48 int hid_debug = 0; 48 int hid_debug = 0;
49 module_param_named(debug, hid_debug, int, 0600); 49 module_param_named(debug, hid_debug, int, 0600);
50 MODULE_PARM_DESC(debug, "HID debugging (0=off, 1=probing info, 2=continuous data dumping)"); 50 MODULE_PARM_DESC(debug, "HID debugging (0=off, 1=probing info, 2=continuous data dumping)");
51 EXPORT_SYMBOL_GPL(hid_debug); 51 EXPORT_SYMBOL_GPL(hid_debug);
52 #endif 52 #endif
53 53
54 /* 54 /*
55 * Register a new report for a device. 55 * Register a new report for a device.
56 */ 56 */
57 57
58 static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) 58 static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id)
59 { 59 {
60 struct hid_report_enum *report_enum = device->report_enum + type; 60 struct hid_report_enum *report_enum = device->report_enum + type;
61 struct hid_report *report; 61 struct hid_report *report;
62 62
63 if (report_enum->report_id_hash[id]) 63 if (report_enum->report_id_hash[id])
64 return report_enum->report_id_hash[id]; 64 return report_enum->report_id_hash[id];
65 65
66 if (!(report = kzalloc(sizeof(struct hid_report), GFP_KERNEL))) 66 if (!(report = kzalloc(sizeof(struct hid_report), GFP_KERNEL)))
67 return NULL; 67 return NULL;
68 68
69 if (id != 0) 69 if (id != 0)
70 report_enum->numbered = 1; 70 report_enum->numbered = 1;
71 71
72 report->id = id; 72 report->id = id;
73 report->type = type; 73 report->type = type;
74 report->size = 0; 74 report->size = 0;
75 report->device = device; 75 report->device = device;
76 report_enum->report_id_hash[id] = report; 76 report_enum->report_id_hash[id] = report;
77 77
78 list_add_tail(&report->list, &report_enum->report_list); 78 list_add_tail(&report->list, &report_enum->report_list);
79 79
80 return report; 80 return report;
81 } 81 }
82 82
83 /* 83 /*
84 * Register a new field for this report. 84 * Register a new field for this report.
85 */ 85 */
86 86
87 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) 87 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
88 { 88 {
89 struct hid_field *field; 89 struct hid_field *field;
90 90
91 if (report->maxfield == HID_MAX_FIELDS) { 91 if (report->maxfield == HID_MAX_FIELDS) {
92 dbg_hid("too many fields in report\n"); 92 dbg_hid("too many fields in report\n");
93 return NULL; 93 return NULL;
94 } 94 }
95 95
96 if (!(field = kzalloc(sizeof(struct hid_field) + usages * sizeof(struct hid_usage) 96 if (!(field = kzalloc(sizeof(struct hid_field) + usages * sizeof(struct hid_usage)
97 + values * sizeof(unsigned), GFP_KERNEL))) return NULL; 97 + values * sizeof(unsigned), GFP_KERNEL))) return NULL;
98 98
99 field->index = report->maxfield++; 99 field->index = report->maxfield++;
100 report->field[field->index] = field; 100 report->field[field->index] = field;
101 field->usage = (struct hid_usage *)(field + 1); 101 field->usage = (struct hid_usage *)(field + 1);
102 field->value = (s32 *)(field->usage + usages); 102 field->value = (s32 *)(field->usage + usages);
103 field->report = report; 103 field->report = report;
104 104
105 return field; 105 return field;
106 } 106 }
107 107
108 /* 108 /*
109 * Open a collection. The type/usage is pushed on the stack. 109 * Open a collection. The type/usage is pushed on the stack.
110 */ 110 */
111 111
112 static int open_collection(struct hid_parser *parser, unsigned type) 112 static int open_collection(struct hid_parser *parser, unsigned type)
113 { 113 {
114 struct hid_collection *collection; 114 struct hid_collection *collection;
115 unsigned usage; 115 unsigned usage;
116 116
117 usage = parser->local.usage[0]; 117 usage = parser->local.usage[0];
118 118
119 if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { 119 if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) {
120 dbg_hid("collection stack overflow\n"); 120 dbg_hid("collection stack overflow\n");
121 return -1; 121 return -1;
122 } 122 }
123 123
124 if (parser->device->maxcollection == parser->device->collection_size) { 124 if (parser->device->maxcollection == parser->device->collection_size) {
125 collection = kmalloc(sizeof(struct hid_collection) * 125 collection = kmalloc(sizeof(struct hid_collection) *
126 parser->device->collection_size * 2, GFP_KERNEL); 126 parser->device->collection_size * 2, GFP_KERNEL);
127 if (collection == NULL) { 127 if (collection == NULL) {
128 dbg_hid("failed to reallocate collection array\n"); 128 dbg_hid("failed to reallocate collection array\n");
129 return -1; 129 return -1;
130 } 130 }
131 memcpy(collection, parser->device->collection, 131 memcpy(collection, parser->device->collection,
132 sizeof(struct hid_collection) * 132 sizeof(struct hid_collection) *
133 parser->device->collection_size); 133 parser->device->collection_size);
134 memset(collection + parser->device->collection_size, 0, 134 memset(collection + parser->device->collection_size, 0,
135 sizeof(struct hid_collection) * 135 sizeof(struct hid_collection) *
136 parser->device->collection_size); 136 parser->device->collection_size);
137 kfree(parser->device->collection); 137 kfree(parser->device->collection);
138 parser->device->collection = collection; 138 parser->device->collection = collection;
139 parser->device->collection_size *= 2; 139 parser->device->collection_size *= 2;
140 } 140 }
141 141
142 parser->collection_stack[parser->collection_stack_ptr++] = 142 parser->collection_stack[parser->collection_stack_ptr++] =
143 parser->device->maxcollection; 143 parser->device->maxcollection;
144 144
145 collection = parser->device->collection + 145 collection = parser->device->collection +
146 parser->device->maxcollection++; 146 parser->device->maxcollection++;
147 collection->type = type; 147 collection->type = type;
148 collection->usage = usage; 148 collection->usage = usage;
149 collection->level = parser->collection_stack_ptr - 1; 149 collection->level = parser->collection_stack_ptr - 1;
150 150
151 if (type == HID_COLLECTION_APPLICATION) 151 if (type == HID_COLLECTION_APPLICATION)
152 parser->device->maxapplication++; 152 parser->device->maxapplication++;
153 153
154 return 0; 154 return 0;
155 } 155 }
156 156
157 /* 157 /*
158 * Close a collection. 158 * Close a collection.
159 */ 159 */
160 160
161 static int close_collection(struct hid_parser *parser) 161 static int close_collection(struct hid_parser *parser)
162 { 162 {
163 if (!parser->collection_stack_ptr) { 163 if (!parser->collection_stack_ptr) {
164 dbg_hid("collection stack underflow\n"); 164 dbg_hid("collection stack underflow\n");
165 return -1; 165 return -1;
166 } 166 }
167 parser->collection_stack_ptr--; 167 parser->collection_stack_ptr--;
168 return 0; 168 return 0;
169 } 169 }
170 170
171 /* 171 /*
172 * Climb up the stack, search for the specified collection type 172 * Climb up the stack, search for the specified collection type
173 * and return the usage. 173 * and return the usage.
174 */ 174 */
175 175
176 static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 176 static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
177 { 177 {
178 int n; 178 int n;
179 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) 179 for (n = parser->collection_stack_ptr - 1; n >= 0; n--)
180 if (parser->device->collection[parser->collection_stack[n]].type == type) 180 if (parser->device->collection[parser->collection_stack[n]].type == type)
181 return parser->device->collection[parser->collection_stack[n]].usage; 181 return parser->device->collection[parser->collection_stack[n]].usage;
182 return 0; /* we know nothing about this usage type */ 182 return 0; /* we know nothing about this usage type */
183 } 183 }
184 184
185 /* 185 /*
186 * Add a usage to the temporary parser table. 186 * Add a usage to the temporary parser table.
187 */ 187 */
188 188
189 static int hid_add_usage(struct hid_parser *parser, unsigned usage) 189 static int hid_add_usage(struct hid_parser *parser, unsigned usage)
190 { 190 {
191 if (parser->local.usage_index >= HID_MAX_USAGES) { 191 if (parser->local.usage_index >= HID_MAX_USAGES) {
192 dbg_hid("usage index exceeded\n"); 192 dbg_hid("usage index exceeded\n");
193 return -1; 193 return -1;
194 } 194 }
195 parser->local.usage[parser->local.usage_index] = usage; 195 parser->local.usage[parser->local.usage_index] = usage;
196 parser->local.collection_index[parser->local.usage_index] = 196 parser->local.collection_index[parser->local.usage_index] =
197 parser->collection_stack_ptr ? 197 parser->collection_stack_ptr ?
198 parser->collection_stack[parser->collection_stack_ptr - 1] : 0; 198 parser->collection_stack[parser->collection_stack_ptr - 1] : 0;
199 parser->local.usage_index++; 199 parser->local.usage_index++;
200 return 0; 200 return 0;
201 } 201 }
202 202
203 /* 203 /*
204 * Register a new field for this report. 204 * Register a new field for this report.
205 */ 205 */
206 206
207 static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) 207 static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags)
208 { 208 {
209 struct hid_report *report; 209 struct hid_report *report;
210 struct hid_field *field; 210 struct hid_field *field;
211 int usages; 211 int usages;
212 unsigned offset; 212 unsigned offset;
213 int i; 213 int i;
214 214
215 if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) { 215 if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) {
216 dbg_hid("hid_register_report failed\n"); 216 dbg_hid("hid_register_report failed\n");
217 return -1; 217 return -1;
218 } 218 }
219 219
220 if (parser->global.logical_maximum < parser->global.logical_minimum) { 220 if (parser->global.logical_maximum < parser->global.logical_minimum) {
221 dbg_hid("logical range invalid %d %d\n", parser->global.logical_minimum, parser->global.logical_maximum); 221 dbg_hid("logical range invalid %d %d\n", parser->global.logical_minimum, parser->global.logical_maximum);
222 return -1; 222 return -1;
223 } 223 }
224 224
225 offset = report->size; 225 offset = report->size;
226 report->size += parser->global.report_size * parser->global.report_count; 226 report->size += parser->global.report_size * parser->global.report_count;
227 227
228 if (!parser->local.usage_index) /* Ignore padding fields */ 228 if (!parser->local.usage_index) /* Ignore padding fields */
229 return 0; 229 return 0;
230 230
231 usages = max_t(int, parser->local.usage_index, parser->global.report_count); 231 usages = max_t(int, parser->local.usage_index, parser->global.report_count);
232 232
233 if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL) 233 if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL)
234 return 0; 234 return 0;
235 235
236 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); 236 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);
237 field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); 237 field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL);
238 field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); 238 field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);
239 239
240 for (i = 0; i < usages; i++) { 240 for (i = 0; i < usages; i++) {
241 int j = i; 241 int j = i;
242 /* Duplicate the last usage we parsed if we have excess values */ 242 /* Duplicate the last usage we parsed if we have excess values */
243 if (i >= parser->local.usage_index) 243 if (i >= parser->local.usage_index)
244 j = parser->local.usage_index - 1; 244 j = parser->local.usage_index - 1;
245 field->usage[i].hid = parser->local.usage[j]; 245 field->usage[i].hid = parser->local.usage[j];
246 field->usage[i].collection_index = 246 field->usage[i].collection_index =
247 parser->local.collection_index[j]; 247 parser->local.collection_index[j];
248 } 248 }
249 249
250 field->maxusage = usages; 250 field->maxusage = usages;
251 field->flags = flags; 251 field->flags = flags;
252 field->report_offset = offset; 252 field->report_offset = offset;
253 field->report_type = report_type; 253 field->report_type = report_type;
254 field->report_size = parser->global.report_size; 254 field->report_size = parser->global.report_size;
255 field->report_count = parser->global.report_count; 255 field->report_count = parser->global.report_count;
256 field->logical_minimum = parser->global.logical_minimum; 256 field->logical_minimum = parser->global.logical_minimum;
257 field->logical_maximum = parser->global.logical_maximum; 257 field->logical_maximum = parser->global.logical_maximum;
258 field->physical_minimum = parser->global.physical_minimum; 258 field->physical_minimum = parser->global.physical_minimum;
259 field->physical_maximum = parser->global.physical_maximum; 259 field->physical_maximum = parser->global.physical_maximum;
260 field->unit_exponent = parser->global.unit_exponent; 260 field->unit_exponent = parser->global.unit_exponent;
261 field->unit = parser->global.unit; 261 field->unit = parser->global.unit;
262 262
263 return 0; 263 return 0;
264 } 264 }
265 265
266 /* 266 /*
267 * Read data value from item. 267 * Read data value from item.
268 */ 268 */
269 269
270 static u32 item_udata(struct hid_item *item) 270 static u32 item_udata(struct hid_item *item)
271 { 271 {
272 switch (item->size) { 272 switch (item->size) {
273 case 1: return item->data.u8; 273 case 1: return item->data.u8;
274 case 2: return item->data.u16; 274 case 2: return item->data.u16;
275 case 4: return item->data.u32; 275 case 4: return item->data.u32;
276 } 276 }
277 return 0; 277 return 0;
278 } 278 }
279 279
280 static s32 item_sdata(struct hid_item *item) 280 static s32 item_sdata(struct hid_item *item)
281 { 281 {
282 switch (item->size) { 282 switch (item->size) {
283 case 1: return item->data.s8; 283 case 1: return item->data.s8;
284 case 2: return item->data.s16; 284 case 2: return item->data.s16;
285 case 4: return item->data.s32; 285 case 4: return item->data.s32;
286 } 286 }
287 return 0; 287 return 0;
288 } 288 }
289 289
290 /* 290 /*
291 * Process a global item. 291 * Process a global item.
292 */ 292 */
293 293
294 static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) 294 static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
295 { 295 {
296 switch (item->tag) { 296 switch (item->tag) {
297 case HID_GLOBAL_ITEM_TAG_PUSH: 297 case HID_GLOBAL_ITEM_TAG_PUSH:
298 298
299 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { 299 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) {
300 dbg_hid("global enviroment stack overflow\n"); 300 dbg_hid("global enviroment stack overflow\n");
301 return -1; 301 return -1;
302 } 302 }
303 303
304 memcpy(parser->global_stack + parser->global_stack_ptr++, 304 memcpy(parser->global_stack + parser->global_stack_ptr++,
305 &parser->global, sizeof(struct hid_global)); 305 &parser->global, sizeof(struct hid_global));
306 return 0; 306 return 0;
307 307
308 case HID_GLOBAL_ITEM_TAG_POP: 308 case HID_GLOBAL_ITEM_TAG_POP:
309 309
310 if (!parser->global_stack_ptr) { 310 if (!parser->global_stack_ptr) {
311 dbg_hid("global enviroment stack underflow\n"); 311 dbg_hid("global enviroment stack underflow\n");
312 return -1; 312 return -1;
313 } 313 }
314 314
315 memcpy(&parser->global, parser->global_stack + 315 memcpy(&parser->global, parser->global_stack +
316 --parser->global_stack_ptr, sizeof(struct hid_global)); 316 --parser->global_stack_ptr, sizeof(struct hid_global));
317 return 0; 317 return 0;
318 318
319 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: 319 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:
320 parser->global.usage_page = item_udata(item); 320 parser->global.usage_page = item_udata(item);
321 return 0; 321 return 0;
322 322
323 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: 323 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM:
324 parser->global.logical_minimum = item_sdata(item); 324 parser->global.logical_minimum = item_sdata(item);
325 return 0; 325 return 0;
326 326
327 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: 327 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM:
328 if (parser->global.logical_minimum < 0) 328 if (parser->global.logical_minimum < 0)
329 parser->global.logical_maximum = item_sdata(item); 329 parser->global.logical_maximum = item_sdata(item);
330 else 330 else
331 parser->global.logical_maximum = item_udata(item); 331 parser->global.logical_maximum = item_udata(item);
332 return 0; 332 return 0;
333 333
334 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: 334 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM:
335 parser->global.physical_minimum = item_sdata(item); 335 parser->global.physical_minimum = item_sdata(item);
336 return 0; 336 return 0;
337 337
338 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: 338 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM:
339 if (parser->global.physical_minimum < 0) 339 if (parser->global.physical_minimum < 0)
340 parser->global.physical_maximum = item_sdata(item); 340 parser->global.physical_maximum = item_sdata(item);
341 else 341 else
342 parser->global.physical_maximum = item_udata(item); 342 parser->global.physical_maximum = item_udata(item);
343 return 0; 343 return 0;
344 344
345 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: 345 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT:
346 parser->global.unit_exponent = item_sdata(item); 346 parser->global.unit_exponent = item_sdata(item);
347 return 0; 347 return 0;
348 348
349 case HID_GLOBAL_ITEM_TAG_UNIT: 349 case HID_GLOBAL_ITEM_TAG_UNIT:
350 parser->global.unit = item_udata(item); 350 parser->global.unit = item_udata(item);
351 return 0; 351 return 0;
352 352
353 case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: 353 case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
354 parser->global.report_size = item_udata(item); 354 parser->global.report_size = item_udata(item);
355 if (parser->global.report_size > 32) { 355 if (parser->global.report_size > 32) {
356 dbg_hid("invalid report_size %d\n", 356 dbg_hid("invalid report_size %d\n",
357 parser->global.report_size); 357 parser->global.report_size);
358 return -1; 358 return -1;
359 } 359 }
360 return 0; 360 return 0;
361 361
362 case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: 362 case HID_GLOBAL_ITEM_TAG_REPORT_COUNT:
363 parser->global.report_count = item_udata(item); 363 parser->global.report_count = item_udata(item);
364 if (parser->global.report_count > HID_MAX_USAGES) { 364 if (parser->global.report_count > HID_MAX_USAGES) {
365 dbg_hid("invalid report_count %d\n", 365 dbg_hid("invalid report_count %d\n",
366 parser->global.report_count); 366 parser->global.report_count);
367 return -1; 367 return -1;
368 } 368 }
369 return 0; 369 return 0;
370 370
371 case HID_GLOBAL_ITEM_TAG_REPORT_ID: 371 case HID_GLOBAL_ITEM_TAG_REPORT_ID:
372 parser->global.report_id = item_udata(item); 372 parser->global.report_id = item_udata(item);
373 if (parser->global.report_id == 0) { 373 if (parser->global.report_id == 0) {
374 dbg_hid("report_id 0 is invalid\n"); 374 dbg_hid("report_id 0 is invalid\n");
375 return -1; 375 return -1;
376 } 376 }
377 return 0; 377 return 0;
378 378
379 default: 379 default:
380 dbg_hid("unknown global tag 0x%x\n", item->tag); 380 dbg_hid("unknown global tag 0x%x\n", item->tag);
381 return -1; 381 return -1;
382 } 382 }
383 } 383 }
384 384
385 /* 385 /*
386 * Process a local item. 386 * Process a local item.
387 */ 387 */
388 388
389 static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) 389 static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
390 { 390 {
391 __u32 data; 391 __u32 data;
392 unsigned n; 392 unsigned n;
393 393
394 if (item->size == 0) { 394 if (item->size == 0) {
395 dbg_hid("item data expected for local item\n"); 395 dbg_hid("item data expected for local item\n");
396 return -1; 396 return -1;
397 } 397 }
398 398
399 data = item_udata(item); 399 data = item_udata(item);
400 400
401 switch (item->tag) { 401 switch (item->tag) {
402 case HID_LOCAL_ITEM_TAG_DELIMITER: 402 case HID_LOCAL_ITEM_TAG_DELIMITER:
403 403
404 if (data) { 404 if (data) {
405 /* 405 /*
406 * We treat items before the first delimiter 406 * We treat items before the first delimiter
407 * as global to all usage sets (branch 0). 407 * as global to all usage sets (branch 0).
408 * In the moment we process only these global 408 * In the moment we process only these global
409 * items and the first delimiter set. 409 * items and the first delimiter set.
410 */ 410 */
411 if (parser->local.delimiter_depth != 0) { 411 if (parser->local.delimiter_depth != 0) {
412 dbg_hid("nested delimiters\n"); 412 dbg_hid("nested delimiters\n");
413 return -1; 413 return -1;
414 } 414 }
415 parser->local.delimiter_depth++; 415 parser->local.delimiter_depth++;
416 parser->local.delimiter_branch++; 416 parser->local.delimiter_branch++;
417 } else { 417 } else {
418 if (parser->local.delimiter_depth < 1) { 418 if (parser->local.delimiter_depth < 1) {
419 dbg_hid("bogus close delimiter\n"); 419 dbg_hid("bogus close delimiter\n");
420 return -1; 420 return -1;
421 } 421 }
422 parser->local.delimiter_depth--; 422 parser->local.delimiter_depth--;
423 } 423 }
424 return 1; 424 return 1;
425 425
426 case HID_LOCAL_ITEM_TAG_USAGE: 426 case HID_LOCAL_ITEM_TAG_USAGE:
427 427
428 if (parser->local.delimiter_branch > 1) { 428 if (parser->local.delimiter_branch > 1) {
429 dbg_hid("alternative usage ignored\n"); 429 dbg_hid("alternative usage ignored\n");
430 return 0; 430 return 0;
431 } 431 }
432 432
433 if (item->size <= 2) 433 if (item->size <= 2)
434 data = (parser->global.usage_page << 16) + data; 434 data = (parser->global.usage_page << 16) + data;
435 435
436 return hid_add_usage(parser, data); 436 return hid_add_usage(parser, data);
437 437
438 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: 438 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
439 439
440 if (parser->local.delimiter_branch > 1) { 440 if (parser->local.delimiter_branch > 1) {
441 dbg_hid("alternative usage ignored\n"); 441 dbg_hid("alternative usage ignored\n");
442 return 0; 442 return 0;
443 } 443 }
444 444
445 if (item->size <= 2) 445 if (item->size <= 2)
446 data = (parser->global.usage_page << 16) + data; 446 data = (parser->global.usage_page << 16) + data;
447 447
448 parser->local.usage_minimum = data; 448 parser->local.usage_minimum = data;
449 return 0; 449 return 0;
450 450
451 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: 451 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
452 452
453 if (parser->local.delimiter_branch > 1) { 453 if (parser->local.delimiter_branch > 1) {
454 dbg_hid("alternative usage ignored\n"); 454 dbg_hid("alternative usage ignored\n");
455 return 0; 455 return 0;
456 } 456 }
457 457
458 if (item->size <= 2) 458 if (item->size <= 2)
459 data = (parser->global.usage_page << 16) + data; 459 data = (parser->global.usage_page << 16) + data;
460 460
461 for (n = parser->local.usage_minimum; n <= data; n++) 461 for (n = parser->local.usage_minimum; n <= data; n++)
462 if (hid_add_usage(parser, n)) { 462 if (hid_add_usage(parser, n)) {
463 dbg_hid("hid_add_usage failed\n"); 463 dbg_hid("hid_add_usage failed\n");
464 return -1; 464 return -1;
465 } 465 }
466 return 0; 466 return 0;
467 467
468 default: 468 default:
469 469
470 dbg_hid("unknown local item tag 0x%x\n", item->tag); 470 dbg_hid("unknown local item tag 0x%x\n", item->tag);
471 return 0; 471 return 0;
472 } 472 }
473 return 0; 473 return 0;
474 } 474 }
475 475
476 /* 476 /*
477 * Process a main item. 477 * Process a main item.
478 */ 478 */
479 479
480 static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) 480 static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
481 { 481 {
482 __u32 data; 482 __u32 data;
483 int ret; 483 int ret;
484 484
485 data = item_udata(item); 485 data = item_udata(item);
486 486
487 switch (item->tag) { 487 switch (item->tag) {
488 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: 488 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION:
489 ret = open_collection(parser, data & 0xff); 489 ret = open_collection(parser, data & 0xff);
490 break; 490 break;
491 case HID_MAIN_ITEM_TAG_END_COLLECTION: 491 case HID_MAIN_ITEM_TAG_END_COLLECTION:
492 ret = close_collection(parser); 492 ret = close_collection(parser);
493 break; 493 break;
494 case HID_MAIN_ITEM_TAG_INPUT: 494 case HID_MAIN_ITEM_TAG_INPUT:
495 ret = hid_add_field(parser, HID_INPUT_REPORT, data); 495 ret = hid_add_field(parser, HID_INPUT_REPORT, data);
496 break; 496 break;
497 case HID_MAIN_ITEM_TAG_OUTPUT: 497 case HID_MAIN_ITEM_TAG_OUTPUT:
498 ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); 498 ret = hid_add_field(parser, HID_OUTPUT_REPORT, data);
499 break; 499 break;
500 case HID_MAIN_ITEM_TAG_FEATURE: 500 case HID_MAIN_ITEM_TAG_FEATURE:
501 ret = hid_add_field(parser, HID_FEATURE_REPORT, data); 501 ret = hid_add_field(parser, HID_FEATURE_REPORT, data);
502 break; 502 break;
503 default: 503 default:
504 dbg_hid("unknown main item tag 0x%x\n", item->tag); 504 dbg_hid("unknown main item tag 0x%x\n", item->tag);
505 ret = 0; 505 ret = 0;
506 } 506 }
507 507
508 memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ 508 memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */
509 509
510 return ret; 510 return ret;
511 } 511 }
512 512
513 /* 513 /*
514 * Process a reserved item. 514 * Process a reserved item.
515 */ 515 */
516 516
517 static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) 517 static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item)
518 { 518 {
519 dbg_hid("reserved item type, tag 0x%x\n", item->tag); 519 dbg_hid("reserved item type, tag 0x%x\n", item->tag);
520 return 0; 520 return 0;
521 } 521 }
522 522
523 /* 523 /*
524 * Free a report and all registered fields. The field->usage and 524 * Free a report and all registered fields. The field->usage and
525 * field->value table's are allocated behind the field, so we need 525 * field->value table's are allocated behind the field, so we need
526 * only to free(field) itself. 526 * only to free(field) itself.
527 */ 527 */
528 528
529 static void hid_free_report(struct hid_report *report) 529 static void hid_free_report(struct hid_report *report)
530 { 530 {
531 unsigned n; 531 unsigned n;
532 532
533 for (n = 0; n < report->maxfield; n++) 533 for (n = 0; n < report->maxfield; n++)
534 kfree(report->field[n]); 534 kfree(report->field[n]);
535 kfree(report); 535 kfree(report);
536 } 536 }
537 537
538 /* 538 /*
539 * Free a device structure, all reports, and all fields. 539 * Free a device structure, all reports, and all fields.
540 */ 540 */
541 541
542 static void hid_device_release(struct device *dev) 542 static void hid_device_release(struct device *dev)
543 { 543 {
544 struct hid_device *device = container_of(dev, struct hid_device, dev); 544 struct hid_device *device = container_of(dev, struct hid_device, dev);
545 unsigned i, j; 545 unsigned i, j;
546 546
547 for (i = 0; i < HID_REPORT_TYPES; i++) { 547 for (i = 0; i < HID_REPORT_TYPES; i++) {
548 struct hid_report_enum *report_enum = device->report_enum + i; 548 struct hid_report_enum *report_enum = device->report_enum + i;
549 549
550 for (j = 0; j < 256; j++) { 550 for (j = 0; j < 256; j++) {
551 struct hid_report *report = report_enum->report_id_hash[j]; 551 struct hid_report *report = report_enum->report_id_hash[j];
552 if (report) 552 if (report)
553 hid_free_report(report); 553 hid_free_report(report);
554 } 554 }
555 } 555 }
556 556
557 kfree(device->rdesc); 557 kfree(device->rdesc);
558 kfree(device->collection); 558 kfree(device->collection);
559 kfree(device); 559 kfree(device);
560 } 560 }
561 561
562 /* 562 /*
563 * Fetch a report description item from the data stream. We support long 563 * Fetch a report description item from the data stream. We support long
564 * items, though they are not used yet. 564 * items, though they are not used yet.
565 */ 565 */
566 566
567 static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) 567 static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
568 { 568 {
569 u8 b; 569 u8 b;
570 570
571 if ((end - start) <= 0) 571 if ((end - start) <= 0)
572 return NULL; 572 return NULL;
573 573
574 b = *start++; 574 b = *start++;
575 575
576 item->type = (b >> 2) & 3; 576 item->type = (b >> 2) & 3;
577 item->tag = (b >> 4) & 15; 577 item->tag = (b >> 4) & 15;
578 578
579 if (item->tag == HID_ITEM_TAG_LONG) { 579 if (item->tag == HID_ITEM_TAG_LONG) {
580 580
581 item->format = HID_ITEM_FORMAT_LONG; 581 item->format = HID_ITEM_FORMAT_LONG;
582 582
583 if ((end - start) < 2) 583 if ((end - start) < 2)
584 return NULL; 584 return NULL;
585 585
586 item->size = *start++; 586 item->size = *start++;
587 item->tag = *start++; 587 item->tag = *start++;
588 588
589 if ((end - start) < item->size) 589 if ((end - start) < item->size)
590 return NULL; 590 return NULL;
591 591
592 item->data.longdata = start; 592 item->data.longdata = start;
593 start += item->size; 593 start += item->size;
594 return start; 594 return start;
595 } 595 }
596 596
597 item->format = HID_ITEM_FORMAT_SHORT; 597 item->format = HID_ITEM_FORMAT_SHORT;
598 item->size = b & 3; 598 item->size = b & 3;
599 599
600 switch (item->size) { 600 switch (item->size) {
601 case 0: 601 case 0:
602 return start; 602 return start;
603 603
604 case 1: 604 case 1:
605 if ((end - start) < 1) 605 if ((end - start) < 1)
606 return NULL; 606 return NULL;
607 item->data.u8 = *start++; 607 item->data.u8 = *start++;
608 return start; 608 return start;
609 609
610 case 2: 610 case 2:
611 if ((end - start) < 2) 611 if ((end - start) < 2)
612 return NULL; 612 return NULL;
613 item->data.u16 = get_unaligned_le16(start); 613 item->data.u16 = get_unaligned_le16(start);
614 start = (__u8 *)((__le16 *)start + 1); 614 start = (__u8 *)((__le16 *)start + 1);
615 return start; 615 return start;
616 616
617 case 3: 617 case 3:
618 item->size++; 618 item->size++;
619 if ((end - start) < 4) 619 if ((end - start) < 4)
620 return NULL; 620 return NULL;
621 item->data.u32 = get_unaligned_le32(start); 621 item->data.u32 = get_unaligned_le32(start);
622 start = (__u8 *)((__le32 *)start + 1); 622 start = (__u8 *)((__le32 *)start + 1);
623 return start; 623 return start;
624 } 624 }
625 625
626 return NULL; 626 return NULL;
627 } 627 }
628 628
629 /** 629 /**
630 * hid_parse_report - parse device report 630 * hid_parse_report - parse device report
631 * 631 *
632 * @device: hid device 632 * @device: hid device
633 * @start: report start 633 * @start: report start
634 * @size: report size 634 * @size: report size
635 * 635 *
636 * Parse a report description into a hid_device structure. Reports are 636 * Parse a report description into a hid_device structure. Reports are
637 * enumerated, fields are attached to these reports. 637 * enumerated, fields are attached to these reports.
638 * 0 returned on success, otherwise nonzero error value. 638 * 0 returned on success, otherwise nonzero error value.
639 */ 639 */
640 int hid_parse_report(struct hid_device *device, __u8 *start, 640 int hid_parse_report(struct hid_device *device, __u8 *start,
641 unsigned size) 641 unsigned size)
642 { 642 {
643 struct hid_parser *parser; 643 struct hid_parser *parser;
644 struct hid_item item; 644 struct hid_item item;
645 __u8 *end; 645 __u8 *end;
646 int ret; 646 int ret;
647 static int (*dispatch_type[])(struct hid_parser *parser, 647 static int (*dispatch_type[])(struct hid_parser *parser,
648 struct hid_item *item) = { 648 struct hid_item *item) = {
649 hid_parser_main, 649 hid_parser_main,
650 hid_parser_global, 650 hid_parser_global,
651 hid_parser_local, 651 hid_parser_local,
652 hid_parser_reserved 652 hid_parser_reserved
653 }; 653 };
654 654
655 if (device->driver->report_fixup) 655 if (device->driver->report_fixup)
656 device->driver->report_fixup(device, start, size); 656 device->driver->report_fixup(device, start, size);
657 657
658 device->rdesc = kmalloc(size, GFP_KERNEL); 658 device->rdesc = kmalloc(size, GFP_KERNEL);
659 if (device->rdesc == NULL) 659 if (device->rdesc == NULL)
660 return -ENOMEM; 660 return -ENOMEM;
661 memcpy(device->rdesc, start, size); 661 memcpy(device->rdesc, start, size);
662 device->rsize = size; 662 device->rsize = size;
663 663
664 parser = vmalloc(sizeof(struct hid_parser)); 664 parser = vmalloc(sizeof(struct hid_parser));
665 if (!parser) { 665 if (!parser) {
666 ret = -ENOMEM; 666 ret = -ENOMEM;
667 goto err; 667 goto err;
668 } 668 }
669 669
670 memset(parser, 0, sizeof(struct hid_parser)); 670 memset(parser, 0, sizeof(struct hid_parser));
671 parser->device = device; 671 parser->device = device;
672 672
673 end = start + size; 673 end = start + size;
674 ret = -EINVAL; 674 ret = -EINVAL;
675 while ((start = fetch_item(start, end, &item)) != NULL) { 675 while ((start = fetch_item(start, end, &item)) != NULL) {
676 676
677 if (item.format != HID_ITEM_FORMAT_SHORT) { 677 if (item.format != HID_ITEM_FORMAT_SHORT) {
678 dbg_hid("unexpected long global item\n"); 678 dbg_hid("unexpected long global item\n");
679 goto err; 679 goto err;
680 } 680 }
681 681
682 if (dispatch_type[item.type](parser, &item)) { 682 if (dispatch_type[item.type](parser, &item)) {
683 dbg_hid("item %u %u %u %u parsing failed\n", 683 dbg_hid("item %u %u %u %u parsing failed\n",
684 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 684 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag);
685 goto err; 685 goto err;
686 } 686 }
687 687
688 if (start == end) { 688 if (start == end) {
689 if (parser->collection_stack_ptr) { 689 if (parser->collection_stack_ptr) {
690 dbg_hid("unbalanced collection at end of report description\n"); 690 dbg_hid("unbalanced collection at end of report description\n");
691 goto err; 691 goto err;
692 } 692 }
693 if (parser->local.delimiter_depth) { 693 if (parser->local.delimiter_depth) {
694 dbg_hid("unbalanced delimiter at end of report description\n"); 694 dbg_hid("unbalanced delimiter at end of report description\n");
695 goto err; 695 goto err;
696 } 696 }
697 vfree(parser); 697 vfree(parser);
698 return 0; 698 return 0;
699 } 699 }
700 } 700 }
701 701
702 dbg_hid("item fetching failed at offset %d\n", (int)(end - start)); 702 dbg_hid("item fetching failed at offset %d\n", (int)(end - start));
703 err: 703 err:
704 vfree(parser); 704 vfree(parser);
705 return ret; 705 return ret;
706 } 706 }
707 EXPORT_SYMBOL_GPL(hid_parse_report); 707 EXPORT_SYMBOL_GPL(hid_parse_report);
708 708
709 /* 709 /*
710 * Convert a signed n-bit integer to signed 32-bit integer. Common 710 * Convert a signed n-bit integer to signed 32-bit integer. Common
711 * cases are done through the compiler, the screwed things has to be 711 * cases are done through the compiler, the screwed things has to be
712 * done by hand. 712 * done by hand.
713 */ 713 */
714 714
715 static s32 snto32(__u32 value, unsigned n) 715 static s32 snto32(__u32 value, unsigned n)
716 { 716 {
717 switch (n) { 717 switch (n) {
718 case 8: return ((__s8)value); 718 case 8: return ((__s8)value);
719 case 16: return ((__s16)value); 719 case 16: return ((__s16)value);
720 case 32: return ((__s32)value); 720 case 32: return ((__s32)value);
721 } 721 }
722 return value & (1 << (n - 1)) ? value | (-1 << n) : value; 722 return value & (1 << (n - 1)) ? value | (-1 << n) : value;
723 } 723 }
724 724
725 /* 725 /*
726 * Convert a signed 32-bit integer to a signed n-bit integer. 726 * Convert a signed 32-bit integer to a signed n-bit integer.
727 */ 727 */
728 728
729 static u32 s32ton(__s32 value, unsigned n) 729 static u32 s32ton(__s32 value, unsigned n)
730 { 730 {
731 s32 a = value >> (n - 1); 731 s32 a = value >> (n - 1);
732 if (a && a != -1) 732 if (a && a != -1)
733 return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; 733 return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
734 return value & ((1 << n) - 1); 734 return value & ((1 << n) - 1);
735 } 735 }
736 736
737 /* 737 /*
738 * Extract/implement a data field from/to a little endian report (bit array). 738 * Extract/implement a data field from/to a little endian report (bit array).
739 * 739 *
740 * Code sort-of follows HID spec: 740 * Code sort-of follows HID spec:
741 * http://www.usb.org/developers/devclass_docs/HID1_11.pdf 741 * http://www.usb.org/developers/devclass_docs/HID1_11.pdf
742 * 742 *
743 * While the USB HID spec allows unlimited length bit fields in "report 743 * While the USB HID spec allows unlimited length bit fields in "report
744 * descriptors", most devices never use more than 16 bits. 744 * descriptors", most devices never use more than 16 bits.
745 * One model of UPS is claimed to report "LINEV" as a 32-bit field. 745 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
746 * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 746 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
747 */ 747 */
748 748
749 static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) 749 static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
750 { 750 {
751 u64 x; 751 u64 x;
752 752
753 if (n > 32) 753 if (n > 32)
754 printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n", 754 printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n",
755 n, current->comm); 755 n, current->comm);
756 756
757 report += offset >> 3; /* adjust byte index */ 757 report += offset >> 3; /* adjust byte index */
758 offset &= 7; /* now only need bit offset into one byte */ 758 offset &= 7; /* now only need bit offset into one byte */
759 x = get_unaligned_le64(report); 759 x = get_unaligned_le64(report);
760 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ 760 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */
761 return (u32) x; 761 return (u32) x;
762 } 762 }
763 763
764 /* 764 /*
765 * "implement" : set bits in a little endian bit stream. 765 * "implement" : set bits in a little endian bit stream.
766 * Same concepts as "extract" (see comments above). 766 * Same concepts as "extract" (see comments above).
767 * The data mangled in the bit stream remains in little endian 767 * The data mangled in the bit stream remains in little endian
768 * order the whole time. It make more sense to talk about 768 * order the whole time. It make more sense to talk about
769 * endianness of register values by considering a register 769 * endianness of register values by considering a register
770 * a "cached" copy of the little endiad bit stream. 770 * a "cached" copy of the little endiad bit stream.
771 */ 771 */
772 static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 772 static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value)
773 { 773 {
774 u64 x; 774 u64 x;
775 u64 m = (1ULL << n) - 1; 775 u64 m = (1ULL << n) - 1;
776 776
777 if (n > 32) 777 if (n > 32)
778 printk(KERN_WARNING "HID: implement() called with n (%d) > 32! (%s)\n", 778 printk(KERN_WARNING "HID: implement() called with n (%d) > 32! (%s)\n",
779 n, current->comm); 779 n, current->comm);
780 780
781 if (value > m) 781 if (value > m)
782 printk(KERN_WARNING "HID: implement() called with too large value %d! (%s)\n", 782 printk(KERN_WARNING "HID: implement() called with too large value %d! (%s)\n",
783 value, current->comm); 783 value, current->comm);
784 WARN_ON(value > m); 784 WARN_ON(value > m);
785 value &= m; 785 value &= m;
786 786
787 report += offset >> 3; 787 report += offset >> 3;
788 offset &= 7; 788 offset &= 7;
789 789
790 x = get_unaligned_le64(report); 790 x = get_unaligned_le64(report);
791 x &= ~(m << offset); 791 x &= ~(m << offset);
792 x |= ((u64)value) << offset; 792 x |= ((u64)value) << offset;
793 put_unaligned_le64(x, report); 793 put_unaligned_le64(x, report);
794 } 794 }
795 795
796 /* 796 /*
797 * Search an array for a value. 797 * Search an array for a value.
798 */ 798 */
799 799
800 static __inline__ int search(__s32 *array, __s32 value, unsigned n) 800 static __inline__ int search(__s32 *array, __s32 value, unsigned n)
801 { 801 {
802 while (n--) { 802 while (n--) {
803 if (*array++ == value) 803 if (*array++ == value)
804 return 0; 804 return 0;
805 } 805 }
806 return -1; 806 return -1;
807 } 807 }
808 808
809 /** 809 /**
810 * hid_match_report - check if driver's raw_event should be called 810 * hid_match_report - check if driver's raw_event should be called
811 * 811 *
812 * @hid: hid device 812 * @hid: hid device
813 * @report_type: type to match against 813 * @report_type: type to match against
814 * 814 *
815 * compare hid->driver->report_table->report_type to report->type 815 * compare hid->driver->report_table->report_type to report->type
816 */ 816 */
817 static int hid_match_report(struct hid_device *hid, struct hid_report *report) 817 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
818 { 818 {
819 const struct hid_report_id *id = hid->driver->report_table; 819 const struct hid_report_id *id = hid->driver->report_table;
820 820
821 if (!id) /* NULL means all */ 821 if (!id) /* NULL means all */
822 return 1; 822 return 1;
823 823
824 for (; id->report_type != HID_TERMINATOR; id++) 824 for (; id->report_type != HID_TERMINATOR; id++)
825 if (id->report_type == HID_ANY_ID || 825 if (id->report_type == HID_ANY_ID ||
826 id->report_type == report->type) 826 id->report_type == report->type)
827 return 1; 827 return 1;
828 return 0; 828 return 0;
829 } 829 }
830 830
831 /** 831 /**
832 * hid_match_usage - check if driver's event should be called 832 * hid_match_usage - check if driver's event should be called
833 * 833 *
834 * @hid: hid device 834 * @hid: hid device
835 * @usage: usage to match against 835 * @usage: usage to match against
836 * 836 *
837 * compare hid->driver->usage_table->usage_{type,code} to 837 * compare hid->driver->usage_table->usage_{type,code} to
838 * usage->usage_{type,code} 838 * usage->usage_{type,code}
839 */ 839 */
840 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) 840 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
841 { 841 {
842 const struct hid_usage_id *id = hid->driver->usage_table; 842 const struct hid_usage_id *id = hid->driver->usage_table;
843 843
844 if (!id) /* NULL means all */ 844 if (!id) /* NULL means all */
845 return 1; 845 return 1;
846 846
847 for (; id->usage_type != HID_ANY_ID - 1; id++) 847 for (; id->usage_type != HID_ANY_ID - 1; id++)
848 if ((id->usage_hid == HID_ANY_ID || 848 if ((id->usage_hid == HID_ANY_ID ||
849 id->usage_hid == usage->hid) && 849 id->usage_hid == usage->hid) &&
850 (id->usage_type == HID_ANY_ID || 850 (id->usage_type == HID_ANY_ID ||
851 id->usage_type == usage->type) && 851 id->usage_type == usage->type) &&
852 (id->usage_code == HID_ANY_ID || 852 (id->usage_code == HID_ANY_ID ||
853 id->usage_code == usage->code)) 853 id->usage_code == usage->code))
854 return 1; 854 return 1;
855 return 0; 855 return 0;
856 } 856 }
857 857
858 static void hid_process_event(struct hid_device *hid, struct hid_field *field, 858 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
859 struct hid_usage *usage, __s32 value, int interrupt) 859 struct hid_usage *usage, __s32 value, int interrupt)
860 { 860 {
861 struct hid_driver *hdrv = hid->driver; 861 struct hid_driver *hdrv = hid->driver;
862 int ret; 862 int ret;
863 863
864 hid_dump_input(usage, value); 864 hid_dump_input(usage, value);
865 865
866 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { 866 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
867 ret = hdrv->event(hid, field, usage, value); 867 ret = hdrv->event(hid, field, usage, value);
868 if (ret != 0) { 868 if (ret != 0) {
869 if (ret < 0) 869 if (ret < 0)
870 dbg_hid("%s's event failed with %d\n", 870 dbg_hid("%s's event failed with %d\n",
871 hdrv->name, ret); 871 hdrv->name, ret);
872 return; 872 return;
873 } 873 }
874 } 874 }
875 875
876 if (hid->claimed & HID_CLAIMED_INPUT) 876 if (hid->claimed & HID_CLAIMED_INPUT)
877 hidinput_hid_event(hid, field, usage, value); 877 hidinput_hid_event(hid, field, usage, value);
878 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) 878 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
879 hid->hiddev_hid_event(hid, field, usage, value); 879 hid->hiddev_hid_event(hid, field, usage, value);
880 } 880 }
881 881
882 /* 882 /*
883 * Analyse a received field, and fetch the data from it. The field 883 * Analyse a received field, and fetch the data from it. The field
884 * content is stored for next report processing (we do differential 884 * content is stored for next report processing (we do differential
885 * reporting to the layer). 885 * reporting to the layer).
886 */ 886 */
887 887
888 static void hid_input_field(struct hid_device *hid, struct hid_field *field, 888 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
889 __u8 *data, int interrupt) 889 __u8 *data, int interrupt)
890 { 890 {
891 unsigned n; 891 unsigned n;
892 unsigned count = field->report_count; 892 unsigned count = field->report_count;
893 unsigned offset = field->report_offset; 893 unsigned offset = field->report_offset;
894 unsigned size = field->report_size; 894 unsigned size = field->report_size;
895 __s32 min = field->logical_minimum; 895 __s32 min = field->logical_minimum;
896 __s32 max = field->logical_maximum; 896 __s32 max = field->logical_maximum;
897 __s32 *value; 897 __s32 *value;
898 898
899 if (!(value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC))) 899 if (!(value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC)))
900 return; 900 return;
901 901
902 for (n = 0; n < count; n++) { 902 for (n = 0; n < count; n++) {
903 903
904 value[n] = min < 0 ? snto32(extract(data, offset + n * size, size), size) : 904 value[n] = min < 0 ? snto32(extract(data, offset + n * size, size), size) :
905 extract(data, offset + n * size, size); 905 extract(data, offset + n * size, size);
906 906
907 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) /* Ignore report if ErrorRollOver */ 907 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) /* Ignore report if ErrorRollOver */
908 && value[n] >= min && value[n] <= max 908 && value[n] >= min && value[n] <= max
909 && field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) 909 && field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
910 goto exit; 910 goto exit;
911 } 911 }
912 912
913 for (n = 0; n < count; n++) { 913 for (n = 0; n < count; n++) {
914 914
915 if (HID_MAIN_ITEM_VARIABLE & field->flags) { 915 if (HID_MAIN_ITEM_VARIABLE & field->flags) {
916 hid_process_event(hid, field, &field->usage[n], value[n], interrupt); 916 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
917 continue; 917 continue;
918 } 918 }
919 919
920 if (field->value[n] >= min && field->value[n] <= max 920 if (field->value[n] >= min && field->value[n] <= max
921 && field->usage[field->value[n] - min].hid 921 && field->usage[field->value[n] - min].hid
922 && search(value, field->value[n], count)) 922 && search(value, field->value[n], count))
923 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); 923 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
924 924
925 if (value[n] >= min && value[n] <= max 925 if (value[n] >= min && value[n] <= max
926 && field->usage[value[n] - min].hid 926 && field->usage[value[n] - min].hid
927 && search(field->value, value[n], count)) 927 && search(field->value, value[n], count))
928 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); 928 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
929 } 929 }
930 930
931 memcpy(field->value, value, count * sizeof(__s32)); 931 memcpy(field->value, value, count * sizeof(__s32));
932 exit: 932 exit:
933 kfree(value); 933 kfree(value);
934 } 934 }
935 935
936 /* 936 /*
937 * Output the field into the report. 937 * Output the field into the report.
938 */ 938 */
939 939
940 static void hid_output_field(struct hid_field *field, __u8 *data) 940 static void hid_output_field(struct hid_field *field, __u8 *data)
941 { 941 {
942 unsigned count = field->report_count; 942 unsigned count = field->report_count;
943 unsigned offset = field->report_offset; 943 unsigned offset = field->report_offset;
944 unsigned size = field->report_size; 944 unsigned size = field->report_size;
945 unsigned bitsused = offset + count * size; 945 unsigned bitsused = offset + count * size;
946 unsigned n; 946 unsigned n;
947 947
948 /* make sure the unused bits in the last byte are zeros */ 948 /* make sure the unused bits in the last byte are zeros */
949 if (count > 0 && size > 0 && (bitsused % 8) != 0) 949 if (count > 0 && size > 0 && (bitsused % 8) != 0)
950 data[(bitsused-1)/8] &= (1 << (bitsused % 8)) - 1; 950 data[(bitsused-1)/8] &= (1 << (bitsused % 8)) - 1;
951 951
952 for (n = 0; n < count; n++) { 952 for (n = 0; n < count; n++) {
953 if (field->logical_minimum < 0) /* signed values */ 953 if (field->logical_minimum < 0) /* signed values */
954 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 954 implement(data, offset + n * size, size, s32ton(field->value[n], size));
955 else /* unsigned values */ 955 else /* unsigned values */
956 implement(data, offset + n * size, size, field->value[n]); 956 implement(data, offset + n * size, size, field->value[n]);
957 } 957 }
958 } 958 }
959 959
960 /* 960 /*
961 * Create a report. 961 * Create a report.
962 */ 962 */
963 963
964 void hid_output_report(struct hid_report *report, __u8 *data) 964 void hid_output_report(struct hid_report *report, __u8 *data)
965 { 965 {
966 unsigned n; 966 unsigned n;
967 967
968 if (report->id > 0) 968 if (report->id > 0)
969 *data++ = report->id; 969 *data++ = report->id;
970 970
971 for (n = 0; n < report->maxfield; n++) 971 for (n = 0; n < report->maxfield; n++)
972 hid_output_field(report->field[n], data); 972 hid_output_field(report->field[n], data);
973 } 973 }
974 EXPORT_SYMBOL_GPL(hid_output_report); 974 EXPORT_SYMBOL_GPL(hid_output_report);
975 975
976 /* 976 /*
977 * Set a field value. The report this field belongs to has to be 977 * Set a field value. The report this field belongs to has to be
978 * created and transferred to the device, to set this value in the 978 * created and transferred to the device, to set this value in the
979 * device. 979 * device.
980 */ 980 */
981 981
982 int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) 982 int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
983 { 983 {
984 unsigned size = field->report_size; 984 unsigned size = field->report_size;
985 985
986 hid_dump_input(field->usage + offset, value); 986 hid_dump_input(field->usage + offset, value);
987 987
988 if (offset >= field->report_count) { 988 if (offset >= field->report_count) {
989 dbg_hid("offset (%d) exceeds report_count (%d)\n", offset, field->report_count); 989 dbg_hid("offset (%d) exceeds report_count (%d)\n", offset, field->report_count);
990 hid_dump_field(field, 8); 990 hid_dump_field(field, 8);
991 return -1; 991 return -1;
992 } 992 }
993 if (field->logical_minimum < 0) { 993 if (field->logical_minimum < 0) {
994 if (value != snto32(s32ton(value, size), size)) { 994 if (value != snto32(s32ton(value, size), size)) {
995 dbg_hid("value %d is out of range\n", value); 995 dbg_hid("value %d is out of range\n", value);
996 return -1; 996 return -1;
997 } 997 }
998 } 998 }
999 field->value[offset] = value; 999 field->value[offset] = value;
1000 return 0; 1000 return 0;
1001 } 1001 }
1002 EXPORT_SYMBOL_GPL(hid_set_field); 1002 EXPORT_SYMBOL_GPL(hid_set_field);
1003 1003
1004 static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, 1004 static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
1005 const u8 *data) 1005 const u8 *data)
1006 { 1006 {
1007 struct hid_report *report; 1007 struct hid_report *report;
1008 unsigned int n = 0; /* Normally report number is 0 */ 1008 unsigned int n = 0; /* Normally report number is 0 */
1009 1009
1010 /* Device uses numbered reports, data[0] is report number */ 1010 /* Device uses numbered reports, data[0] is report number */
1011 if (report_enum->numbered) 1011 if (report_enum->numbered)
1012 n = *data; 1012 n = *data;
1013 1013
1014 report = report_enum->report_id_hash[n]; 1014 report = report_enum->report_id_hash[n];
1015 if (report == NULL) 1015 if (report == NULL)
1016 dbg_hid("undefined report_id %u received\n", n); 1016 dbg_hid("undefined report_id %u received\n", n);
1017 1017
1018 return report; 1018 return report;
1019 } 1019 }
1020 1020
1021 void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 1021 void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1022 int interrupt) 1022 int interrupt)
1023 { 1023 {
1024 struct hid_report_enum *report_enum = hid->report_enum + type; 1024 struct hid_report_enum *report_enum = hid->report_enum + type;
1025 struct hid_report *report; 1025 struct hid_report *report;
1026 unsigned int a; 1026 unsigned int a;
1027 int rsize, csize = size; 1027 int rsize, csize = size;
1028 u8 *cdata = data; 1028 u8 *cdata = data;
1029 1029
1030 report = hid_get_report(report_enum, data); 1030 report = hid_get_report(report_enum, data);
1031 if (!report) 1031 if (!report)
1032 return; 1032 return;
1033 1033
1034 if (report_enum->numbered) { 1034 if (report_enum->numbered) {
1035 cdata++; 1035 cdata++;
1036 csize--; 1036 csize--;
1037 } 1037 }
1038 1038
1039 rsize = ((report->size - 1) >> 3) + 1; 1039 rsize = ((report->size - 1) >> 3) + 1;
1040 1040
1041 if (csize < rsize) { 1041 if (csize < rsize) {
1042 dbg_hid("report %d is too short, (%d < %d)\n", report->id, 1042 dbg_hid("report %d is too short, (%d < %d)\n", report->id,
1043 csize, rsize); 1043 csize, rsize);
1044 memset(cdata + csize, 0, rsize - csize); 1044 memset(cdata + csize, 0, rsize - csize);
1045 } 1045 }
1046 1046
1047 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 1047 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1048 hid->hiddev_report_event(hid, report); 1048 hid->hiddev_report_event(hid, report);
1049 if (hid->claimed & HID_CLAIMED_HIDRAW) { 1049 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1050 /* numbered reports need to be passed with the report num */ 1050 /* numbered reports need to be passed with the report num */
1051 if (report_enum->numbered) 1051 if (report_enum->numbered)
1052 hidraw_report_event(hid, data - 1, size + 1); 1052 hidraw_report_event(hid, data - 1, size + 1);
1053 else 1053 else
1054 hidraw_report_event(hid, data, size); 1054 hidraw_report_event(hid, data, size);
1055 } 1055 }
1056 1056
1057 for (a = 0; a < report->maxfield; a++) 1057 for (a = 0; a < report->maxfield; a++)
1058 hid_input_field(hid, report->field[a], cdata, interrupt); 1058 hid_input_field(hid, report->field[a], cdata, interrupt);
1059 1059
1060 if (hid->claimed & HID_CLAIMED_INPUT) 1060 if (hid->claimed & HID_CLAIMED_INPUT)
1061 hidinput_report_event(hid, report); 1061 hidinput_report_event(hid, report);
1062 } 1062 }
1063 EXPORT_SYMBOL_GPL(hid_report_raw_event); 1063 EXPORT_SYMBOL_GPL(hid_report_raw_event);
1064 1064
1065 /** 1065 /**
1066 * hid_input_report - report data from lower layer (usb, bt...) 1066 * hid_input_report - report data from lower layer (usb, bt...)
1067 * 1067 *
1068 * @hid: hid device 1068 * @hid: hid device
1069 * @type: HID report type (HID_*_REPORT) 1069 * @type: HID report type (HID_*_REPORT)
1070 * @data: report contents 1070 * @data: report contents
1071 * @size: size of data parameter 1071 * @size: size of data parameter
1072 * @interrupt: called from atomic? 1072 * @interrupt: called from atomic?
1073 * 1073 *
1074 * This is data entry for lower layers. 1074 * This is data entry for lower layers.
1075 */ 1075 */
1076 int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) 1076 int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
1077 { 1077 {
1078 struct hid_report_enum *report_enum = hid->report_enum + type; 1078 struct hid_report_enum *report_enum = hid->report_enum + type;
1079 struct hid_driver *hdrv = hid->driver; 1079 struct hid_driver *hdrv = hid->driver;
1080 struct hid_report *report; 1080 struct hid_report *report;
1081 unsigned int i; 1081 unsigned int i;
1082 int ret; 1082 int ret;
1083 1083
1084 if (!hid || !hid->driver) 1084 if (!hid || !hid->driver)
1085 return -ENODEV; 1085 return -ENODEV;
1086 1086
1087 if (!size) { 1087 if (!size) {
1088 dbg_hid("empty report\n"); 1088 dbg_hid("empty report\n");
1089 return -1; 1089 return -1;
1090 } 1090 }
1091 1091
1092 dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); 1092 dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un");
1093 1093
1094 report = hid_get_report(report_enum, data); 1094 report = hid_get_report(report_enum, data);
1095 if (!report) 1095 if (!report)
1096 return -1; 1096 return -1;
1097 1097
1098 /* dump the report */ 1098 /* dump the report */
1099 dbg_hid("report %d (size %u) = ", report->id, size); 1099 dbg_hid("report %d (size %u) = ", report->id, size);
1100 for (i = 0; i < size; i++) 1100 for (i = 0; i < size; i++)
1101 dbg_hid_line(" %02x", data[i]); 1101 dbg_hid_line(" %02x", data[i]);
1102 dbg_hid_line("\n"); 1102 dbg_hid_line("\n");
1103 1103
1104 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { 1104 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1105 ret = hdrv->raw_event(hid, report, data, size); 1105 ret = hdrv->raw_event(hid, report, data, size);
1106 if (ret != 0) 1106 if (ret != 0)
1107 return ret < 0 ? ret : 0; 1107 return ret < 0 ? ret : 0;
1108 } 1108 }
1109 1109
1110 hid_report_raw_event(hid, type, data, size, interrupt); 1110 hid_report_raw_event(hid, type, data, size, interrupt);
1111 1111
1112 return 0; 1112 return 0;
1113 } 1113 }
1114 EXPORT_SYMBOL_GPL(hid_input_report); 1114 EXPORT_SYMBOL_GPL(hid_input_report);
1115 1115
1116 static bool hid_match_one_id(struct hid_device *hdev, 1116 static bool hid_match_one_id(struct hid_device *hdev,
1117 const struct hid_device_id *id) 1117 const struct hid_device_id *id)
1118 { 1118 {
1119 return id->bus == hdev->bus && 1119 return id->bus == hdev->bus &&
1120 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && 1120 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) &&
1121 (id->product == HID_ANY_ID || id->product == hdev->product); 1121 (id->product == HID_ANY_ID || id->product == hdev->product);
1122 } 1122 }
1123 1123
1124 static const struct hid_device_id *hid_match_id(struct hid_device *hdev, 1124 static const struct hid_device_id *hid_match_id(struct hid_device *hdev,
1125 const struct hid_device_id *id) 1125 const struct hid_device_id *id)
1126 { 1126 {
1127 for (; id->bus; id++) 1127 for (; id->bus; id++)
1128 if (hid_match_one_id(hdev, id)) 1128 if (hid_match_one_id(hdev, id))
1129 return id; 1129 return id;
1130 1130
1131 return NULL; 1131 return NULL;
1132 } 1132 }
1133 1133
1134 static const struct hid_device_id hid_hiddev_list[] = { 1134 static const struct hid_device_id hid_hiddev_list[] = {
1135 { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, 1135 { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) },
1136 { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, 1136 { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) },
1137 { } 1137 { }
1138 }; 1138 };
1139 1139
1140 static bool hid_hiddev(struct hid_device *hdev) 1140 static bool hid_hiddev(struct hid_device *hdev)
1141 { 1141 {
1142 return !!hid_match_id(hdev, hid_hiddev_list); 1142 return !!hid_match_id(hdev, hid_hiddev_list);
1143 } 1143 }
1144 1144
1145 int hid_connect(struct hid_device *hdev, unsigned int connect_mask) 1145 int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1146 { 1146 {
1147 static const char *types[] = { "Device", "Pointer", "Mouse", "Device", 1147 static const char *types[] = { "Device", "Pointer", "Mouse", "Device",
1148 "Joystick", "Gamepad", "Keyboard", "Keypad", 1148 "Joystick", "Gamepad", "Keyboard", "Keypad",
1149 "Multi-Axis Controller" 1149 "Multi-Axis Controller"
1150 }; 1150 };
1151 const char *type, *bus; 1151 const char *type, *bus;
1152 char buf[64]; 1152 char buf[64];
1153 unsigned int i; 1153 unsigned int i;
1154 int len; 1154 int len;
1155 1155
1156 if (hdev->bus != BUS_USB) 1156 if (hdev->bus != BUS_USB)
1157 connect_mask &= ~HID_CONNECT_HIDDEV; 1157 connect_mask &= ~HID_CONNECT_HIDDEV;
1158 if (hid_hiddev(hdev)) 1158 if (hid_hiddev(hdev))
1159 connect_mask |= HID_CONNECT_HIDDEV_FORCE; 1159 connect_mask |= HID_CONNECT_HIDDEV_FORCE;
1160 1160
1161 if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, 1161 if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev,
1162 connect_mask & HID_CONNECT_HIDINPUT_FORCE)) 1162 connect_mask & HID_CONNECT_HIDINPUT_FORCE))
1163 hdev->claimed |= HID_CLAIMED_INPUT; 1163 hdev->claimed |= HID_CLAIMED_INPUT;
1164 if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && 1164 if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect &&
1165 !hdev->hiddev_connect(hdev, 1165 !hdev->hiddev_connect(hdev,
1166 connect_mask & HID_CONNECT_HIDDEV_FORCE)) 1166 connect_mask & HID_CONNECT_HIDDEV_FORCE))
1167 hdev->claimed |= HID_CLAIMED_HIDDEV; 1167 hdev->claimed |= HID_CLAIMED_HIDDEV;
1168 if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) 1168 if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev))
1169 hdev->claimed |= HID_CLAIMED_HIDRAW; 1169 hdev->claimed |= HID_CLAIMED_HIDRAW;
1170 1170
1171 if (!hdev->claimed) { 1171 if (!hdev->claimed) {
1172 dev_err(&hdev->dev, "claimed by neither input, hiddev nor " 1172 dev_err(&hdev->dev, "claimed by neither input, hiddev nor "
1173 "hidraw\n"); 1173 "hidraw\n");
1174 return -ENODEV; 1174 return -ENODEV;
1175 } 1175 }
1176 1176
1177 if ((hdev->claimed & HID_CLAIMED_INPUT) && 1177 if ((hdev->claimed & HID_CLAIMED_INPUT) &&
1178 (connect_mask & HID_CONNECT_FF) && hdev->ff_init) 1178 (connect_mask & HID_CONNECT_FF) && hdev->ff_init)
1179 hdev->ff_init(hdev); 1179 hdev->ff_init(hdev);
1180 1180
1181 len = 0; 1181 len = 0;
1182 if (hdev->claimed & HID_CLAIMED_INPUT) 1182 if (hdev->claimed & HID_CLAIMED_INPUT)
1183 len += sprintf(buf + len, "input"); 1183 len += sprintf(buf + len, "input");
1184 if (hdev->claimed & HID_CLAIMED_HIDDEV) 1184 if (hdev->claimed & HID_CLAIMED_HIDDEV)
1185 len += sprintf(buf + len, "%shiddev%d", len ? "," : "", 1185 len += sprintf(buf + len, "%shiddev%d", len ? "," : "",
1186 hdev->minor); 1186 hdev->minor);
1187 if (hdev->claimed & HID_CLAIMED_HIDRAW) 1187 if (hdev->claimed & HID_CLAIMED_HIDRAW)
1188 len += sprintf(buf + len, "%shidraw%d", len ? "," : "", 1188 len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
1189 ((struct hidraw *)hdev->hidraw)->minor); 1189 ((struct hidraw *)hdev->hidraw)->minor);
1190 1190
1191 type = "Device"; 1191 type = "Device";
1192 for (i = 0; i < hdev->maxcollection; i++) { 1192 for (i = 0; i < hdev->maxcollection; i++) {
1193 struct hid_collection *col = &hdev->collection[i]; 1193 struct hid_collection *col = &hdev->collection[i];
1194 if (col->type == HID_COLLECTION_APPLICATION && 1194 if (col->type == HID_COLLECTION_APPLICATION &&
1195 (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && 1195 (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK &&
1196 (col->usage & 0xffff) < ARRAY_SIZE(types)) { 1196 (col->usage & 0xffff) < ARRAY_SIZE(types)) {
1197 type = types[col->usage & 0xffff]; 1197 type = types[col->usage & 0xffff];
1198 break; 1198 break;
1199 } 1199 }
1200 } 1200 }
1201 1201
1202 switch (hdev->bus) { 1202 switch (hdev->bus) {
1203 case BUS_USB: 1203 case BUS_USB:
1204 bus = "USB"; 1204 bus = "USB";
1205 break; 1205 break;
1206 case BUS_BLUETOOTH: 1206 case BUS_BLUETOOTH:
1207 bus = "BLUETOOTH"; 1207 bus = "BLUETOOTH";
1208 break; 1208 break;
1209 default: 1209 default:
1210 bus = "<UNKNOWN>"; 1210 bus = "<UNKNOWN>";
1211 } 1211 }
1212 1212
1213 dev_info(&hdev->dev, "%s: %s HID v%x.%02x %s [%s] on %s\n", 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, 1214 buf, bus, hdev->version >> 8, hdev->version & 0xff,
1215 type, hdev->name, hdev->phys); 1215 type, hdev->name, hdev->phys);
1216 1216
1217 return 0; 1217 return 0;
1218 } 1218 }
1219 EXPORT_SYMBOL_GPL(hid_connect); 1219 EXPORT_SYMBOL_GPL(hid_connect);
1220 1220
1221 static const struct hid_device_id hid_blacklist[] = { 1221 static const struct hid_device_id hid_blacklist[] = {
1222 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1222 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
1223 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1223 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
1224 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, 1224 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
1225 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 1225 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
1226 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, 1226 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
1227 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 1227 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
1228 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 1228 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
1229 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 1229 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
1230 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 1230 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) },
1231 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 1231 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) },
1232 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 1232 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) },
1233 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 1233 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) },
1234 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 1234 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) },
1235 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 1235 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) },
1236 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 1236 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) },
1237 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 1237 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) },
1238 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, 1238 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) },
1239 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, 1239 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) },
1240 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, 1240 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) },
1241 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 1241 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) },
1242 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 1242 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) },
1243 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 1243 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) },
1244 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, 1244 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) },
1245 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, 1245 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) },
1246 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, 1246 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) },
1247 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 1247 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) },
1248 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 1248 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) },
1249 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 1249 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) },
1250 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 1250 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
1251 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 1251 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
1252 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1252 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
1253 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1253 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1254 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1254 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1255 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1255 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1256 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1256 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1257 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1257 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1258 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1258 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1259 { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) }, 1259 { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
1260 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1260 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1261 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1261 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1266 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
1269 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1269 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1270 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
1270 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 1271 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
1271 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1272 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1272 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1273 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1273 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1274 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1274 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 1275 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
1275 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 1276 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
1276 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, 1277 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, 1278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, 1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, 1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, 1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, 1282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) },
1282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, 1283 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
1283 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, 1284 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
1284 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, 1285 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },
1285 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, 1286 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) },
1286 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, 1287 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
1287 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, 1288 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
1288 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, 1289 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
1289 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, 1290 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
1290 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, 1291 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
1291 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, 1292 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
1292 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, 1293 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
1293 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, 1294 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1299 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1301 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1302 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1303 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1304 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1304 1305
1305 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 1307 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
1307 { } 1308 { }
1308 }; 1309 };
1309 1310
1310 static int hid_bus_match(struct device *dev, struct device_driver *drv) 1311 static int hid_bus_match(struct device *dev, struct device_driver *drv)
1311 { 1312 {
1312 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 1313 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
1313 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1314 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1314 1315
1315 if (!hid_match_id(hdev, hdrv->id_table)) 1316 if (!hid_match_id(hdev, hdrv->id_table))
1316 return 0; 1317 return 0;
1317 1318
1318 /* generic wants all non-blacklisted */ 1319 /* generic wants all non-blacklisted */
1319 if (!strncmp(hdrv->name, "generic-", 8)) 1320 if (!strncmp(hdrv->name, "generic-", 8))
1320 return !hid_match_id(hdev, hid_blacklist); 1321 return !hid_match_id(hdev, hid_blacklist);
1321 1322
1322 return 1; 1323 return 1;
1323 } 1324 }
1324 1325
1325 static int hid_device_probe(struct device *dev) 1326 static int hid_device_probe(struct device *dev)
1326 { 1327 {
1327 struct hid_driver *hdrv = container_of(dev->driver, 1328 struct hid_driver *hdrv = container_of(dev->driver,
1328 struct hid_driver, driver); 1329 struct hid_driver, driver);
1329 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1330 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1330 const struct hid_device_id *id; 1331 const struct hid_device_id *id;
1331 int ret = 0; 1332 int ret = 0;
1332 1333
1333 if (!hdev->driver) { 1334 if (!hdev->driver) {
1334 id = hid_match_id(hdev, hdrv->id_table); 1335 id = hid_match_id(hdev, hdrv->id_table);
1335 if (id == NULL) 1336 if (id == NULL)
1336 return -ENODEV; 1337 return -ENODEV;
1337 1338
1338 hdev->driver = hdrv; 1339 hdev->driver = hdrv;
1339 if (hdrv->probe) { 1340 if (hdrv->probe) {
1340 ret = hdrv->probe(hdev, id); 1341 ret = hdrv->probe(hdev, id);
1341 } else { /* default probe */ 1342 } else { /* default probe */
1342 ret = hid_parse(hdev); 1343 ret = hid_parse(hdev);
1343 if (!ret) 1344 if (!ret)
1344 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 1345 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
1345 } 1346 }
1346 if (ret) 1347 if (ret)
1347 hdev->driver = NULL; 1348 hdev->driver = NULL;
1348 } 1349 }
1349 return ret; 1350 return ret;
1350 } 1351 }
1351 1352
1352 static int hid_device_remove(struct device *dev) 1353 static int hid_device_remove(struct device *dev)
1353 { 1354 {
1354 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1355 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1355 struct hid_driver *hdrv = hdev->driver; 1356 struct hid_driver *hdrv = hdev->driver;
1356 1357
1357 if (hdrv) { 1358 if (hdrv) {
1358 if (hdrv->remove) 1359 if (hdrv->remove)
1359 hdrv->remove(hdev); 1360 hdrv->remove(hdev);
1360 else /* default remove */ 1361 else /* default remove */
1361 hid_hw_stop(hdev); 1362 hid_hw_stop(hdev);
1362 hdev->driver = NULL; 1363 hdev->driver = NULL;
1363 } 1364 }
1364 1365
1365 return 0; 1366 return 0;
1366 } 1367 }
1367 1368
1368 static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) 1369 static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
1369 { 1370 {
1370 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1371 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1371 1372
1372 if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", 1373 if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
1373 hdev->bus, hdev->vendor, hdev->product)) 1374 hdev->bus, hdev->vendor, hdev->product))
1374 return -ENOMEM; 1375 return -ENOMEM;
1375 1376
1376 if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) 1377 if (add_uevent_var(env, "HID_NAME=%s", hdev->name))
1377 return -ENOMEM; 1378 return -ENOMEM;
1378 1379
1379 if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) 1380 if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys))
1380 return -ENOMEM; 1381 return -ENOMEM;
1381 1382
1382 if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) 1383 if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq))
1383 return -ENOMEM; 1384 return -ENOMEM;
1384 1385
1385 if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", 1386 if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X",
1386 hdev->bus, hdev->vendor, hdev->product)) 1387 hdev->bus, hdev->vendor, hdev->product))
1387 return -ENOMEM; 1388 return -ENOMEM;
1388 1389
1389 return 0; 1390 return 0;
1390 } 1391 }
1391 1392
1392 static struct bus_type hid_bus_type = { 1393 static struct bus_type hid_bus_type = {
1393 .name = "hid", 1394 .name = "hid",
1394 .match = hid_bus_match, 1395 .match = hid_bus_match,
1395 .probe = hid_device_probe, 1396 .probe = hid_device_probe,
1396 .remove = hid_device_remove, 1397 .remove = hid_device_remove,
1397 .uevent = hid_uevent, 1398 .uevent = hid_uevent,
1398 }; 1399 };
1399 1400
1400 static const struct hid_device_id hid_ignore_list[] = { 1401 static const struct hid_device_id hid_ignore_list[] = {
1401 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, 1402 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) },
1402 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, 1403 { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) },
1403 { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, 1404 { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) },
1404 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, 1405 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) },
1405 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, 1406 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) },
1406 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, 1407 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) },
1407 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, 1408 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) },
1408 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, 1409 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) },
1409 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, 1410 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) },
1410 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, 1411 { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) },
1411 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, 1412 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) },
1412 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, 1413 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
1413 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, 1414 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
1414 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)}, 1415 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
1415 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, 1416 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
1416 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 1417 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
1417 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 1418 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
1418 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 1419 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
1419 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, 1420 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) },
1420 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, 1421 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) },
1421 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, 1422 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) },
1422 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, 1423 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
1423 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, 1424 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
1424 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, 1425 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
1425 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, 1426 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) },
1426 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, 1427 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) },
1427 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) }, 1428 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) },
1428 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, 1429 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) },
1429 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, 1430 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) },
1430 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, 1431 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) },
1431 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, 1432 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) },
1432 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, 1433 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) },
1433 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, 1434 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) },
1434 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, 1435 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) },
1435 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, 1436 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) },
1436 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, 1437 { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) },
1437 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, 1438 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) },
1438 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, 1439 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) },
1439 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, 1440 { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) },
1440 { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, 1441 { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) },
1441 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, 1442 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) },
1442 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, 1443 { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) },
1443 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, 1444 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) },
1444 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, 1445 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) },
1445 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, 1446 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) },
1446 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, 1447 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) },
1447 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, 1448 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) },
1448 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, 1449 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) },
1449 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, 1450 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) },
1450 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, 1451 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) },
1451 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, 1452 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) },
1452 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, 1453 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) },
1453 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, 1454 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) },
1454 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, 1455 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) },
1455 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, 1456 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) },
1456 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, 1457 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) },
1457 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, 1458 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) },
1458 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, 1459 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) },
1459 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, 1460 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) },
1460 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, 1461 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) },
1461 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, 1462 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) },
1462 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, 1463 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) },
1463 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, 1464 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) },
1464 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, 1465 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) },
1465 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, 1466 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) },
1466 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, 1467 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) },
1467 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, 1468 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) },
1468 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, 1469 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) },
1469 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, 1470 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) },
1470 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, 1471 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) },
1471 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, 1472 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) },
1472 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, 1473 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) },
1473 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, 1474 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) },
1474 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, 1475 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) },
1475 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, 1476 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) },
1476 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, 1477 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) },
1477 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, 1478 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) },
1478 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, 1479 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) },
1479 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, 1480 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) },
1480 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, 1481 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) },
1481 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, 1482 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) },
1482 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, 1483 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) },
1483 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, 1484 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) },
1484 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, 1485 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) },
1485 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, 1486 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) },
1486 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, 1487 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) },
1487 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, 1488 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
1488 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, 1489 { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
1489 { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, 1490 { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
1490 { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, 1491 { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
1491 { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, 1492 { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
1492 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, 1493 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
1493 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, 1494 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) },
1494 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, 1495 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) },
1495 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, 1496 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) },
1496 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, 1497 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
1497 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, 1498 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
1498 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, 1499 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
1499 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1) }, 1500 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1) },
1500 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, 1501 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) },
1501 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, 1502 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) },
1502 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, 1503 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) },
1503 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, 1504 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) },
1504 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, 1505 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) },
1505 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, 1506 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) },
1506 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, 1507 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) },
1507 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, 1508 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
1508 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 1509 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
1509 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 1510 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
1510 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, 1511 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) },
1511 { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, 1512 { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) },
1512 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, 1513 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) },
1513 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, 1514 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) },
1514 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, 1515 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) },
1515 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, 1516 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) },
1516 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, 1517 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) },
1517 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, 1518 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) },
1518 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, 1519 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) },
1519 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, 1520 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) },
1520 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, 1521 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) },
1521 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, 1522 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) },
1522 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, 1523 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) },
1523 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, 1524 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) },
1524 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, 1525 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) },
1525 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, 1526 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
1526 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, 1527 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) },
1527 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, 1528 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) },
1528 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, 1529 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
1529 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, 1530 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
1530 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, 1531 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
1531 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 1532 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1532 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 1533 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
1533 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, 1534 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
1534 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1535 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
1535 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, 1536 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
1536 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 1537 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
1537 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 1538 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
1538 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, 1539 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
1539 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, 1540 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) },
1540 { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) }, 1541 { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) },
1541 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, 1542 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) },
1542 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, 1543 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
1543 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, 1544 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
1544 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 1545 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
1545 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1546 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
1546 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1547 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
1547 { } 1548 { }
1548 }; 1549 };
1549 1550
1550 /** 1551 /**
1551 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer 1552 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
1552 * 1553 *
1553 * There are composite devices for which we want to ignore only a certain 1554 * There are composite devices for which we want to ignore only a certain
1554 * interface. This is a list of devices for which only the mouse interface will 1555 * interface. This is a list of devices for which only the mouse interface will
1555 * be ignored. This allows a dedicated driver to take care of the interface. 1556 * be ignored. This allows a dedicated driver to take care of the interface.
1556 */ 1557 */
1557 static const struct hid_device_id hid_mouse_ignore_list[] = { 1558 static const struct hid_device_id hid_mouse_ignore_list[] = {
1558 /* appletouch driver */ 1559 /* appletouch driver */
1559 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 1560 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
1560 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 1561 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
1561 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 1562 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
1562 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 1563 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) },
1563 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 1564 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) },
1564 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 1565 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) },
1565 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 1566 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) },
1566 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 1567 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) },
1567 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 1568 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) },
1568 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 1569 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) },
1569 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 1570 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) },
1570 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 1571 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) },
1571 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 1572 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) },
1572 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 1573 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) },
1573 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 1574 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) },
1574 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 1575 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) },
1575 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 1576 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) },
1576 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 1577 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
1577 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 1578 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
1578 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1579 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
1579 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1580 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1580 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1581 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1581 { } 1582 { }
1582 }; 1583 };
1583 1584
1584 static bool hid_ignore(struct hid_device *hdev) 1585 static bool hid_ignore(struct hid_device *hdev)
1585 { 1586 {
1586 switch (hdev->vendor) { 1587 switch (hdev->vendor) {
1587 case USB_VENDOR_ID_CODEMERCS: 1588 case USB_VENDOR_ID_CODEMERCS:
1588 /* ignore all Code Mercenaries IOWarrior devices */ 1589 /* ignore all Code Mercenaries IOWarrior devices */
1589 if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && 1590 if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST &&
1590 hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) 1591 hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST)
1591 return true; 1592 return true;
1592 break; 1593 break;
1593 case USB_VENDOR_ID_LOGITECH: 1594 case USB_VENDOR_ID_LOGITECH:
1594 if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && 1595 if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST &&
1595 hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) 1596 hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST)
1596 return true; 1597 return true;
1597 break; 1598 break;
1598 } 1599 }
1599 1600
1600 if (hdev->type == HID_TYPE_USBMOUSE && 1601 if (hdev->type == HID_TYPE_USBMOUSE &&
1601 hid_match_id(hdev, hid_mouse_ignore_list)) 1602 hid_match_id(hdev, hid_mouse_ignore_list))
1602 return true; 1603 return true;
1603 1604
1604 return !!hid_match_id(hdev, hid_ignore_list); 1605 return !!hid_match_id(hdev, hid_ignore_list);
1605 } 1606 }
1606 1607
1607 int hid_add_device(struct hid_device *hdev) 1608 int hid_add_device(struct hid_device *hdev)
1608 { 1609 {
1609 static atomic_t id = ATOMIC_INIT(0); 1610 static atomic_t id = ATOMIC_INIT(0);
1610 int ret; 1611 int ret;
1611 1612
1612 if (WARN_ON(hdev->status & HID_STAT_ADDED)) 1613 if (WARN_ON(hdev->status & HID_STAT_ADDED))
1613 return -EBUSY; 1614 return -EBUSY;
1614 1615
1615 /* we need to kill them here, otherwise they will stay allocated to 1616 /* we need to kill them here, otherwise they will stay allocated to
1616 * wait for coming driver */ 1617 * wait for coming driver */
1617 if (hid_ignore(hdev)) 1618 if (hid_ignore(hdev))
1618 return -ENODEV; 1619 return -ENODEV;
1619 1620
1620 /* XXX hack, any other cleaner solution < 20 bus_id bytes? */ 1621 /* XXX hack, any other cleaner solution < 20 bus_id bytes? */
1621 sprintf(hdev->dev.bus_id, "%04X:%04X:%04X.%04X", hdev->bus, 1622 sprintf(hdev->dev.bus_id, "%04X:%04X:%04X.%04X", hdev->bus,
1622 hdev->vendor, hdev->product, atomic_inc_return(&id)); 1623 hdev->vendor, hdev->product, atomic_inc_return(&id));
1623 1624
1624 ret = device_add(&hdev->dev); 1625 ret = device_add(&hdev->dev);
1625 if (!ret) 1626 if (!ret)
1626 hdev->status |= HID_STAT_ADDED; 1627 hdev->status |= HID_STAT_ADDED;
1627 1628
1628 return ret; 1629 return ret;
1629 } 1630 }
1630 EXPORT_SYMBOL_GPL(hid_add_device); 1631 EXPORT_SYMBOL_GPL(hid_add_device);
1631 1632
1632 /** 1633 /**
1633 * hid_allocate_device - allocate new hid device descriptor 1634 * hid_allocate_device - allocate new hid device descriptor
1634 * 1635 *
1635 * Allocate and initialize hid device, so that hid_destroy_device might be 1636 * Allocate and initialize hid device, so that hid_destroy_device might be
1636 * used to free it. 1637 * used to free it.
1637 * 1638 *
1638 * New hid_device pointer is returned on success, otherwise ERR_PTR encoded 1639 * New hid_device pointer is returned on success, otherwise ERR_PTR encoded
1639 * error value. 1640 * error value.
1640 */ 1641 */
1641 struct hid_device *hid_allocate_device(void) 1642 struct hid_device *hid_allocate_device(void)
1642 { 1643 {
1643 struct hid_device *hdev; 1644 struct hid_device *hdev;
1644 unsigned int i; 1645 unsigned int i;
1645 int ret = -ENOMEM; 1646 int ret = -ENOMEM;
1646 1647
1647 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); 1648 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
1648 if (hdev == NULL) 1649 if (hdev == NULL)
1649 return ERR_PTR(ret); 1650 return ERR_PTR(ret);
1650 1651
1651 device_initialize(&hdev->dev); 1652 device_initialize(&hdev->dev);
1652 hdev->dev.release = hid_device_release; 1653 hdev->dev.release = hid_device_release;
1653 hdev->dev.bus = &hid_bus_type; 1654 hdev->dev.bus = &hid_bus_type;
1654 1655
1655 hdev->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, 1656 hdev->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS,
1656 sizeof(struct hid_collection), GFP_KERNEL); 1657 sizeof(struct hid_collection), GFP_KERNEL);
1657 if (hdev->collection == NULL) 1658 if (hdev->collection == NULL)
1658 goto err; 1659 goto err;
1659 hdev->collection_size = HID_DEFAULT_NUM_COLLECTIONS; 1660 hdev->collection_size = HID_DEFAULT_NUM_COLLECTIONS;
1660 1661
1661 for (i = 0; i < HID_REPORT_TYPES; i++) 1662 for (i = 0; i < HID_REPORT_TYPES; i++)
1662 INIT_LIST_HEAD(&hdev->report_enum[i].report_list); 1663 INIT_LIST_HEAD(&hdev->report_enum[i].report_list);
1663 1664
1664 return hdev; 1665 return hdev;
1665 err: 1666 err:
1666 put_device(&hdev->dev); 1667 put_device(&hdev->dev);
1667 return ERR_PTR(ret); 1668 return ERR_PTR(ret);
1668 } 1669 }
1669 EXPORT_SYMBOL_GPL(hid_allocate_device); 1670 EXPORT_SYMBOL_GPL(hid_allocate_device);
1670 1671
1671 static void hid_remove_device(struct hid_device *hdev) 1672 static void hid_remove_device(struct hid_device *hdev)
1672 { 1673 {
1673 if (hdev->status & HID_STAT_ADDED) { 1674 if (hdev->status & HID_STAT_ADDED) {
1674 device_del(&hdev->dev); 1675 device_del(&hdev->dev);
1675 hdev->status &= ~HID_STAT_ADDED; 1676 hdev->status &= ~HID_STAT_ADDED;
1676 } 1677 }
1677 } 1678 }
1678 1679
1679 /** 1680 /**
1680 * hid_destroy_device - free previously allocated device 1681 * hid_destroy_device - free previously allocated device
1681 * 1682 *
1682 * @hdev: hid device 1683 * @hdev: hid device
1683 * 1684 *
1684 * If you allocate hid_device through hid_allocate_device, you should ever 1685 * If you allocate hid_device through hid_allocate_device, you should ever
1685 * free by this function. 1686 * free by this function.
1686 */ 1687 */
1687 void hid_destroy_device(struct hid_device *hdev) 1688 void hid_destroy_device(struct hid_device *hdev)
1688 { 1689 {
1689 hid_remove_device(hdev); 1690 hid_remove_device(hdev);
1690 put_device(&hdev->dev); 1691 put_device(&hdev->dev);
1691 } 1692 }
1692 EXPORT_SYMBOL_GPL(hid_destroy_device); 1693 EXPORT_SYMBOL_GPL(hid_destroy_device);
1693 1694
1694 int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 1695 int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
1695 const char *mod_name) 1696 const char *mod_name)
1696 { 1697 {
1697 hdrv->driver.name = hdrv->name; 1698 hdrv->driver.name = hdrv->name;
1698 hdrv->driver.bus = &hid_bus_type; 1699 hdrv->driver.bus = &hid_bus_type;
1699 hdrv->driver.owner = owner; 1700 hdrv->driver.owner = owner;
1700 hdrv->driver.mod_name = mod_name; 1701 hdrv->driver.mod_name = mod_name;
1701 1702
1702 return driver_register(&hdrv->driver); 1703 return driver_register(&hdrv->driver);
1703 } 1704 }
1704 EXPORT_SYMBOL_GPL(__hid_register_driver); 1705 EXPORT_SYMBOL_GPL(__hid_register_driver);
1705 1706
1706 void hid_unregister_driver(struct hid_driver *hdrv) 1707 void hid_unregister_driver(struct hid_driver *hdrv)
1707 { 1708 {
1708 driver_unregister(&hdrv->driver); 1709 driver_unregister(&hdrv->driver);
1709 } 1710 }
1710 EXPORT_SYMBOL_GPL(hid_unregister_driver); 1711 EXPORT_SYMBOL_GPL(hid_unregister_driver);
1711 1712
1712 #ifdef CONFIG_HID_COMPAT 1713 #ifdef CONFIG_HID_COMPAT
1713 static void hid_compat_load(struct work_struct *ws) 1714 static void hid_compat_load(struct work_struct *ws)
1714 { 1715 {
1715 request_module("hid-dummy"); 1716 request_module("hid-dummy");
1716 } 1717 }
1717 static DECLARE_WORK(hid_compat_work, hid_compat_load); 1718 static DECLARE_WORK(hid_compat_work, hid_compat_load);
1718 static struct workqueue_struct *hid_compat_wq; 1719 static struct workqueue_struct *hid_compat_wq;
1719 #endif 1720 #endif
1720 1721
1721 static int __init hid_init(void) 1722 static int __init hid_init(void)
1722 { 1723 {
1723 int ret; 1724 int ret;
1724 1725
1725 ret = bus_register(&hid_bus_type); 1726 ret = bus_register(&hid_bus_type);
1726 if (ret) { 1727 if (ret) {
1727 printk(KERN_ERR "HID: can't register hid bus\n"); 1728 printk(KERN_ERR "HID: can't register hid bus\n");
1728 goto err; 1729 goto err;
1729 } 1730 }
1730 1731
1731 ret = hidraw_init(); 1732 ret = hidraw_init();
1732 if (ret) 1733 if (ret)
1733 goto err_bus; 1734 goto err_bus;
1734 1735
1735 #ifdef CONFIG_HID_COMPAT 1736 #ifdef CONFIG_HID_COMPAT
1736 hid_compat_wq = create_singlethread_workqueue("hid_compat"); 1737 hid_compat_wq = create_singlethread_workqueue("hid_compat");
1737 if (!hid_compat_wq) { 1738 if (!hid_compat_wq) {
1738 hidraw_exit(); 1739 hidraw_exit();
1739 goto err; 1740 goto err;
1740 } 1741 }
1741 queue_work(hid_compat_wq, &hid_compat_work); 1742 queue_work(hid_compat_wq, &hid_compat_work);
1742 #endif 1743 #endif
1743 1744
1744 return 0; 1745 return 0;
1745 err_bus: 1746 err_bus:
1746 bus_unregister(&hid_bus_type); 1747 bus_unregister(&hid_bus_type);
1747 err: 1748 err:
1748 return ret; 1749 return ret;
1749 } 1750 }
1750 1751
1751 static void __exit hid_exit(void) 1752 static void __exit hid_exit(void)
1752 { 1753 {
1753 #ifdef CONFIG_HID_COMPAT 1754 #ifdef CONFIG_HID_COMPAT
1754 destroy_workqueue(hid_compat_wq); 1755 destroy_workqueue(hid_compat_wq);
1755 #endif 1756 #endif
1756 hidraw_exit(); 1757 hidraw_exit();
1757 bus_unregister(&hid_bus_type); 1758 bus_unregister(&hid_bus_type);
1758 } 1759 }
1759 1760
1760 module_init(hid_init); 1761 module_init(hid_init);
1761 module_exit(hid_exit); 1762 module_exit(hid_exit);
1762 1763
1763 MODULE_LICENSE(DRIVER_LICENSE); 1764 MODULE_LICENSE(DRIVER_LICENSE);
1764 1765
1765 1766
drivers/hid/hid-ids.h
1 /* 1 /*
2 * USB HID quirks support for Linux 2 * USB HID quirks support for Linux
3 * 3 *
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina 7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2007 Paul Walmsley 8 * Copyright (c) 2007 Paul Walmsley
9 */ 9 */
10 10
11 /* 11 /*
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free 13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option) 14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version. 15 * any later version.
16 */ 16 */
17 17
18 #ifndef HID_IDS_H_FILE 18 #ifndef HID_IDS_H_FILE
19 #define HID_IDS_H_FILE 19 #define HID_IDS_H_FILE
20 20
21 #define USB_VENDOR_ID_A4TECH 0x09da 21 #define USB_VENDOR_ID_A4TECH 0x09da
22 #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 22 #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
23 #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a 23 #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
24 24
25 #define USB_VENDOR_ID_AASHIMA 0x06d6 25 #define USB_VENDOR_ID_AASHIMA 0x06d6
26 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 26 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
27 #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 27 #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026
28 28
29 #define USB_VENDOR_ID_ACECAD 0x0460 29 #define USB_VENDOR_ID_ACECAD 0x0460
30 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 30 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004
31 #define USB_DEVICE_ID_ACECAD_302 0x0008 31 #define USB_DEVICE_ID_ACECAD_302 0x0008
32 32
33 #define USB_VENDOR_ID_ADS_TECH 0x06e1 33 #define USB_VENDOR_ID_ADS_TECH 0x06e1
34 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 34 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155
35 35
36 #define USB_VENDOR_ID_AFATECH 0x15a4 36 #define USB_VENDOR_ID_AFATECH 0x15a4
37 #define USB_DEVICE_ID_AFATECH_AF9016 0x9016 37 #define USB_DEVICE_ID_AFATECH_AF9016 0x9016
38 38
39 #define USB_VENDOR_ID_AIPTEK 0x08ca 39 #define USB_VENDOR_ID_AIPTEK 0x08ca
40 #define USB_DEVICE_ID_AIPTEK_01 0x0001 40 #define USB_DEVICE_ID_AIPTEK_01 0x0001
41 #define USB_DEVICE_ID_AIPTEK_10 0x0010 41 #define USB_DEVICE_ID_AIPTEK_10 0x0010
42 #define USB_DEVICE_ID_AIPTEK_20 0x0020 42 #define USB_DEVICE_ID_AIPTEK_20 0x0020
43 #define USB_DEVICE_ID_AIPTEK_21 0x0021 43 #define USB_DEVICE_ID_AIPTEK_21 0x0021
44 #define USB_DEVICE_ID_AIPTEK_22 0x0022 44 #define USB_DEVICE_ID_AIPTEK_22 0x0022
45 #define USB_DEVICE_ID_AIPTEK_23 0x0023 45 #define USB_DEVICE_ID_AIPTEK_23 0x0023
46 #define USB_DEVICE_ID_AIPTEK_24 0x0024 46 #define USB_DEVICE_ID_AIPTEK_24 0x0024
47 47
48 #define USB_VENDOR_ID_AIRCABLE 0x16CA 48 #define USB_VENDOR_ID_AIRCABLE 0x16CA
49 #define USB_DEVICE_ID_AIRCABLE1 0x1502 49 #define USB_DEVICE_ID_AIRCABLE1 0x1502
50 50
51 #define USB_VENDOR_ID_ALCOR 0x058f 51 #define USB_VENDOR_ID_ALCOR 0x058f
52 #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720 52 #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720
53 53
54 #define USB_VENDOR_ID_ALPS 0x0433 54 #define USB_VENDOR_ID_ALPS 0x0433
55 #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 55 #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101
56 56
57 #define USB_VENDOR_ID_APPLE 0x05ac 57 #define USB_VENDOR_ID_APPLE 0x05ac
58 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 58 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
59 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e 59 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e
60 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f 60 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f
61 #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 61 #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214
62 #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 62 #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215
63 #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 63 #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216
64 #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 64 #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217
65 #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 65 #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218
66 #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 66 #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219
67 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a 67 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a
68 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b 68 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
69 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c 69 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
70 #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 70 #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
71 #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 71 #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
72 #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 72 #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
73 #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 73 #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223
74 #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 74 #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224
75 #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 75 #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225
76 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 76 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229
77 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a 77 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
78 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b 78 #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
79 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c 79 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
80 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d 80 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
81 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e 81 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
82 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 82 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230
83 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 83 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231
84 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 84 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
85 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 85 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
86 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 86 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
87 #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 87 #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
88 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 88 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
89 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 89 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
90 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 90 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
91 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 91 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
92 92
93 #define USB_VENDOR_ID_ASUS 0x0b05 93 #define USB_VENDOR_ID_ASUS 0x0b05
94 #define USB_DEVICE_ID_ASUS_LCM 0x1726 94 #define USB_DEVICE_ID_ASUS_LCM 0x1726
95 #define USB_DEVICE_ID_ASUS_LCM2 0x175b 95 #define USB_DEVICE_ID_ASUS_LCM2 0x175b
96 96
97 #define USB_VENDOR_ID_ATEN 0x0557 97 #define USB_VENDOR_ID_ATEN 0x0557
98 #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 98 #define USB_DEVICE_ID_ATEN_UC100KM 0x2004
99 #define USB_DEVICE_ID_ATEN_CS124U 0x2202 99 #define USB_DEVICE_ID_ATEN_CS124U 0x2202
100 #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 100 #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204
101 #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 101 #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205
102 #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 102 #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208
103 103
104 #define USB_VENDOR_ID_AVERMEDIA 0x07ca 104 #define USB_VENDOR_ID_AVERMEDIA 0x07ca
105 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 105 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800
106 106
107 #define USB_VENDOR_ID_BELKIN 0x050d 107 #define USB_VENDOR_ID_BELKIN 0x050d
108 #define USB_DEVICE_ID_FLIP_KVM 0x3201 108 #define USB_DEVICE_ID_FLIP_KVM 0x3201
109 109
110 #define USB_VENDOR_ID_BRIGHT 0x1241 110 #define USB_VENDOR_ID_BRIGHT 0x1241
111 #define USB_DEVICE_ID_BRIGHT_ABNT2 0x1503 111 #define USB_DEVICE_ID_BRIGHT_ABNT2 0x1503
112 112
113 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 113 #define USB_VENDOR_ID_BERKSHIRE 0x0c98
114 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 114 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
115 115
116 #define USB_VENDOR_ID_CHERRY 0x046a 116 #define USB_VENDOR_ID_CHERRY 0x046a
117 #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 117 #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
118 118
119 #define USB_VENDOR_ID_CHIC 0x05fe 119 #define USB_VENDOR_ID_CHIC 0x05fe
120 #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 120 #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014
121 121
122 #define USB_VENDOR_ID_CHICONY 0x04f2 122 #define USB_VENDOR_ID_CHICONY 0x04f2
123 #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 123 #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
124 124
125 #define USB_VENDOR_ID_CIDC 0x1677 125 #define USB_VENDOR_ID_CIDC 0x1677
126 126
127 #define USB_VENDOR_ID_CMEDIA 0x0d8c 127 #define USB_VENDOR_ID_CMEDIA 0x0d8c
128 #define USB_DEVICE_ID_CM109 0x000e 128 #define USB_DEVICE_ID_CM109 0x000e
129 129
130 #define USB_VENDOR_ID_CODEMERCS 0x07c0 130 #define USB_VENDOR_ID_CODEMERCS 0x07c0
131 #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500 131 #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500
132 #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff 132 #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff
133 133
134 #define USB_VENDOR_ID_CYGNAL 0x10c4 134 #define USB_VENDOR_ID_CYGNAL 0x10c4
135 #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a 135 #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a
136 136
137 #define USB_VENDOR_ID_CYPRESS 0x04b4 137 #define USB_VENDOR_ID_CYPRESS 0x04b4
138 #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 138 #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001
139 #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 139 #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500
140 #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 140 #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417
141 #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 141 #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61
142 #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 142 #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64
143 143
144 #define USB_VENDOR_ID_DELL 0x413c 144 #define USB_VENDOR_ID_DELL 0x413c
145 #define USB_DEVICE_ID_DELL_W7658 0x2005 145 #define USB_DEVICE_ID_DELL_W7658 0x2005
146 #define USB_DEVICE_ID_DELL_SK8115 0x2105 146 #define USB_DEVICE_ID_DELL_SK8115 0x2105
147 147
148 #define USB_VENDOR_ID_DELORME 0x1163 148 #define USB_VENDOR_ID_DELORME 0x1163
149 #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 149 #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
150 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 150 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200
151 151
152 #define USB_VENDOR_ID_DMI 0x0c0b 152 #define USB_VENDOR_ID_DMI 0x0c0b
153 #define USB_DEVICE_ID_DMI_ENC 0x5fab 153 #define USB_DEVICE_ID_DMI_ENC 0x5fab
154 154
155 #define USB_VENDOR_ID_ELO 0x04E7 155 #define USB_VENDOR_ID_ELO 0x04E7
156 #define USB_DEVICE_ID_ELO_TS2700 0x0020 156 #define USB_DEVICE_ID_ELO_TS2700 0x0020
157 157
158 #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 158 #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
159 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 159 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
160 160
161 #define USB_VENDOR_ID_EZKEY 0x0518 161 #define USB_VENDOR_ID_EZKEY 0x0518
162 #define USB_DEVICE_ID_BTC_8193 0x0002 162 #define USB_DEVICE_ID_BTC_8193 0x0002
163 163
164 #define USB_VENDOR_ID_GAMERON 0x0810 164 #define USB_VENDOR_ID_GAMERON 0x0810
165 #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 165 #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001
166 #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002
166 167
167 #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 168 #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
168 169
169 #define USB_VENDOR_ID_GENERIC_13BA 0x13ba 170 #define USB_VENDOR_ID_GENERIC_13BA 0x13ba
170 #define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017 171 #define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017
171 172
172 #define USB_VENDOR_ID_GLAB 0x06c2 173 #define USB_VENDOR_ID_GLAB 0x06c2
173 #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 174 #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
174 #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 175 #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
175 #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040 176 #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040
176 #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044 177 #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044
177 #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045 178 #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045
178 #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051 179 #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051
179 #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 180 #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053
180 #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 181 #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058
181 182
182 #define USB_VENDOR_ID_GOTOP 0x08f2 183 #define USB_VENDOR_ID_GOTOP 0x08f2
183 #define USB_DEVICE_ID_SUPER_Q2 0x007f 184 #define USB_DEVICE_ID_SUPER_Q2 0x007f
184 #define USB_DEVICE_ID_GOGOPEN 0x00ce 185 #define USB_DEVICE_ID_GOGOPEN 0x00ce
185 #define USB_DEVICE_ID_PENPOWER 0x00f4 186 #define USB_DEVICE_ID_PENPOWER 0x00f4
186 187
187 #define USB_VENDOR_ID_GREENASIA 0x0e8f 188 #define USB_VENDOR_ID_GREENASIA 0x0e8f
188 189
189 #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 190 #define USB_VENDOR_ID_GRETAGMACBETH 0x0971
190 #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 191 #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005
191 192
192 #define USB_VENDOR_ID_GRIFFIN 0x077d 193 #define USB_VENDOR_ID_GRIFFIN 0x077d
193 #define USB_DEVICE_ID_POWERMATE 0x0410 194 #define USB_DEVICE_ID_POWERMATE 0x0410
194 #define USB_DEVICE_ID_SOUNDKNOB 0x04AA 195 #define USB_DEVICE_ID_SOUNDKNOB 0x04AA
195 196
196 #define USB_VENDOR_ID_GTCO 0x078c 197 #define USB_VENDOR_ID_GTCO 0x078c
197 #define USB_DEVICE_ID_GTCO_90 0x0090 198 #define USB_DEVICE_ID_GTCO_90 0x0090
198 #define USB_DEVICE_ID_GTCO_100 0x0100 199 #define USB_DEVICE_ID_GTCO_100 0x0100
199 #define USB_DEVICE_ID_GTCO_101 0x0101 200 #define USB_DEVICE_ID_GTCO_101 0x0101
200 #define USB_DEVICE_ID_GTCO_103 0x0103 201 #define USB_DEVICE_ID_GTCO_103 0x0103
201 #define USB_DEVICE_ID_GTCO_104 0x0104 202 #define USB_DEVICE_ID_GTCO_104 0x0104
202 #define USB_DEVICE_ID_GTCO_105 0x0105 203 #define USB_DEVICE_ID_GTCO_105 0x0105
203 #define USB_DEVICE_ID_GTCO_106 0x0106 204 #define USB_DEVICE_ID_GTCO_106 0x0106
204 #define USB_DEVICE_ID_GTCO_107 0x0107 205 #define USB_DEVICE_ID_GTCO_107 0x0107
205 #define USB_DEVICE_ID_GTCO_108 0x0108 206 #define USB_DEVICE_ID_GTCO_108 0x0108
206 #define USB_DEVICE_ID_GTCO_200 0x0200 207 #define USB_DEVICE_ID_GTCO_200 0x0200
207 #define USB_DEVICE_ID_GTCO_201 0x0201 208 #define USB_DEVICE_ID_GTCO_201 0x0201
208 #define USB_DEVICE_ID_GTCO_202 0x0202 209 #define USB_DEVICE_ID_GTCO_202 0x0202
209 #define USB_DEVICE_ID_GTCO_203 0x0203 210 #define USB_DEVICE_ID_GTCO_203 0x0203
210 #define USB_DEVICE_ID_GTCO_204 0x0204 211 #define USB_DEVICE_ID_GTCO_204 0x0204
211 #define USB_DEVICE_ID_GTCO_205 0x0205 212 #define USB_DEVICE_ID_GTCO_205 0x0205
212 #define USB_DEVICE_ID_GTCO_206 0x0206 213 #define USB_DEVICE_ID_GTCO_206 0x0206
213 #define USB_DEVICE_ID_GTCO_207 0x0207 214 #define USB_DEVICE_ID_GTCO_207 0x0207
214 #define USB_DEVICE_ID_GTCO_300 0x0300 215 #define USB_DEVICE_ID_GTCO_300 0x0300
215 #define USB_DEVICE_ID_GTCO_301 0x0301 216 #define USB_DEVICE_ID_GTCO_301 0x0301
216 #define USB_DEVICE_ID_GTCO_302 0x0302 217 #define USB_DEVICE_ID_GTCO_302 0x0302
217 #define USB_DEVICE_ID_GTCO_303 0x0303 218 #define USB_DEVICE_ID_GTCO_303 0x0303
218 #define USB_DEVICE_ID_GTCO_304 0x0304 219 #define USB_DEVICE_ID_GTCO_304 0x0304
219 #define USB_DEVICE_ID_GTCO_305 0x0305 220 #define USB_DEVICE_ID_GTCO_305 0x0305
220 #define USB_DEVICE_ID_GTCO_306 0x0306 221 #define USB_DEVICE_ID_GTCO_306 0x0306
221 #define USB_DEVICE_ID_GTCO_307 0x0307 222 #define USB_DEVICE_ID_GTCO_307 0x0307
222 #define USB_DEVICE_ID_GTCO_308 0x0308 223 #define USB_DEVICE_ID_GTCO_308 0x0308
223 #define USB_DEVICE_ID_GTCO_309 0x0309 224 #define USB_DEVICE_ID_GTCO_309 0x0309
224 #define USB_DEVICE_ID_GTCO_400 0x0400 225 #define USB_DEVICE_ID_GTCO_400 0x0400
225 #define USB_DEVICE_ID_GTCO_401 0x0401 226 #define USB_DEVICE_ID_GTCO_401 0x0401
226 #define USB_DEVICE_ID_GTCO_402 0x0402 227 #define USB_DEVICE_ID_GTCO_402 0x0402
227 #define USB_DEVICE_ID_GTCO_403 0x0403 228 #define USB_DEVICE_ID_GTCO_403 0x0403
228 #define USB_DEVICE_ID_GTCO_404 0x0404 229 #define USB_DEVICE_ID_GTCO_404 0x0404
229 #define USB_DEVICE_ID_GTCO_405 0x0405 230 #define USB_DEVICE_ID_GTCO_405 0x0405
230 #define USB_DEVICE_ID_GTCO_500 0x0500 231 #define USB_DEVICE_ID_GTCO_500 0x0500
231 #define USB_DEVICE_ID_GTCO_501 0x0501 232 #define USB_DEVICE_ID_GTCO_501 0x0501
232 #define USB_DEVICE_ID_GTCO_502 0x0502 233 #define USB_DEVICE_ID_GTCO_502 0x0502
233 #define USB_DEVICE_ID_GTCO_503 0x0503 234 #define USB_DEVICE_ID_GTCO_503 0x0503
234 #define USB_DEVICE_ID_GTCO_504 0x0504 235 #define USB_DEVICE_ID_GTCO_504 0x0504
235 #define USB_DEVICE_ID_GTCO_1000 0x1000 236 #define USB_DEVICE_ID_GTCO_1000 0x1000
236 #define USB_DEVICE_ID_GTCO_1001 0x1001 237 #define USB_DEVICE_ID_GTCO_1001 0x1001
237 #define USB_DEVICE_ID_GTCO_1002 0x1002 238 #define USB_DEVICE_ID_GTCO_1002 0x1002
238 #define USB_DEVICE_ID_GTCO_1003 0x1003 239 #define USB_DEVICE_ID_GTCO_1003 0x1003
239 #define USB_DEVICE_ID_GTCO_1004 0x1004 240 #define USB_DEVICE_ID_GTCO_1004 0x1004
240 #define USB_DEVICE_ID_GTCO_1005 0x1005 241 #define USB_DEVICE_ID_GTCO_1005 0x1005
241 #define USB_DEVICE_ID_GTCO_1006 0x1006 242 #define USB_DEVICE_ID_GTCO_1006 0x1006
242 #define USB_DEVICE_ID_GTCO_1007 0x1007 243 #define USB_DEVICE_ID_GTCO_1007 0x1007
243 244
244 #define USB_VENDOR_ID_GYRATION 0x0c16 245 #define USB_VENDOR_ID_GYRATION 0x0c16
245 #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 246 #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002
246 #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 247 #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003
247 248
248 #define USB_VENDOR_ID_HAPP 0x078b 249 #define USB_VENDOR_ID_HAPP 0x078b
249 #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 250 #define USB_DEVICE_ID_UGCI_DRIVING 0x0010
250 #define USB_DEVICE_ID_UGCI_FLYING 0x0020 251 #define USB_DEVICE_ID_UGCI_FLYING 0x0020
251 #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 252 #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
252 253
253 #define USB_VENDOR_ID_IMATION 0x0718 254 #define USB_VENDOR_ID_IMATION 0x0718
254 #define USB_DEVICE_ID_DISC_STAKKA 0xd000 255 #define USB_DEVICE_ID_DISC_STAKKA 0xd000
255 256
256 #define USB_VENDOR_ID_KBGEAR 0x084e 257 #define USB_VENDOR_ID_KBGEAR 0x084e
257 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 258 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001
258 259
259 #define USB_VENDOR_ID_KWORLD 0x1b80 260 #define USB_VENDOR_ID_KWORLD 0x1b80
260 #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 261 #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700
261 262
262 #define USB_VENDOR_ID_LABTEC 0x1020 263 #define USB_VENDOR_ID_LABTEC 0x1020
263 #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 264 #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006
264 265
265 #define USB_VENDOR_ID_LD 0x0f11 266 #define USB_VENDOR_ID_LD 0x0f11
266 #define USB_DEVICE_ID_LD_CASSY 0x1000 267 #define USB_DEVICE_ID_LD_CASSY 0x1000
267 #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 268 #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010
268 #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 269 #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020
269 #define USB_DEVICE_ID_LD_JWM 0x1080 270 #define USB_DEVICE_ID_LD_JWM 0x1080
270 #define USB_DEVICE_ID_LD_DMMP 0x1081 271 #define USB_DEVICE_ID_LD_DMMP 0x1081
271 #define USB_DEVICE_ID_LD_UMIP 0x1090 272 #define USB_DEVICE_ID_LD_UMIP 0x1090
272 #define USB_DEVICE_ID_LD_XRAY1 0x1100 273 #define USB_DEVICE_ID_LD_XRAY1 0x1100
273 #define USB_DEVICE_ID_LD_XRAY2 0x1101 274 #define USB_DEVICE_ID_LD_XRAY2 0x1101
274 #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 275 #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200
275 #define USB_DEVICE_ID_LD_COM3LAB 0x2000 276 #define USB_DEVICE_ID_LD_COM3LAB 0x2000
276 #define USB_DEVICE_ID_LD_TELEPORT 0x2010 277 #define USB_DEVICE_ID_LD_TELEPORT 0x2010
277 #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 278 #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020
278 #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 279 #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030
279 #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 280 #define USB_DEVICE_ID_LD_MACHINETEST 0x2040
280 281
281 #define USB_VENDOR_ID_LOGITECH 0x046d 282 #define USB_VENDOR_ID_LOGITECH 0x046d
282 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 283 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
283 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 284 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
284 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f 285 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
285 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 286 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211
286 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 287 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215
287 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 288 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
288 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 289 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
289 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 290 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283
290 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 291 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286
291 #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 292 #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294
292 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 293 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295
293 #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a 294 #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
294 #define USB_DEVICE_ID_LOGITECH_KBD 0xc311 295 #define USB_DEVICE_ID_LOGITECH_KBD 0xc311
295 #define USB_DEVICE_ID_S510_RECEIVER 0xc50c 296 #define USB_DEVICE_ID_S510_RECEIVER 0xc50c
296 #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 297 #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517
297 #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 298 #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512
298 #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 299 #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513
299 #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 300 #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704
300 #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 301 #define USB_DEVICE_ID_DINOVO_EDGE 0xc714
301 #define USB_DEVICE_ID_DINOVO_MINI 0xc71f 302 #define USB_DEVICE_ID_DINOVO_MINI 0xc71f
302 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 303 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03
303 304
304 #define USB_VENDOR_ID_MCC 0x09db 305 #define USB_VENDOR_ID_MCC 0x09db
305 #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 306 #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
306 #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a 307 #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
307 308
308 #define USB_VENDOR_ID_MGE 0x0463 309 #define USB_VENDOR_ID_MGE 0x0463
309 #define USB_DEVICE_ID_MGE_UPS 0xffff 310 #define USB_DEVICE_ID_MGE_UPS 0xffff
310 #define USB_DEVICE_ID_MGE_UPS1 0x0001 311 #define USB_DEVICE_ID_MGE_UPS1 0x0001
311 312
312 #define USB_VENDOR_ID_MICROCHIP 0x04d8 313 #define USB_VENDOR_ID_MICROCHIP 0x04d8
313 #define USB_DEVICE_ID_PICKIT1 0x0032 314 #define USB_DEVICE_ID_PICKIT1 0x0032
314 #define USB_DEVICE_ID_PICKIT2 0x0033 315 #define USB_DEVICE_ID_PICKIT2 0x0033
315 316
316 #define USB_VENDOR_ID_MICROSOFT 0x045e 317 #define USB_VENDOR_ID_MICROSOFT 0x045e
317 #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b 318 #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
318 #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d 319 #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
319 #define USB_DEVICE_ID_MS_NE4K 0x00db 320 #define USB_DEVICE_ID_MS_NE4K 0x00db
320 #define USB_DEVICE_ID_MS_LK6K 0x00f9 321 #define USB_DEVICE_ID_MS_LK6K 0x00f9
321 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 322 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
322 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 323 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
323 324
324 325
325 #define USB_VENDOR_ID_MONTEREY 0x0566 326 #define USB_VENDOR_ID_MONTEREY 0x0566
326 #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 327 #define USB_DEVICE_ID_GENIUS_KB29E 0x3004
327 328
328 #define USB_VENDOR_ID_NCR 0x0404 329 #define USB_VENDOR_ID_NCR 0x0404
329 #define USB_DEVICE_ID_NCR_FIRST 0x0300 330 #define USB_DEVICE_ID_NCR_FIRST 0x0300
330 #define USB_DEVICE_ID_NCR_LAST 0x03ff 331 #define USB_DEVICE_ID_NCR_LAST 0x03ff
331 332
332 #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 333 #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400
333 #define USB_DEVICE_ID_N_S_HARMONY 0xc359 334 #define USB_DEVICE_ID_N_S_HARMONY 0xc359
334 335
335 #define USB_VENDOR_ID_NATSU 0x08b7 336 #define USB_VENDOR_ID_NATSU 0x08b7
336 #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 337 #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001
337 338
338 #define USB_VENDOR_ID_NEC 0x073e 339 #define USB_VENDOR_ID_NEC 0x073e
339 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 340 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301
340 341
341 #define USB_VENDOR_ID_ONTRAK 0x0a07 342 #define USB_VENDOR_ID_ONTRAK 0x0a07
342 #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 343 #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064
343 344
344 #define USB_VENDOR_ID_PANJIT 0x134c 345 #define USB_VENDOR_ID_PANJIT 0x134c
345 346
346 #define USB_VENDOR_ID_PANTHERLORD 0x0810 347 #define USB_VENDOR_ID_PANTHERLORD 0x0810
347 #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 348 #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001
348 349
349 #define USB_VENDOR_ID_PETALYNX 0x18b1 350 #define USB_VENDOR_ID_PETALYNX 0x18b1
350 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 351 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
351 352
352 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 353 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43
353 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 354 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003
354 355
355 #define USB_VENDOR_ID_SAITEK 0x06a3 356 #define USB_VENDOR_ID_SAITEK 0x06a3
356 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 357 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
357 358
358 #define USB_VENDOR_ID_SAMSUNG 0x0419 359 #define USB_VENDOR_ID_SAMSUNG 0x0419
359 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 360 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
360 361
361 #define USB_VENDOR_ID_SONY 0x054c 362 #define USB_VENDOR_ID_SONY 0x054c
362 #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b 363 #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
363 #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 364 #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
364 365
365 #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 366 #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
366 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 367 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038
367 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2 0x0036 368 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2 0x0036
368 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3 0x0034 369 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3 0x0034
369 370
370 #define USB_VENDOR_ID_SUN 0x0430 371 #define USB_VENDOR_ID_SUN 0x0430
371 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab 372 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab
372 373
373 #define USB_VENDOR_ID_SUNPLUS 0x04fc 374 #define USB_VENDOR_ID_SUNPLUS 0x04fc
374 #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 375 #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
375 376
376 #define USB_VENDOR_ID_TENX 0x1130 377 #define USB_VENDOR_ID_TENX 0x1130
377 #define USB_DEVICE_ID_TENX_IBUDDY1 0x0001 378 #define USB_DEVICE_ID_TENX_IBUDDY1 0x0001
378 #define USB_DEVICE_ID_TENX_IBUDDY2 0x0002 379 #define USB_DEVICE_ID_TENX_IBUDDY2 0x0002
379 380
380 #define USB_VENDOR_ID_THRUSTMASTER 0x044f 381 #define USB_VENDOR_ID_THRUSTMASTER 0x044f
381 382
382 #define USB_VENDOR_ID_TOPMAX 0x0663 383 #define USB_VENDOR_ID_TOPMAX 0x0663
383 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 384 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103
384 385
385 #define USB_VENDOR_ID_TURBOX 0x062a 386 #define USB_VENDOR_ID_TURBOX 0x062a
386 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 387 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
387 388
388 #define USB_VENDOR_ID_VERNIER 0x08f7 389 #define USB_VENDOR_ID_VERNIER 0x08f7
389 #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 390 #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001
390 #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 391 #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
391 #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 392 #define USB_DEVICE_ID_VERNIER_SKIP 0x0003
392 #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 393 #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
393 #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 394 #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
394 395
395 #define USB_VENDOR_ID_WACOM 0x056a 396 #define USB_VENDOR_ID_WACOM 0x056a
396 397
397 #define USB_VENDOR_ID_WISEGROUP 0x0925 398 #define USB_VENDOR_ID_WISEGROUP 0x0925
398 #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 399 #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101
399 #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 400 #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104
400 #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201 401 #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201
401 #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800 402 #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800
402 #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 403 #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866
403 404
404 #define USB_VENDOR_ID_WISEGROUP_LTD 0x6666 405 #define USB_VENDOR_ID_WISEGROUP_LTD 0x6666
405 #define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677 406 #define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677
406 #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 407 #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802
407 408
408 #define USB_VENDOR_ID_YEALINK 0x6993 409 #define USB_VENDOR_ID_YEALINK 0x6993
409 #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 410 #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001
410 411
411 #define USB_VENDOR_ID_ZEROPLUS 0x0c12 412 #define USB_VENDOR_ID_ZEROPLUS 0x0c12
412 413
413 #define USB_VENDOR_ID_KYE 0x0458 414 #define USB_VENDOR_ID_KYE 0x0458
414 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 415 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003
415 416
416 #endif 417 #endif
417 418
drivers/hid/hid-pl.c
1 /* 1 /*
2 * Force feedback support for PantherLord/GreenAsia based devices 2 * Force feedback support for PantherLord/GreenAsia based devices
3 * 3 *
4 * The devices are distributed under various names and the same USB device ID 4 * The devices are distributed under various names and the same USB device ID
5 * can be used in both adapters and actual game controllers. 5 * can be used in both adapters and actual game controllers.
6 * 6 *
7 * 0810:0001 "Twin USB Joystick" 7 * 0810:0001 "Twin USB Joystick"
8 * - tested with PantherLord USB/PS2 2in1 Adapter 8 * - tested with PantherLord USB/PS2 2in1 Adapter
9 * - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT) 9 * - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT)
10 * 10 *
11 * 0e8f:0003 "GreenAsia Inc. USB Joystick " 11 * 0e8f:0003 "GreenAsia Inc. USB Joystick "
12 * - tested with K??ng Gaming gamepad 12 * - tested with K??ng Gaming gamepad
13 * 13 *
14 * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com> 14 * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com>
15 */ 15 */
16 16
17 /* 17 /*
18 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or 20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version. 21 * (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details. 26 * GNU General Public License for more details.
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 */ 31 */
32 32
33 33
34 /* #define DEBUG */ 34 /* #define DEBUG */
35 35
36 #define debug(format, arg...) pr_debug("hid-plff: " format "\n" , ## arg) 36 #define debug(format, arg...) pr_debug("hid-plff: " format "\n" , ## arg)
37 37
38 #include <linux/input.h> 38 #include <linux/input.h>
39 #include <linux/usb.h> 39 #include <linux/usb.h>
40 #include <linux/hid.h> 40 #include <linux/hid.h>
41 41
42 #include "hid-ids.h" 42 #include "hid-ids.h"
43 43
44 #ifdef CONFIG_PANTHERLORD_FF 44 #ifdef CONFIG_PANTHERLORD_FF
45 #include "usbhid/usbhid.h" 45 #include "usbhid/usbhid.h"
46 46
47 struct plff_device { 47 struct plff_device {
48 struct hid_report *report; 48 struct hid_report *report;
49 }; 49 };
50 50
51 static int hid_plff_play(struct input_dev *dev, void *data, 51 static int hid_plff_play(struct input_dev *dev, void *data,
52 struct ff_effect *effect) 52 struct ff_effect *effect)
53 { 53 {
54 struct hid_device *hid = input_get_drvdata(dev); 54 struct hid_device *hid = input_get_drvdata(dev);
55 struct plff_device *plff = data; 55 struct plff_device *plff = data;
56 int left, right; 56 int left, right;
57 57
58 left = effect->u.rumble.strong_magnitude; 58 left = effect->u.rumble.strong_magnitude;
59 right = effect->u.rumble.weak_magnitude; 59 right = effect->u.rumble.weak_magnitude;
60 debug("called with 0x%04x 0x%04x", left, right); 60 debug("called with 0x%04x 0x%04x", left, right);
61 61
62 left = left * 0x7f / 0xffff; 62 left = left * 0x7f / 0xffff;
63 right = right * 0x7f / 0xffff; 63 right = right * 0x7f / 0xffff;
64 64
65 plff->report->field[0]->value[2] = left; 65 plff->report->field[0]->value[2] = left;
66 plff->report->field[0]->value[3] = right; 66 plff->report->field[0]->value[3] = right;
67 debug("running with 0x%02x 0x%02x", left, right); 67 debug("running with 0x%02x 0x%02x", left, right);
68 usbhid_submit_report(hid, plff->report, USB_DIR_OUT); 68 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
69 69
70 return 0; 70 return 0;
71 } 71 }
72 72
73 static int plff_init(struct hid_device *hid) 73 static int plff_init(struct hid_device *hid)
74 { 74 {
75 struct plff_device *plff; 75 struct plff_device *plff;
76 struct hid_report *report; 76 struct hid_report *report;
77 struct hid_input *hidinput; 77 struct hid_input *hidinput;
78 struct list_head *report_list = 78 struct list_head *report_list =
79 &hid->report_enum[HID_OUTPUT_REPORT].report_list; 79 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
80 struct list_head *report_ptr = report_list; 80 struct list_head *report_ptr = report_list;
81 struct input_dev *dev; 81 struct input_dev *dev;
82 int error; 82 int error;
83 83
84 /* The device contains one output report per physical device, all 84 /* The device contains one output report per physical device, all
85 containing 1 field, which contains 4 ff00.0002 usages and 4 16bit 85 containing 1 field, which contains 4 ff00.0002 usages and 4 16bit
86 absolute values. 86 absolute values.
87 87
88 The input reports also contain a field which contains 88 The input reports also contain a field which contains
89 8 ff00.0001 usages and 8 boolean values. Their meaning is 89 8 ff00.0001 usages and 8 boolean values. Their meaning is
90 currently unknown. */ 90 currently unknown. */
91 91
92 if (list_empty(report_list)) { 92 if (list_empty(report_list)) {
93 dev_err(&hid->dev, "no output reports found\n"); 93 dev_err(&hid->dev, "no output reports found\n");
94 return -ENODEV; 94 return -ENODEV;
95 } 95 }
96 96
97 list_for_each_entry(hidinput, &hid->inputs, list) { 97 list_for_each_entry(hidinput, &hid->inputs, list) {
98 98
99 report_ptr = report_ptr->next; 99 report_ptr = report_ptr->next;
100 100
101 if (report_ptr == report_list) { 101 if (report_ptr == report_list) {
102 dev_err(&hid->dev, "required output report is " 102 dev_err(&hid->dev, "required output report is "
103 "missing\n"); 103 "missing\n");
104 return -ENODEV; 104 return -ENODEV;
105 } 105 }
106 106
107 report = list_entry(report_ptr, struct hid_report, list); 107 report = list_entry(report_ptr, struct hid_report, list);
108 if (report->maxfield < 1) { 108 if (report->maxfield < 1) {
109 dev_err(&hid->dev, "no fields in the report\n"); 109 dev_err(&hid->dev, "no fields in the report\n");
110 return -ENODEV; 110 return -ENODEV;
111 } 111 }
112 112
113 if (report->field[0]->report_count < 4) { 113 if (report->field[0]->report_count < 4) {
114 dev_err(&hid->dev, "not enough values in the field\n"); 114 dev_err(&hid->dev, "not enough values in the field\n");
115 return -ENODEV; 115 return -ENODEV;
116 } 116 }
117 117
118 plff = kzalloc(sizeof(struct plff_device), GFP_KERNEL); 118 plff = kzalloc(sizeof(struct plff_device), GFP_KERNEL);
119 if (!plff) 119 if (!plff)
120 return -ENOMEM; 120 return -ENOMEM;
121 121
122 dev = hidinput->input; 122 dev = hidinput->input;
123 123
124 set_bit(FF_RUMBLE, dev->ffbit); 124 set_bit(FF_RUMBLE, dev->ffbit);
125 125
126 error = input_ff_create_memless(dev, plff, hid_plff_play); 126 error = input_ff_create_memless(dev, plff, hid_plff_play);
127 if (error) { 127 if (error) {
128 kfree(plff); 128 kfree(plff);
129 return error; 129 return error;
130 } 130 }
131 131
132 plff->report = report; 132 plff->report = report;
133 plff->report->field[0]->value[0] = 0x00; 133 plff->report->field[0]->value[0] = 0x00;
134 plff->report->field[0]->value[1] = 0x00; 134 plff->report->field[0]->value[1] = 0x00;
135 plff->report->field[0]->value[2] = 0x00; 135 plff->report->field[0]->value[2] = 0x00;
136 plff->report->field[0]->value[3] = 0x00; 136 plff->report->field[0]->value[3] = 0x00;
137 usbhid_submit_report(hid, plff->report, USB_DIR_OUT); 137 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
138 } 138 }
139 139
140 dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia " 140 dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia "
141 "devices by Anssi Hannula <anssi.hannula@gmail.com>\n"); 141 "devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
142 142
143 return 0; 143 return 0;
144 } 144 }
145 #else 145 #else
146 static inline int plff_init(struct hid_device *hid) 146 static inline int plff_init(struct hid_device *hid)
147 { 147 {
148 return 0; 148 return 0;
149 } 149 }
150 #endif 150 #endif
151 151
152 static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) 152 static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id)
153 { 153 {
154 int ret; 154 int ret;
155 155
156 if (id->driver_data) 156 if (id->driver_data)
157 hdev->quirks |= HID_QUIRK_MULTI_INPUT; 157 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
158 158
159 ret = hid_parse(hdev); 159 ret = hid_parse(hdev);
160 if (ret) { 160 if (ret) {
161 dev_err(&hdev->dev, "parse failed\n"); 161 dev_err(&hdev->dev, "parse failed\n");
162 goto err; 162 goto err;
163 } 163 }
164 164
165 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 165 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
166 if (ret) { 166 if (ret) {
167 dev_err(&hdev->dev, "hw start failed\n"); 167 dev_err(&hdev->dev, "hw start failed\n");
168 goto err; 168 goto err;
169 } 169 }
170 170
171 plff_init(hdev); 171 plff_init(hdev);
172 172
173 return 0; 173 return 0;
174 err: 174 err:
175 return ret; 175 return ret;
176 } 176 }
177 177
178 static const struct hid_device_id pl_devices[] = { 178 static const struct hid_device_id pl_devices[] = {
179 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR), 179 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR),
180 .driver_data = 1 }, /* Twin USB Joystick */ 180 .driver_data = 1 }, /* Twin USB Joystick */
181 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR),
182 .driver_data = 1 }, /* Twin USB Joystick */
181 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */ 183 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */
182 { } 184 { }
183 }; 185 };
184 MODULE_DEVICE_TABLE(hid, pl_devices); 186 MODULE_DEVICE_TABLE(hid, pl_devices);
185 187
186 static struct hid_driver pl_driver = { 188 static struct hid_driver pl_driver = {
187 .name = "pantherlord", 189 .name = "pantherlord",
188 .id_table = pl_devices, 190 .id_table = pl_devices,
189 .probe = pl_probe, 191 .probe = pl_probe,
190 }; 192 };
191 193
192 static int pl_init(void) 194 static int pl_init(void)
193 { 195 {
194 return hid_register_driver(&pl_driver); 196 return hid_register_driver(&pl_driver);
195 } 197 }
196 198
197 static void pl_exit(void) 199 static void pl_exit(void)
198 { 200 {
199 hid_unregister_driver(&pl_driver); 201 hid_unregister_driver(&pl_driver);
200 } 202 }
201 203
202 module_init(pl_init); 204 module_init(pl_init);
203 module_exit(pl_exit); 205 module_exit(pl_exit);
204 MODULE_LICENSE("GPL"); 206 MODULE_LICENSE("GPL");
205 207
206 HID_COMPAT_LOAD_DRIVER(pantherlord); 208 HID_COMPAT_LOAD_DRIVER(pantherlord);
207 209