aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-18 17:55:41 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:50 -0400
commit880d29f109428be1d027adf919a7457d8fe41fd3 (patch)
tree4f413f49e8338193ba68683d03bbea603f7380ee /drivers
parent02ae9a1a8bc1d08a8fd5f6a0b8bde400b0f891b9 (diff)
HID: indent switches/cases
Bring switch and cases into coding style and save thus some indentation to make the code tighter. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-core.c342
-rw-r--r--drivers/hid/hid-input.c585
-rw-r--r--drivers/hid/usbhid/hid-core.c103
3 files changed, 508 insertions, 522 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 397e1b2ffe5a..5e62e010d805 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -270,9 +270,9 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
270static u32 item_udata(struct hid_item *item) 270static 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}
@@ -280,9 +280,9 @@ static u32 item_udata(struct hid_item *item)
280static s32 item_sdata(struct hid_item *item) 280static 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}
@@ -294,87 +294,91 @@ static s32 item_sdata(struct hid_item *item)
294static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) 294static 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 298
298 case HID_GLOBAL_ITEM_TAG_PUSH: 299 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) {
299 300 dbg_hid("global enviroment stack overflow\n");
300 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { 301 return -1;
301 dbg_hid("global enviroment stack overflow\n"); 302 }
302 return -1;
303 }
304
305 memcpy(parser->global_stack + parser->global_stack_ptr++,
306 &parser->global, sizeof(struct hid_global));
307 return 0;
308 303
309 case HID_GLOBAL_ITEM_TAG_POP: 304 memcpy(parser->global_stack + parser->global_stack_ptr++,
305 &parser->global, sizeof(struct hid_global));
306 return 0;
310 307
311 if (!parser->global_stack_ptr) { 308 case HID_GLOBAL_ITEM_TAG_POP:
312 dbg_hid("global enviroment stack underflow\n");
313 return -1;
314 }
315 309
316 memcpy(&parser->global, parser->global_stack + --parser->global_stack_ptr, 310 if (!parser->global_stack_ptr) {
317 sizeof(struct hid_global)); 311 dbg_hid("global enviroment stack underflow\n");
318 return 0; 312 return -1;
313 }
319 314
320 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: 315 memcpy(&parser->global, parser->global_stack +
321 parser->global.usage_page = item_udata(item); 316 --parser->global_stack_ptr, sizeof(struct hid_global));
322 return 0; 317 return 0;
323 318
324 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: 319 case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:
325 parser->global.logical_minimum = item_sdata(item); 320 parser->global.usage_page = item_udata(item);
326 return 0; 321 return 0;
327 322
328 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: 323 case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM:
329 if (parser->global.logical_minimum < 0) 324 parser->global.logical_minimum = item_sdata(item);
330 parser->global.logical_maximum = item_sdata(item); 325 return 0;
331 else
332 parser->global.logical_maximum = item_udata(item);
333 return 0;
334 326
335 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: 327 case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM:
336 parser->global.physical_minimum = item_sdata(item); 328 if (parser->global.logical_minimum < 0)
337 return 0; 329 parser->global.logical_maximum = item_sdata(item);
330 else
331 parser->global.logical_maximum = item_udata(item);
332 return 0;
338 333
339 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: 334 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM:
340 if (parser->global.physical_minimum < 0) 335 parser->global.physical_minimum = item_sdata(item);
341 parser->global.physical_maximum = item_sdata(item); 336 return 0;
342 else
343 parser->global.physical_maximum = item_udata(item);
344 return 0;
345 337
346 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: 338 case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM:
347 parser->global.unit_exponent = item_sdata(item); 339 if (parser->global.physical_minimum < 0)
348 return 0; 340 parser->global.physical_maximum = item_sdata(item);
341 else
342 parser->global.physical_maximum = item_udata(item);
343 return 0;
349 344
350 case HID_GLOBAL_ITEM_TAG_UNIT: 345 case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT:
351 parser->global.unit = item_udata(item); 346 parser->global.unit_exponent = item_sdata(item);
352 return 0; 347 return 0;
353 348
354 case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: 349 case HID_GLOBAL_ITEM_TAG_UNIT:
355 if ((parser->global.report_size = item_udata(item)) > 32) { 350 parser->global.unit = item_udata(item);
356 dbg_hid("invalid report_size %d\n", parser->global.report_size); 351 return 0;
357 return -1;
358 }
359 return 0;
360 352
361 case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: 353 case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
362 if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) { 354 parser->global.report_size = item_udata(item);
363 dbg_hid("invalid report_count %d\n", parser->global.report_count); 355 if (parser->global.report_size > 32) {
364 return -1; 356 dbg_hid("invalid report_size %d\n",
365 } 357 parser->global.report_size);
366 return 0; 358 return -1;
359 }
360 return 0;
367 361
368 case HID_GLOBAL_ITEM_TAG_REPORT_ID: 362 case HID_GLOBAL_ITEM_TAG_REPORT_COUNT:
369 if ((parser->global.report_id = item_udata(item)) == 0) { 363 parser->global.report_count = item_udata(item);
370 dbg_hid("report_id 0 is invalid\n"); 364 if (parser->global.report_count > HID_MAX_USAGES) {
371 return -1; 365 dbg_hid("invalid report_count %d\n",
372 } 366 parser->global.report_count);
373 return 0; 367 return -1;
368 }
369 return 0;
374 370
375 default: 371 case HID_GLOBAL_ITEM_TAG_REPORT_ID:
376 dbg_hid("unknown global tag 0x%x\n", item->tag); 372 parser->global.report_id = item_udata(item);
373 if (parser->global.report_id == 0) {
374 dbg_hid("report_id 0 is invalid\n");
377 return -1; 375 return -1;
376 }
377 return 0;
378
379 default:
380 dbg_hid("unknown global tag 0x%x\n", item->tag);
381 return -1;
378 } 382 }
379} 383}
380 384
@@ -395,77 +399,76 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
395 data = item_udata(item); 399 data = item_udata(item);
396 400
397 switch (item->tag) { 401 switch (item->tag) {
398 402 case HID_LOCAL_ITEM_TAG_DELIMITER:
399 case HID_LOCAL_ITEM_TAG_DELIMITER: 403
400 404 if (data) {
401 if (data) { 405 /*
402 /* 406 * We treat items before the first delimiter
403 * We treat items before the first delimiter 407 * as global to all usage sets (branch 0).
404 * as global to all usage sets (branch 0). 408 * In the moment we process only these global
405 * In the moment we process only these global 409 * items and the first delimiter set.
406 * items and the first delimiter set. 410 */
407 */ 411 if (parser->local.delimiter_depth != 0) {
408 if (parser->local.delimiter_depth != 0) { 412 dbg_hid("nested delimiters\n");
409 dbg_hid("nested delimiters\n"); 413 return -1;
410 return -1;
411 }
412 parser->local.delimiter_depth++;
413 parser->local.delimiter_branch++;
414 } else {
415 if (parser->local.delimiter_depth < 1) {
416 dbg_hid("bogus close delimiter\n");
417 return -1;
418 }
419 parser->local.delimiter_depth--;
420 } 414 }
421 return 1; 415 parser->local.delimiter_depth++;
422 416 parser->local.delimiter_branch++;
423 case HID_LOCAL_ITEM_TAG_USAGE: 417 } else {
424 418 if (parser->local.delimiter_depth < 1) {
425 if (parser->local.delimiter_branch > 1) { 419 dbg_hid("bogus close delimiter\n");
426 dbg_hid("alternative usage ignored\n"); 420 return -1;
427 return 0;
428 } 421 }
422 parser->local.delimiter_depth--;
423 }
424 return 1;
429 425
430 if (item->size <= 2) 426 case HID_LOCAL_ITEM_TAG_USAGE:
431 data = (parser->global.usage_page << 16) + data;
432 427
433 return hid_add_usage(parser, data); 428 if (parser->local.delimiter_branch > 1) {
429 dbg_hid("alternative usage ignored\n");
430 return 0;
431 }
434 432
435 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: 433 if (item->size <= 2)
434 data = (parser->global.usage_page << 16) + data;
436 435
437 if (parser->local.delimiter_branch > 1) { 436 return hid_add_usage(parser, data);
438 dbg_hid("alternative usage ignored\n");
439 return 0;
440 }
441 437
442 if (item->size <= 2) 438 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
443 data = (parser->global.usage_page << 16) + data;
444 439
445 parser->local.usage_minimum = data; 440 if (parser->local.delimiter_branch > 1) {
441 dbg_hid("alternative usage ignored\n");
446 return 0; 442 return 0;
443 }
447 444
448 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: 445 if (item->size <= 2)
446 data = (parser->global.usage_page << 16) + data;
449 447
450 if (parser->local.delimiter_branch > 1) { 448 parser->local.usage_minimum = data;
451 dbg_hid("alternative usage ignored\n"); 449 return 0;
452 return 0;
453 }
454 450
455 if (item->size <= 2) 451 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
456 data = (parser->global.usage_page << 16) + data;
457 452
458 for (n = parser->local.usage_minimum; n <= data; n++) 453 if (parser->local.delimiter_branch > 1) {
459 if (hid_add_usage(parser, n)) { 454 dbg_hid("alternative usage ignored\n");
460 dbg_hid("hid_add_usage failed\n");
461 return -1;
462 }
463 return 0; 455 return 0;
456 }
464 457
465 default: 458 if (item->size <= 2)
459 data = (parser->global.usage_page << 16) + data;
466 460
467 dbg_hid("unknown local item tag 0x%x\n", item->tag); 461 for (n = parser->local.usage_minimum; n <= data; n++)
468 return 0; 462 if (hid_add_usage(parser, n)) {
463 dbg_hid("hid_add_usage failed\n");
464 return -1;
465 }
466 return 0;
467
468 default:
469
470 dbg_hid("unknown local item tag 0x%x\n", item->tag);
471 return 0;
469 } 472 }
470 return 0; 473 return 0;
471} 474}
@@ -482,24 +485,24 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
482 data = item_udata(item); 485 data = item_udata(item);
483 486
484 switch (item->tag) { 487 switch (item->tag) {
485 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: 488 case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION:
486 ret = open_collection(parser, data & 0xff); 489 ret = open_collection(parser, data & 0xff);
487 break; 490 break;
488 case HID_MAIN_ITEM_TAG_END_COLLECTION: 491 case HID_MAIN_ITEM_TAG_END_COLLECTION:
489 ret = close_collection(parser); 492 ret = close_collection(parser);
490 break; 493 break;
491 case HID_MAIN_ITEM_TAG_INPUT: 494 case HID_MAIN_ITEM_TAG_INPUT:
492 ret = hid_add_field(parser, HID_INPUT_REPORT, data); 495 ret = hid_add_field(parser, HID_INPUT_REPORT, data);
493 break; 496 break;
494 case HID_MAIN_ITEM_TAG_OUTPUT: 497 case HID_MAIN_ITEM_TAG_OUTPUT:
495 ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); 498 ret = hid_add_field(parser, HID_OUTPUT_REPORT, data);
496 break; 499 break;
497 case HID_MAIN_ITEM_TAG_FEATURE: 500 case HID_MAIN_ITEM_TAG_FEATURE:
498 ret = hid_add_field(parser, HID_FEATURE_REPORT, data); 501 ret = hid_add_field(parser, HID_FEATURE_REPORT, data);
499 break; 502 break;
500 default: 503 default:
501 dbg_hid("unknown main item tag 0x%x\n", item->tag); 504 dbg_hid("unknown main item tag 0x%x\n", item->tag);
502 ret = 0; 505 ret = 0;
503 } 506 }
504 507
505 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 */
@@ -595,30 +598,29 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
595 item->size = b & 3; 598 item->size = b & 3;
596 599
597 switch (item->size) { 600 switch (item->size) {
601 case 0:
602 return start;
603
604 case 1:
605 if ((end - start) < 1)
606 return NULL;
607 item->data.u8 = *start++;
608 return start;
609
610 case 2:
611 if ((end - start) < 2)
612 return NULL;
613 item->data.u16 = get_unaligned_le16(start);
614 start = (__u8 *)((__le16 *)start + 1);
615 return start;
598 616
599 case 0: 617 case 3:
600 return start; 618 item->size++;
601 619 if ((end - start) < 4)
602 case 1: 620 return NULL;
603 if ((end - start) < 1) 621 item->data.u32 = get_unaligned_le32(start);
604 return NULL; 622 start = (__u8 *)((__le32 *)start + 1);
605 item->data.u8 = *start++; 623 return start;
606 return start;
607
608 case 2:
609 if ((end - start) < 2)
610 return NULL;
611 item->data.u16 = get_unaligned_le16(start);
612 start = (__u8 *)((__le16 *)start + 1);
613 return start;
614
615 case 3:
616 item->size++;
617 if ((end - start) < 4)
618 return NULL;
619 item->data.u32 = get_unaligned_le32(start);
620 start = (__u8 *)((__le32 *)start + 1);
621 return start;
622 } 624 }
623 625
624 return NULL; 626 return NULL;
@@ -713,9 +715,9 @@ EXPORT_SYMBOL_GPL(hid_parse_report);
713static s32 snto32(__u32 value, unsigned n) 715static s32 snto32(__u32 value, unsigned n)
714{ 716{
715 switch (n) { 717 switch (n) {
716 case 8: return ((__s8)value); 718 case 8: return ((__s8)value);
717 case 16: return ((__s16)value); 719 case 16: return ((__s16)value);
718 case 32: return ((__s32)value); 720 case 32: return ((__s32)value);
719 } 721 }
720 return value & (1 << (n - 1)) ? value | (-1 << n) : value; 722 return value & (1 << (n - 1)) ? value | (-1 << n) : value;
721} 723}
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 76ddf23f1965..a6223bc5c734 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -188,343 +188,326 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
188 } 188 }
189 189
190 switch (usage->hid & HID_USAGE_PAGE) { 190 switch (usage->hid & HID_USAGE_PAGE) {
191 case HID_UP_UNDEFINED:
192 goto ignore;
191 193
192 case HID_UP_UNDEFINED: 194 case HID_UP_KEYBOARD:
193 goto ignore; 195 set_bit(EV_REP, input->evbit);
194
195 case HID_UP_KEYBOARD:
196 196
197 set_bit(EV_REP, input->evbit); 197 if ((usage->hid & HID_USAGE) < 256) {
198 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore;
199 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]);
200 } else
201 map_key(KEY_UNKNOWN);
198 202
199 if ((usage->hid & HID_USAGE) < 256) { 203 break;
200 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore;
201 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]);
202 } else
203 map_key(KEY_UNKNOWN);
204 204
205 break; 205 case HID_UP_BUTTON:
206 code = ((usage->hid - 1) & 0xf);
206 207
207 case HID_UP_BUTTON: 208 switch (field->application) {
208 209 case HID_GD_MOUSE:
209 code = ((usage->hid - 1) & 0xf); 210 case HID_GD_POINTER: code += 0x110; break;
210 211 case HID_GD_JOYSTICK: code += 0x120; break;
211 switch (field->application) { 212 case HID_GD_GAMEPAD: code += 0x130; break;
212 case HID_GD_MOUSE: 213 default:
213 case HID_GD_POINTER: code += 0x110; break; 214 switch (field->physical) {
214 case HID_GD_JOYSTICK: code += 0x120; break; 215 case HID_GD_MOUSE:
215 case HID_GD_GAMEPAD: code += 0x130; break; 216 case HID_GD_POINTER: code += 0x110; break;
216 default: 217 case HID_GD_JOYSTICK: code += 0x120; break;
217 switch (field->physical) { 218 case HID_GD_GAMEPAD: code += 0x130; break;
218 case HID_GD_MOUSE: 219 default: code += 0x100;
219 case HID_GD_POINTER: code += 0x110; break;
220 case HID_GD_JOYSTICK: code += 0x120; break;
221 case HID_GD_GAMEPAD: code += 0x130; break;
222 default: code += 0x100;
223 }
224 } 220 }
221 }
225 222
226 map_key(code); 223 map_key(code);
227 break; 224 break;
228 225
229 226 case HID_UP_SIMULATION:
230 case HID_UP_SIMULATION: 227 switch (usage->hid & 0xffff) {
231 228 case 0xba: map_abs(ABS_RUDDER); break;
232 switch (usage->hid & 0xffff) { 229 case 0xbb: map_abs(ABS_THROTTLE); break;
233 case 0xba: map_abs(ABS_RUDDER); break; 230 case 0xc4: map_abs(ABS_GAS); break;
234 case 0xbb: map_abs(ABS_THROTTLE); break; 231 case 0xc5: map_abs(ABS_BRAKE); break;
235 case 0xc4: map_abs(ABS_GAS); break; 232 case 0xc8: map_abs(ABS_WHEEL); break;
236 case 0xc5: map_abs(ABS_BRAKE); break; 233 default: goto ignore;
237 case 0xc8: map_abs(ABS_WHEEL); break; 234 }
238 default: goto ignore; 235 break;
236
237 case HID_UP_GENDESK:
238 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
239 switch (usage->hid & 0xf) {
240 case 0x1: map_key_clear(KEY_POWER); break;
241 case 0x2: map_key_clear(KEY_SLEEP); break;
242 case 0x3: map_key_clear(KEY_WAKEUP); break;
243 default: goto unknown;
239 } 244 }
240 break; 245 break;
246 }
241 247
242 case HID_UP_GENDESK: 248 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
243
244 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
245 switch (usage->hid & 0xf) {
246 case 0x1: map_key_clear(KEY_POWER); break;
247 case 0x2: map_key_clear(KEY_SLEEP); break;
248 case 0x3: map_key_clear(KEY_WAKEUP); break;
249 default: goto unknown;
250 }
251 break;
252 }
253
254 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
255 switch (usage->hid) {
256 case HID_GD_UP: usage->hat_dir = 1; break;
257 case HID_GD_DOWN: usage->hat_dir = 5; break;
258 case HID_GD_RIGHT: usage->hat_dir = 3; break;
259 case HID_GD_LEFT: usage->hat_dir = 7; break;
260 default: goto unknown;
261 }
262 if (field->dpad) {
263 map_abs(field->dpad);
264 goto ignore;
265 }
266 map_abs(ABS_HAT0X);
267 break;
268 }
269
270 switch (usage->hid) { 249 switch (usage->hid) {
271 250 case HID_GD_UP: usage->hat_dir = 1; break;
272 /* These usage IDs map directly to the usage codes. */ 251 case HID_GD_DOWN: usage->hat_dir = 5; break;
273 case HID_GD_X: case HID_GD_Y: case HID_GD_Z: 252 case HID_GD_RIGHT: usage->hat_dir = 3; break;
274 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 253 case HID_GD_LEFT: usage->hat_dir = 7; break;
275 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: 254 default: goto unknown;
276 if (field->flags & HID_MAIN_ITEM_RELATIVE)
277 map_rel(usage->hid & 0xf);
278 else
279 map_abs(usage->hid & 0xf);
280 break;
281
282 case HID_GD_HATSWITCH:
283 usage->hat_min = field->logical_minimum;
284 usage->hat_max = field->logical_maximum;
285 map_abs(ABS_HAT0X);
286 break;
287
288 case HID_GD_START: map_key_clear(BTN_START); break;
289 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break;
290
291 default: goto unknown;
292 } 255 }
293 256 if (field->dpad) {
294 break; 257 map_abs(field->dpad);
295 258 goto ignore;
296 case HID_UP_LED:
297
298 switch (usage->hid & 0xffff) { /* HID-Value: */
299 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
300 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
301 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
302 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
303 case 0x05: map_led (LED_KANA); break; /* "Kana" */
304 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
305 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
306 case 0x09: map_led (LED_MUTE); break; /* "Mute" */
307 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
308 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
309 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
310
311 default: goto ignore;
312 } 259 }
260 map_abs(ABS_HAT0X);
313 break; 261 break;
262 }
314 263
315 case HID_UP_DIGITIZER: 264 switch (usage->hid) {
316 265 /* These usage IDs map directly to the usage codes. */
317 switch (usage->hid & 0xff) { 266 case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
318 267 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
319 case 0x30: /* TipPressure */ 268 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:
320 if (!test_bit(BTN_TOUCH, input->keybit)) { 269 if (field->flags & HID_MAIN_ITEM_RELATIVE)
321 device->quirks |= HID_QUIRK_NOTOUCH; 270 map_rel(usage->hid & 0xf);
322 set_bit(EV_KEY, input->evbit); 271 else
323 set_bit(BTN_TOUCH, input->keybit); 272 map_abs(usage->hid & 0xf);
324 } 273 break;
325
326 map_abs_clear(ABS_PRESSURE);
327 break;
328
329 case 0x32: /* InRange */
330 switch (field->physical & 0xff) {
331 case 0x21: map_key(BTN_TOOL_MOUSE); break;
332 case 0x22: map_key(BTN_TOOL_FINGER); break;
333 default: map_key(BTN_TOOL_PEN); break;
334 }
335 break;
336 274
337 case 0x3c: /* Invert */ 275 case HID_GD_HATSWITCH:
338 map_key_clear(BTN_TOOL_RUBBER); 276 usage->hat_min = field->logical_minimum;
339 break; 277 usage->hat_max = field->logical_maximum;
278 map_abs(ABS_HAT0X);
279 break;
340 280
341 case 0x33: /* Touch */ 281 case HID_GD_START: map_key_clear(BTN_START); break;
342 case 0x42: /* TipSwitch */ 282 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break;
343 case 0x43: /* TipSwitch2 */
344 device->quirks &= ~HID_QUIRK_NOTOUCH;
345 map_key_clear(BTN_TOUCH);
346 break;
347 283
348 case 0x44: /* BarrelSwitch */ 284 default: goto unknown;
349 map_key_clear(BTN_STYLUS); 285 }
350 break;
351 286
352 default: goto unknown; 287 break;
288
289 case HID_UP_LED:
290 switch (usage->hid & 0xffff) { /* HID-Value: */
291 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
292 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
293 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
294 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
295 case 0x05: map_led (LED_KANA); break; /* "Kana" */
296 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
297 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
298 case 0x09: map_led (LED_MUTE); break; /* "Mute" */
299 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
300 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
301 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
302
303 default: goto ignore;
304 }
305 break;
306
307 case HID_UP_DIGITIZER:
308 switch (usage->hid & 0xff) {
309 case 0x30: /* TipPressure */
310 if (!test_bit(BTN_TOUCH, input->keybit)) {
311 device->quirks |= HID_QUIRK_NOTOUCH;
312 set_bit(EV_KEY, input->evbit);
313 set_bit(BTN_TOUCH, input->keybit);
353 } 314 }
315 map_abs_clear(ABS_PRESSURE);
354 break; 316 break;
355 317
356 case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */ 318 case 0x32: /* InRange */
357 319 switch (field->physical & 0xff) {
358 switch (usage->hid & HID_USAGE) { 320 case 0x21: map_key(BTN_TOOL_MOUSE); break;
359 case 0x000: goto ignore; 321 case 0x22: map_key(BTN_TOOL_FINGER); break;
360 case 0x034: map_key_clear(KEY_SLEEP); break; 322 default: map_key(BTN_TOOL_PEN); break;
361 case 0x036: map_key_clear(BTN_MISC); break;
362
363 case 0x040: map_key_clear(KEY_MENU); break;
364 case 0x045: map_key_clear(KEY_RADIO); break;
365
366 case 0x083: map_key_clear(KEY_LAST); break;
367 case 0x088: map_key_clear(KEY_PC); break;
368 case 0x089: map_key_clear(KEY_TV); break;
369 case 0x08a: map_key_clear(KEY_WWW); break;
370 case 0x08b: map_key_clear(KEY_DVD); break;
371 case 0x08c: map_key_clear(KEY_PHONE); break;
372 case 0x08d: map_key_clear(KEY_PROGRAM); break;
373 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break;
374 case 0x08f: map_key_clear(KEY_GAMES); break;
375 case 0x090: map_key_clear(KEY_MEMO); break;
376 case 0x091: map_key_clear(KEY_CD); break;
377 case 0x092: map_key_clear(KEY_VCR); break;
378 case 0x093: map_key_clear(KEY_TUNER); break;
379 case 0x094: map_key_clear(KEY_EXIT); break;
380 case 0x095: map_key_clear(KEY_HELP); break;
381 case 0x096: map_key_clear(KEY_TAPE); break;
382 case 0x097: map_key_clear(KEY_TV2); break;
383 case 0x098: map_key_clear(KEY_SAT); break;
384 case 0x09a: map_key_clear(KEY_PVR); break;
385
386 case 0x09c: map_key_clear(KEY_CHANNELUP); break;
387 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break;
388 case 0x0a0: map_key_clear(KEY_VCR2); break;
389
390 case 0x0b0: map_key_clear(KEY_PLAY); break;
391 case 0x0b1: map_key_clear(KEY_PAUSE); break;
392 case 0x0b2: map_key_clear(KEY_RECORD); break;
393 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break;
394 case 0x0b4: map_key_clear(KEY_REWIND); break;
395 case 0x0b5: map_key_clear(KEY_NEXTSONG); break;
396 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break;
397 case 0x0b7: map_key_clear(KEY_STOPCD); break;
398 case 0x0b8: map_key_clear(KEY_EJECTCD); break;
399 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break;
400
401 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
402 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
403 case 0x0e2: map_key_clear(KEY_MUTE); break;
404 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
405 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
406 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
407
408 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
409 case 0x183: map_key_clear(KEY_CONFIG); break;
410 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
411 case 0x185: map_key_clear(KEY_EDITOR); break;
412 case 0x186: map_key_clear(KEY_SPREADSHEET); break;
413 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break;
414 case 0x188: map_key_clear(KEY_PRESENTATION); break;
415 case 0x189: map_key_clear(KEY_DATABASE); break;
416 case 0x18a: map_key_clear(KEY_MAIL); break;
417 case 0x18b: map_key_clear(KEY_NEWS); break;
418 case 0x18c: map_key_clear(KEY_VOICEMAIL); break;
419 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break;
420 case 0x18e: map_key_clear(KEY_CALENDAR); break;
421 case 0x191: map_key_clear(KEY_FINANCE); break;
422 case 0x192: map_key_clear(KEY_CALC); break;
423 case 0x194: map_key_clear(KEY_FILE); break;
424 case 0x196: map_key_clear(KEY_WWW); break;
425 case 0x19c: map_key_clear(KEY_LOGOFF); break;
426 case 0x19e: map_key_clear(KEY_COFFEE); break;
427 case 0x1a6: map_key_clear(KEY_HELP); break;
428 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
429 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
430 case 0x1b6: map_key_clear(KEY_MEDIA); break;
431 case 0x1b7: map_key_clear(KEY_SOUND); break;
432 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
433 case 0x1bd: map_key_clear(KEY_INFO); break;
434 case 0x201: map_key_clear(KEY_NEW); break;
435 case 0x202: map_key_clear(KEY_OPEN); break;
436 case 0x203: map_key_clear(KEY_CLOSE); break;
437 case 0x204: map_key_clear(KEY_EXIT); break;
438 case 0x207: map_key_clear(KEY_SAVE); break;
439 case 0x208: map_key_clear(KEY_PRINT); break;
440 case 0x209: map_key_clear(KEY_PROPS); break;
441 case 0x21a: map_key_clear(KEY_UNDO); break;
442 case 0x21b: map_key_clear(KEY_COPY); break;
443 case 0x21c: map_key_clear(KEY_CUT); break;
444 case 0x21d: map_key_clear(KEY_PASTE); break;
445 case 0x21f: map_key_clear(KEY_FIND); break;
446 case 0x221: map_key_clear(KEY_SEARCH); break;
447 case 0x222: map_key_clear(KEY_GOTO); break;
448 case 0x223: map_key_clear(KEY_HOMEPAGE); break;
449 case 0x224: map_key_clear(KEY_BACK); break;
450 case 0x225: map_key_clear(KEY_FORWARD); break;
451 case 0x226: map_key_clear(KEY_STOP); break;
452 case 0x227: map_key_clear(KEY_REFRESH); break;
453 case 0x22a: map_key_clear(KEY_BOOKMARKS); break;
454 case 0x22d: map_key_clear(KEY_ZOOMIN); break;
455 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;
456 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;
457 case 0x233: map_key_clear(KEY_SCROLLUP); break;
458 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
459 case 0x238: map_rel(REL_HWHEEL); break;
460 case 0x25f: map_key_clear(KEY_CANCEL); break;
461 case 0x279: map_key_clear(KEY_REDO); break;
462
463 case 0x289: map_key_clear(KEY_REPLY); break;
464 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
465 case 0x28c: map_key_clear(KEY_SEND); break;
466
467 default: goto ignore;
468 } 323 }
469 break; 324 break;
470 325
471 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ 326 case 0x3c: /* Invert */
472 327 map_key_clear(BTN_TOOL_RUBBER);
473 set_bit(EV_REP, input->evbit);
474 switch (usage->hid & HID_USAGE) {
475 case 0x021: map_key_clear(KEY_PRINT); break;
476 case 0x070: map_key_clear(KEY_HP); break;
477 case 0x071: map_key_clear(KEY_CAMERA); break;
478 case 0x072: map_key_clear(KEY_SOUND); break;
479 case 0x073: map_key_clear(KEY_QUESTION); break;
480 case 0x080: map_key_clear(KEY_EMAIL); break;
481 case 0x081: map_key_clear(KEY_CHAT); break;
482 case 0x082: map_key_clear(KEY_SEARCH); break;
483 case 0x083: map_key_clear(KEY_CONNECT); break;
484 case 0x084: map_key_clear(KEY_FINANCE); break;
485 case 0x085: map_key_clear(KEY_SPORT); break;
486 case 0x086: map_key_clear(KEY_SHOP); break;
487 default: goto ignore;
488 }
489 break; 328 break;
490 329
491 case HID_UP_MSVENDOR: 330 case 0x33: /* Touch */
492 331 case 0x42: /* TipSwitch */
493 goto ignore; 332 case 0x43: /* TipSwitch2 */
333 device->quirks &= ~HID_QUIRK_NOTOUCH;
334 map_key_clear(BTN_TOUCH);
335 break;
494 336
495 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ 337 case 0x44: /* BarrelSwitch */
338 map_key_clear(BTN_STYLUS);
339 break;
496 340
497 set_bit(EV_REP, input->evbit); 341 default: goto unknown;
498 goto ignore; 342 }
343 break;
344
345 case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */
346 switch (usage->hid & HID_USAGE) {
347 case 0x000: goto ignore;
348 case 0x034: map_key_clear(KEY_SLEEP); break;
349 case 0x036: map_key_clear(BTN_MISC); break;
350
351 case 0x040: map_key_clear(KEY_MENU); break;
352 case 0x045: map_key_clear(KEY_RADIO); break;
353
354 case 0x083: map_key_clear(KEY_LAST); break;
355 case 0x088: map_key_clear(KEY_PC); break;
356 case 0x089: map_key_clear(KEY_TV); break;
357 case 0x08a: map_key_clear(KEY_WWW); break;
358 case 0x08b: map_key_clear(KEY_DVD); break;
359 case 0x08c: map_key_clear(KEY_PHONE); break;
360 case 0x08d: map_key_clear(KEY_PROGRAM); break;
361 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break;
362 case 0x08f: map_key_clear(KEY_GAMES); break;
363 case 0x090: map_key_clear(KEY_MEMO); break;
364 case 0x091: map_key_clear(KEY_CD); break;
365 case 0x092: map_key_clear(KEY_VCR); break;
366 case 0x093: map_key_clear(KEY_TUNER); break;
367 case 0x094: map_key_clear(KEY_EXIT); break;
368 case 0x095: map_key_clear(KEY_HELP); break;
369 case 0x096: map_key_clear(KEY_TAPE); break;
370 case 0x097: map_key_clear(KEY_TV2); break;
371 case 0x098: map_key_clear(KEY_SAT); break;
372 case 0x09a: map_key_clear(KEY_PVR); break;
373
374 case 0x09c: map_key_clear(KEY_CHANNELUP); break;
375 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break;
376 case 0x0a0: map_key_clear(KEY_VCR2); break;
377
378 case 0x0b0: map_key_clear(KEY_PLAY); break;
379 case 0x0b1: map_key_clear(KEY_PAUSE); break;
380 case 0x0b2: map_key_clear(KEY_RECORD); break;
381 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break;
382 case 0x0b4: map_key_clear(KEY_REWIND); break;
383 case 0x0b5: map_key_clear(KEY_NEXTSONG); break;
384 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break;
385 case 0x0b7: map_key_clear(KEY_STOPCD); break;
386 case 0x0b8: map_key_clear(KEY_EJECTCD); break;
387 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break;
388
389 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
390 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
391 case 0x0e2: map_key_clear(KEY_MUTE); break;
392 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
393 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
394 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
395
396 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
397 case 0x183: map_key_clear(KEY_CONFIG); break;
398 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
399 case 0x185: map_key_clear(KEY_EDITOR); break;
400 case 0x186: map_key_clear(KEY_SPREADSHEET); break;
401 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break;
402 case 0x188: map_key_clear(KEY_PRESENTATION); break;
403 case 0x189: map_key_clear(KEY_DATABASE); break;
404 case 0x18a: map_key_clear(KEY_MAIL); break;
405 case 0x18b: map_key_clear(KEY_NEWS); break;
406 case 0x18c: map_key_clear(KEY_VOICEMAIL); break;
407 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break;
408 case 0x18e: map_key_clear(KEY_CALENDAR); break;
409 case 0x191: map_key_clear(KEY_FINANCE); break;
410 case 0x192: map_key_clear(KEY_CALC); break;
411 case 0x194: map_key_clear(KEY_FILE); break;
412 case 0x196: map_key_clear(KEY_WWW); break;
413 case 0x19c: map_key_clear(KEY_LOGOFF); break;
414 case 0x19e: map_key_clear(KEY_COFFEE); break;
415 case 0x1a6: map_key_clear(KEY_HELP); break;
416 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
417 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
418 case 0x1b6: map_key_clear(KEY_MEDIA); break;
419 case 0x1b7: map_key_clear(KEY_SOUND); break;
420 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
421 case 0x1bd: map_key_clear(KEY_INFO); break;
422 case 0x201: map_key_clear(KEY_NEW); break;
423 case 0x202: map_key_clear(KEY_OPEN); break;
424 case 0x203: map_key_clear(KEY_CLOSE); break;
425 case 0x204: map_key_clear(KEY_EXIT); break;
426 case 0x207: map_key_clear(KEY_SAVE); break;
427 case 0x208: map_key_clear(KEY_PRINT); break;
428 case 0x209: map_key_clear(KEY_PROPS); break;
429 case 0x21a: map_key_clear(KEY_UNDO); break;
430 case 0x21b: map_key_clear(KEY_COPY); break;
431 case 0x21c: map_key_clear(KEY_CUT); break;
432 case 0x21d: map_key_clear(KEY_PASTE); break;
433 case 0x21f: map_key_clear(KEY_FIND); break;
434 case 0x221: map_key_clear(KEY_SEARCH); break;
435 case 0x222: map_key_clear(KEY_GOTO); break;
436 case 0x223: map_key_clear(KEY_HOMEPAGE); break;
437 case 0x224: map_key_clear(KEY_BACK); break;
438 case 0x225: map_key_clear(KEY_FORWARD); break;
439 case 0x226: map_key_clear(KEY_STOP); break;
440 case 0x227: map_key_clear(KEY_REFRESH); break;
441 case 0x22a: map_key_clear(KEY_BOOKMARKS); break;
442 case 0x22d: map_key_clear(KEY_ZOOMIN); break;
443 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;
444 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;
445 case 0x233: map_key_clear(KEY_SCROLLUP); break;
446 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
447 case 0x238: map_rel(REL_HWHEEL); break;
448 case 0x25f: map_key_clear(KEY_CANCEL); break;
449 case 0x279: map_key_clear(KEY_REDO); break;
450
451 case 0x289: map_key_clear(KEY_REPLY); break;
452 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
453 case 0x28c: map_key_clear(KEY_SEND); break;
454
455 default: goto ignore;
456 }
457 break;
458
459 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */
460 set_bit(EV_REP, input->evbit);
461 switch (usage->hid & HID_USAGE) {
462 case 0x021: map_key_clear(KEY_PRINT); break;
463 case 0x070: map_key_clear(KEY_HP); break;
464 case 0x071: map_key_clear(KEY_CAMERA); break;
465 case 0x072: map_key_clear(KEY_SOUND); break;
466 case 0x073: map_key_clear(KEY_QUESTION); break;
467 case 0x080: map_key_clear(KEY_EMAIL); break;
468 case 0x081: map_key_clear(KEY_CHAT); break;
469 case 0x082: map_key_clear(KEY_SEARCH); break;
470 case 0x083: map_key_clear(KEY_CONNECT); break;
471 case 0x084: map_key_clear(KEY_FINANCE); break;
472 case 0x085: map_key_clear(KEY_SPORT); break;
473 case 0x086: map_key_clear(KEY_SHOP); break;
474 default: goto ignore;
475 }
476 break;
499 477
500 case HID_UP_LOGIVENDOR: 478 case HID_UP_MSVENDOR:
479 goto ignore;
501 480
502 goto ignore; 481 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */
503 482 set_bit(EV_REP, input->evbit);
504 case HID_UP_PID: 483 goto ignore;
505 484
506 switch(usage->hid & HID_USAGE) { 485 case HID_UP_LOGIVENDOR:
507 case 0xa4: map_key_clear(BTN_DEAD); break; 486 goto ignore;
508 default: goto ignore; 487
509 } 488 case HID_UP_PID:
510 break; 489 switch (usage->hid & HID_USAGE) {
490 case 0xa4: map_key_clear(BTN_DEAD); break;
491 default: goto ignore;
492 }
493 break;
511 494
512 default: 495 default:
513 unknown: 496 unknown:
514 if (field->report_size == 1) { 497 if (field->report_size == 1) {
515 if (field->report->type == HID_OUTPUT_REPORT) { 498 if (field->report->type == HID_OUTPUT_REPORT) {
516 map_led(LED_MISC); 499 map_led(LED_MISC);
517 break;
518 }
519 map_key(BTN_MISC);
520 break;
521 }
522 if (field->flags & HID_MAIN_ITEM_RELATIVE) {
523 map_rel(REL_MISC);
524 break; 500 break;
525 } 501 }
526 map_abs(ABS_MISC); 502 map_key(BTN_MISC);
527 break; 503 break;
504 }
505 if (field->flags & HID_MAIN_ITEM_RELATIVE) {
506 map_rel(REL_MISC);
507 break;
508 }
509 map_abs(ABS_MISC);
510 break;
528 } 511 }
529 512
530mapped: 513mapped:
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 972680820730..78553b457a2b 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -197,31 +197,31 @@ static void hid_irq_in(struct urb *urb)
197 int status; 197 int status;
198 198
199 switch (urb->status) { 199 switch (urb->status) {
200 case 0: /* success */ 200 case 0: /* success */
201 usbhid->retry_delay = 0; 201 usbhid->retry_delay = 0;
202 hid_input_report(urb->context, HID_INPUT_REPORT, 202 hid_input_report(urb->context, HID_INPUT_REPORT,
203 urb->transfer_buffer, 203 urb->transfer_buffer,
204 urb->actual_length, 1); 204 urb->actual_length, 1);
205 break; 205 break;
206 case -EPIPE: /* stall */ 206 case -EPIPE: /* stall */
207 clear_bit(HID_IN_RUNNING, &usbhid->iofl); 207 clear_bit(HID_IN_RUNNING, &usbhid->iofl);
208 set_bit(HID_CLEAR_HALT, &usbhid->iofl); 208 set_bit(HID_CLEAR_HALT, &usbhid->iofl);
209 schedule_work(&usbhid->reset_work); 209 schedule_work(&usbhid->reset_work);
210 return; 210 return;
211 case -ECONNRESET: /* unlink */ 211 case -ECONNRESET: /* unlink */
212 case -ENOENT: 212 case -ENOENT:
213 case -ESHUTDOWN: /* unplug */ 213 case -ESHUTDOWN: /* unplug */
214 clear_bit(HID_IN_RUNNING, &usbhid->iofl); 214 clear_bit(HID_IN_RUNNING, &usbhid->iofl);
215 return; 215 return;
216 case -EILSEQ: /* protocol error or unplug */ 216 case -EILSEQ: /* protocol error or unplug */
217 case -EPROTO: /* protocol error or unplug */ 217 case -EPROTO: /* protocol error or unplug */
218 case -ETIME: /* protocol error or unplug */ 218 case -ETIME: /* protocol error or unplug */
219 case -ETIMEDOUT: /* Should never happen, but... */ 219 case -ETIMEDOUT: /* Should never happen, but... */
220 clear_bit(HID_IN_RUNNING, &usbhid->iofl); 220 clear_bit(HID_IN_RUNNING, &usbhid->iofl);
221 hid_io_error(hid); 221 hid_io_error(hid);
222 return; 222 return;
223 default: /* error */ 223 default: /* error */
224 warn("input irq status %d received", urb->status); 224 warn("input irq status %d received", urb->status);
225 } 225 }
226 226
227 status = usb_submit_urb(urb, GFP_ATOMIC); 227 status = usb_submit_urb(urb, GFP_ATOMIC);
@@ -319,17 +319,17 @@ static void hid_irq_out(struct urb *urb)
319 int unplug = 0; 319 int unplug = 0;
320 320
321 switch (urb->status) { 321 switch (urb->status) {
322 case 0: /* success */ 322 case 0: /* success */
323 break; 323 break;
324 case -ESHUTDOWN: /* unplug */ 324 case -ESHUTDOWN: /* unplug */
325 unplug = 1; 325 unplug = 1;
326 case -EILSEQ: /* protocol error or unplug */ 326 case -EILSEQ: /* protocol error or unplug */
327 case -EPROTO: /* protocol error or unplug */ 327 case -EPROTO: /* protocol error or unplug */
328 case -ECONNRESET: /* unlink */ 328 case -ECONNRESET: /* unlink */
329 case -ENOENT: 329 case -ENOENT:
330 break; 330 break;
331 default: /* error */ 331 default: /* error */
332 warn("output irq status %d received", urb->status); 332 warn("output irq status %d received", urb->status);
333 } 333 }
334 334
335 spin_lock_irqsave(&usbhid->outlock, flags); 335 spin_lock_irqsave(&usbhid->outlock, flags);
@@ -367,21 +367,22 @@ static void hid_ctrl(struct urb *urb)
367 spin_lock_irqsave(&usbhid->ctrllock, flags); 367 spin_lock_irqsave(&usbhid->ctrllock, flags);
368 368
369 switch (urb->status) { 369 switch (urb->status) {
370 case 0: /* success */ 370 case 0: /* success */
371 if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) 371 if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
372 hid_input_report(urb->context, usbhid->ctrl[usbhid->ctrltail].report->type, 372 hid_input_report(urb->context,
373 urb->transfer_buffer, urb->actual_length, 0); 373 usbhid->ctrl[usbhid->ctrltail].report->type,
374 break; 374 urb->transfer_buffer, urb->actual_length, 0);
375 case -ESHUTDOWN: /* unplug */ 375 break;
376 unplug = 1; 376 case -ESHUTDOWN: /* unplug */
377 case -EILSEQ: /* protocol error or unplug */ 377 unplug = 1;
378 case -EPROTO: /* protocol error or unplug */ 378 case -EILSEQ: /* protocol error or unplug */
379 case -ECONNRESET: /* unlink */ 379 case -EPROTO: /* protocol error or unplug */
380 case -ENOENT: 380 case -ECONNRESET: /* unlink */
381 case -EPIPE: /* report not available */ 381 case -ENOENT:
382 break; 382 case -EPIPE: /* report not available */
383 default: /* error */ 383 break;
384 warn("ctrl urb status %d received", urb->status); 384 default: /* error */
385 warn("ctrl urb status %d received", urb->status);
385 } 386 }
386 387
387 if (unplug) 388 if (unplug)