diff options
-rw-r--r-- | drivers/hid/Kconfig | 1 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 93 | ||||
-rw-r--r-- | drivers/hid/hid-debug.c | 15 | ||||
-rw-r--r-- | drivers/hid/hid-input.c | 26 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 38 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-lgff.c | 10 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 8 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-tmff.c | 2 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-zpff.c | 8 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 2 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbkbd.c | 6 | ||||
-rw-r--r-- | include/linux/hid.h | 20 |
12 files changed, 122 insertions, 107 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index d96eb0865829..3b63b0b78122 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -28,6 +28,7 @@ config HID | |||
28 | 28 | ||
29 | config HID_DEBUG | 29 | config HID_DEBUG |
30 | bool "HID debugging support" | 30 | bool "HID debugging support" |
31 | default y if !EMBEDDED | ||
31 | depends on HID | 32 | depends on HID |
32 | ---help--- | 33 | ---help--- |
33 | This option lets the HID layer output diagnostics about its internal | 34 | This option lets the HID layer output diagnostics about its internal |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 6ec04e79f685..317cf8a7b63c 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -40,6 +40,13 @@ | |||
40 | #define DRIVER_DESC "HID core driver" | 40 | #define DRIVER_DESC "HID core driver" |
41 | #define DRIVER_LICENSE "GPL" | 41 | #define DRIVER_LICENSE "GPL" |
42 | 42 | ||
43 | #ifdef CONFIG_HID_DEBUG | ||
44 | int hid_debug = 0; | ||
45 | module_param_named(debug, hid_debug, bool, 0600); | ||
46 | MODULE_PARM_DESC(debug, "Turn HID debugging mode on and off"); | ||
47 | EXPORT_SYMBOL_GPL(hid_debug); | ||
48 | #endif | ||
49 | |||
43 | /* | 50 | /* |
44 | * Register a new report for a device. | 51 | * Register a new report for a device. |
45 | */ | 52 | */ |
@@ -78,7 +85,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned | |||
78 | struct hid_field *field; | 85 | struct hid_field *field; |
79 | 86 | ||
80 | if (report->maxfield == HID_MAX_FIELDS) { | 87 | if (report->maxfield == HID_MAX_FIELDS) { |
81 | dbg("too many fields in report"); | 88 | dbg_hid("too many fields in report\n"); |
82 | return NULL; | 89 | return NULL; |
83 | } | 90 | } |
84 | 91 | ||
@@ -106,7 +113,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) | |||
106 | usage = parser->local.usage[0]; | 113 | usage = parser->local.usage[0]; |
107 | 114 | ||
108 | if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { | 115 | if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { |
109 | dbg("collection stack overflow"); | 116 | dbg_hid("collection stack overflow\n"); |
110 | return -1; | 117 | return -1; |
111 | } | 118 | } |
112 | 119 | ||
@@ -114,7 +121,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) | |||
114 | collection = kmalloc(sizeof(struct hid_collection) * | 121 | collection = kmalloc(sizeof(struct hid_collection) * |
115 | parser->device->collection_size * 2, GFP_KERNEL); | 122 | parser->device->collection_size * 2, GFP_KERNEL); |
116 | if (collection == NULL) { | 123 | if (collection == NULL) { |
117 | dbg("failed to reallocate collection array"); | 124 | dbg_hid("failed to reallocate collection array\n"); |
118 | return -1; | 125 | return -1; |
119 | } | 126 | } |
120 | memcpy(collection, parser->device->collection, | 127 | memcpy(collection, parser->device->collection, |
@@ -150,7 +157,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) | |||
150 | static int close_collection(struct hid_parser *parser) | 157 | static int close_collection(struct hid_parser *parser) |
151 | { | 158 | { |
152 | if (!parser->collection_stack_ptr) { | 159 | if (!parser->collection_stack_ptr) { |
153 | dbg("collection stack underflow"); | 160 | dbg_hid("collection stack underflow\n"); |
154 | return -1; | 161 | return -1; |
155 | } | 162 | } |
156 | parser->collection_stack_ptr--; | 163 | parser->collection_stack_ptr--; |
@@ -178,7 +185,7 @@ static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) | |||
178 | static int hid_add_usage(struct hid_parser *parser, unsigned usage) | 185 | static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
179 | { | 186 | { |
180 | if (parser->local.usage_index >= HID_MAX_USAGES) { | 187 | if (parser->local.usage_index >= HID_MAX_USAGES) { |
181 | dbg("usage index exceeded"); | 188 | dbg_hid("usage index exceeded\n"); |
182 | return -1; | 189 | return -1; |
183 | } | 190 | } |
184 | parser->local.usage[parser->local.usage_index] = usage; | 191 | parser->local.usage[parser->local.usage_index] = usage; |
@@ -202,12 +209,12 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign | |||
202 | int i; | 209 | int i; |
203 | 210 | ||
204 | if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) { | 211 | if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) { |
205 | dbg("hid_register_report failed"); | 212 | dbg_hid("hid_register_report failed\n"); |
206 | return -1; | 213 | return -1; |
207 | } | 214 | } |
208 | 215 | ||
209 | if (parser->global.logical_maximum < parser->global.logical_minimum) { | 216 | if (parser->global.logical_maximum < parser->global.logical_minimum) { |
210 | dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); | 217 | dbg_hid("logical range invalid %d %d\n", parser->global.logical_minimum, parser->global.logical_maximum); |
211 | return -1; | 218 | return -1; |
212 | } | 219 | } |
213 | 220 | ||
@@ -287,7 +294,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | |||
287 | case HID_GLOBAL_ITEM_TAG_PUSH: | 294 | case HID_GLOBAL_ITEM_TAG_PUSH: |
288 | 295 | ||
289 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { | 296 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { |
290 | dbg("global enviroment stack overflow"); | 297 | dbg_hid("global enviroment stack overflow\n"); |
291 | return -1; | 298 | return -1; |
292 | } | 299 | } |
293 | 300 | ||
@@ -298,7 +305,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | |||
298 | case HID_GLOBAL_ITEM_TAG_POP: | 305 | case HID_GLOBAL_ITEM_TAG_POP: |
299 | 306 | ||
300 | if (!parser->global_stack_ptr) { | 307 | if (!parser->global_stack_ptr) { |
301 | dbg("global enviroment stack underflow"); | 308 | dbg_hid("global enviroment stack underflow\n"); |
302 | return -1; | 309 | return -1; |
303 | } | 310 | } |
304 | 311 | ||
@@ -342,27 +349,27 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | |||
342 | 349 | ||
343 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: | 350 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: |
344 | if ((parser->global.report_size = item_udata(item)) > 32) { | 351 | if ((parser->global.report_size = item_udata(item)) > 32) { |
345 | dbg("invalid report_size %d", parser->global.report_size); | 352 | dbg_hid("invalid report_size %d\n", parser->global.report_size); |
346 | return -1; | 353 | return -1; |
347 | } | 354 | } |
348 | return 0; | 355 | return 0; |
349 | 356 | ||
350 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: | 357 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: |
351 | if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) { | 358 | if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) { |
352 | dbg("invalid report_count %d", parser->global.report_count); | 359 | dbg_hid("invalid report_count %d\n", parser->global.report_count); |
353 | return -1; | 360 | return -1; |
354 | } | 361 | } |
355 | return 0; | 362 | return 0; |
356 | 363 | ||
357 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: | 364 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: |
358 | if ((parser->global.report_id = item_udata(item)) == 0) { | 365 | if ((parser->global.report_id = item_udata(item)) == 0) { |
359 | dbg("report_id 0 is invalid"); | 366 | dbg_hid("report_id 0 is invalid\n"); |
360 | return -1; | 367 | return -1; |
361 | } | 368 | } |
362 | return 0; | 369 | return 0; |
363 | 370 | ||
364 | default: | 371 | default: |
365 | dbg("unknown global tag 0x%x", item->tag); | 372 | dbg_hid("unknown global tag 0x%x\n", item->tag); |
366 | return -1; | 373 | return -1; |
367 | } | 374 | } |
368 | } | 375 | } |
@@ -377,7 +384,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
377 | unsigned n; | 384 | unsigned n; |
378 | 385 | ||
379 | if (item->size == 0) { | 386 | if (item->size == 0) { |
380 | dbg("item data expected for local item"); | 387 | dbg_hid("item data expected for local item\n"); |
381 | return -1; | 388 | return -1; |
382 | } | 389 | } |
383 | 390 | ||
@@ -395,14 +402,14 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
395 | * items and the first delimiter set. | 402 | * items and the first delimiter set. |
396 | */ | 403 | */ |
397 | if (parser->local.delimiter_depth != 0) { | 404 | if (parser->local.delimiter_depth != 0) { |
398 | dbg("nested delimiters"); | 405 | dbg_hid("nested delimiters\n"); |
399 | return -1; | 406 | return -1; |
400 | } | 407 | } |
401 | parser->local.delimiter_depth++; | 408 | parser->local.delimiter_depth++; |
402 | parser->local.delimiter_branch++; | 409 | parser->local.delimiter_branch++; |
403 | } else { | 410 | } else { |
404 | if (parser->local.delimiter_depth < 1) { | 411 | if (parser->local.delimiter_depth < 1) { |
405 | dbg("bogus close delimiter"); | 412 | dbg_hid("bogus close delimiter\n"); |
406 | return -1; | 413 | return -1; |
407 | } | 414 | } |
408 | parser->local.delimiter_depth--; | 415 | parser->local.delimiter_depth--; |
@@ -412,7 +419,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
412 | case HID_LOCAL_ITEM_TAG_USAGE: | 419 | case HID_LOCAL_ITEM_TAG_USAGE: |
413 | 420 | ||
414 | if (parser->local.delimiter_branch > 1) { | 421 | if (parser->local.delimiter_branch > 1) { |
415 | dbg("alternative usage ignored"); | 422 | dbg_hid("alternative usage ignored\n"); |
416 | return 0; | 423 | return 0; |
417 | } | 424 | } |
418 | 425 | ||
@@ -424,7 +431,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
424 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: | 431 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
425 | 432 | ||
426 | if (parser->local.delimiter_branch > 1) { | 433 | if (parser->local.delimiter_branch > 1) { |
427 | dbg("alternative usage ignored"); | 434 | dbg_hid("alternative usage ignored\n"); |
428 | return 0; | 435 | return 0; |
429 | } | 436 | } |
430 | 437 | ||
@@ -437,7 +444,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
437 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: | 444 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: |
438 | 445 | ||
439 | if (parser->local.delimiter_branch > 1) { | 446 | if (parser->local.delimiter_branch > 1) { |
440 | dbg("alternative usage ignored"); | 447 | dbg_hid("alternative usage ignored\n"); |
441 | return 0; | 448 | return 0; |
442 | } | 449 | } |
443 | 450 | ||
@@ -446,14 +453,14 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
446 | 453 | ||
447 | for (n = parser->local.usage_minimum; n <= data; n++) | 454 | for (n = parser->local.usage_minimum; n <= data; n++) |
448 | if (hid_add_usage(parser, n)) { | 455 | if (hid_add_usage(parser, n)) { |
449 | dbg("hid_add_usage failed\n"); | 456 | dbg_hid("hid_add_usage failed\n"); |
450 | return -1; | 457 | return -1; |
451 | } | 458 | } |
452 | return 0; | 459 | return 0; |
453 | 460 | ||
454 | default: | 461 | default: |
455 | 462 | ||
456 | dbg("unknown local item tag 0x%x", item->tag); | 463 | dbg_hid("unknown local item tag 0x%x\n", item->tag); |
457 | return 0; | 464 | return 0; |
458 | } | 465 | } |
459 | return 0; | 466 | return 0; |
@@ -487,7 +494,7 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) | |||
487 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); | 494 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); |
488 | break; | 495 | break; |
489 | default: | 496 | default: |
490 | dbg("unknown main item tag 0x%x", item->tag); | 497 | dbg_hid("unknown main item tag 0x%x\n", item->tag); |
491 | ret = 0; | 498 | ret = 0; |
492 | } | 499 | } |
493 | 500 | ||
@@ -502,7 +509,7 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) | |||
502 | 509 | ||
503 | static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) | 510 | static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) |
504 | { | 511 | { |
505 | dbg("reserved item type, tag 0x%x", item->tag); | 512 | dbg_hid("reserved item type, tag 0x%x\n", item->tag); |
506 | return 0; | 513 | return 0; |
507 | } | 514 | } |
508 | 515 | ||
@@ -667,14 +674,14 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
667 | while ((start = fetch_item(start, end, &item)) != NULL) { | 674 | while ((start = fetch_item(start, end, &item)) != NULL) { |
668 | 675 | ||
669 | if (item.format != HID_ITEM_FORMAT_SHORT) { | 676 | if (item.format != HID_ITEM_FORMAT_SHORT) { |
670 | dbg("unexpected long global item"); | 677 | dbg_hid("unexpected long global item\n"); |
671 | hid_free_device(device); | 678 | hid_free_device(device); |
672 | vfree(parser); | 679 | vfree(parser); |
673 | return NULL; | 680 | return NULL; |
674 | } | 681 | } |
675 | 682 | ||
676 | if (dispatch_type[item.type](parser, &item)) { | 683 | if (dispatch_type[item.type](parser, &item)) { |
677 | dbg("item %u %u %u %u parsing failed\n", | 684 | dbg_hid("item %u %u %u %u parsing failed\n", |
678 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); | 685 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); |
679 | hid_free_device(device); | 686 | hid_free_device(device); |
680 | vfree(parser); | 687 | vfree(parser); |
@@ -683,13 +690,13 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
683 | 690 | ||
684 | if (start == end) { | 691 | if (start == end) { |
685 | if (parser->collection_stack_ptr) { | 692 | if (parser->collection_stack_ptr) { |
686 | dbg("unbalanced collection at end of report description"); | 693 | dbg_hid("unbalanced collection at end of report description\n"); |
687 | hid_free_device(device); | 694 | hid_free_device(device); |
688 | vfree(parser); | 695 | vfree(parser); |
689 | return NULL; | 696 | return NULL; |
690 | } | 697 | } |
691 | if (parser->local.delimiter_depth) { | 698 | if (parser->local.delimiter_depth) { |
692 | dbg("unbalanced delimiter at end of report description"); | 699 | dbg_hid("unbalanced delimiter at end of report description\n"); |
693 | hid_free_device(device); | 700 | hid_free_device(device); |
694 | vfree(parser); | 701 | vfree(parser); |
695 | return NULL; | 702 | return NULL; |
@@ -699,7 +706,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
699 | } | 706 | } |
700 | } | 707 | } |
701 | 708 | ||
702 | dbg("item fetching failed at offset %d\n", (int)(end - start)); | 709 | dbg_hid("item fetching failed at offset %d\n", (int)(end - start)); |
703 | hid_free_device(device); | 710 | hid_free_device(device); |
704 | vfree(parser); | 711 | vfree(parser); |
705 | return NULL; | 712 | return NULL; |
@@ -915,13 +922,13 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) | |||
915 | hid_dump_input(field->usage + offset, value); | 922 | hid_dump_input(field->usage + offset, value); |
916 | 923 | ||
917 | if (offset >= field->report_count) { | 924 | if (offset >= field->report_count) { |
918 | dbg("offset (%d) exceeds report_count (%d)", offset, field->report_count); | 925 | dbg_hid("offset (%d) exceeds report_count (%d)\n", offset, field->report_count); |
919 | hid_dump_field(field, 8); | 926 | hid_dump_field(field, 8); |
920 | return -1; | 927 | return -1; |
921 | } | 928 | } |
922 | if (field->logical_minimum < 0) { | 929 | if (field->logical_minimum < 0) { |
923 | if (value != snto32(s32ton(value, size), size)) { | 930 | if (value != snto32(s32ton(value, size), size)) { |
924 | dbg("value %d is out of range", value); | 931 | dbg_hid("value %d is out of range\n", value); |
925 | return -1; | 932 | return -1; |
926 | } | 933 | } |
927 | } | 934 | } |
@@ -934,19 +941,17 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
934 | { | 941 | { |
935 | struct hid_report_enum *report_enum = hid->report_enum + type; | 942 | struct hid_report_enum *report_enum = hid->report_enum + type; |
936 | struct hid_report *report; | 943 | struct hid_report *report; |
937 | int n, rsize; | 944 | int n, rsize, i; |
938 | 945 | ||
939 | if (!hid) | 946 | if (!hid) |
940 | return -ENODEV; | 947 | return -ENODEV; |
941 | 948 | ||
942 | if (!size) { | 949 | if (!size) { |
943 | dbg("empty report"); | 950 | dbg_hid("empty report\n"); |
944 | return -1; | 951 | return -1; |
945 | } | 952 | } |
946 | 953 | ||
947 | #ifdef CONFIG_HID_DEBUG | 954 | dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); |
948 | printk(KERN_DEBUG __FILE__ ": report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); | ||
949 | #endif | ||
950 | 955 | ||
951 | n = 0; /* Normally report number is 0 */ | 956 | n = 0; /* Normally report number is 0 */ |
952 | if (report_enum->numbered) { /* Device uses numbered reports, data[0] is report number */ | 957 | if (report_enum->numbered) { /* Device uses numbered reports, data[0] is report number */ |
@@ -954,25 +959,21 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
954 | size--; | 959 | size--; |
955 | } | 960 | } |
956 | 961 | ||
957 | #ifdef CONFIG_HID_DEBUG | 962 | /* dump the report descriptor */ |
958 | { | 963 | dbg_hid("report %d (size %u) = ", n, size); |
959 | int i; | 964 | for (i = 0; i < size; i++) |
960 | printk(KERN_DEBUG __FILE__ ": report %d (size %u) = ", n, size); | 965 | dbg_hid_line(" %02x", data[i]); |
961 | for (i = 0; i < size; i++) | 966 | dbg_hid_line("\n"); |
962 | printk(" %02x", data[i]); | ||
963 | printk("\n"); | ||
964 | } | ||
965 | #endif | ||
966 | 967 | ||
967 | if (!(report = report_enum->report_id_hash[n])) { | 968 | if (!(report = report_enum->report_id_hash[n])) { |
968 | dbg("undefined report_id %d received", n); | 969 | dbg_hid("undefined report_id %d received\n", n); |
969 | return -1; | 970 | return -1; |
970 | } | 971 | } |
971 | 972 | ||
972 | rsize = ((report->size - 1) >> 3) + 1; | 973 | rsize = ((report->size - 1) >> 3) + 1; |
973 | 974 | ||
974 | if (size < rsize) { | 975 | if (size < rsize) { |
975 | dbg("report %d is too short, (%d < %d)", report->id, size, rsize); | 976 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, size, rsize); |
976 | memset(data + size, 0, rsize - size); | 977 | memset(data + size, 0, rsize - size); |
977 | } | 978 | } |
978 | 979 | ||
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 83c4126b37c3..a13757b78980 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -347,6 +347,9 @@ static void resolv_usage_page(unsigned page) { | |||
347 | void hid_resolv_usage(unsigned usage) { | 347 | void hid_resolv_usage(unsigned usage) { |
348 | const struct hid_usage_entry *p; | 348 | const struct hid_usage_entry *p; |
349 | 349 | ||
350 | if (!hid_debug) | ||
351 | return; | ||
352 | |||
350 | resolv_usage_page(usage >> 16); | 353 | resolv_usage_page(usage >> 16); |
351 | printk("."); | 354 | printk("."); |
352 | for (p = hid_usage_table; p->description; p++) | 355 | for (p = hid_usage_table; p->description; p++) |
@@ -369,6 +372,9 @@ __inline__ static void tab(int n) { | |||
369 | void hid_dump_field(struct hid_field *field, int n) { | 372 | void hid_dump_field(struct hid_field *field, int n) { |
370 | int j; | 373 | int j; |
371 | 374 | ||
375 | if (!hid_debug) | ||
376 | return; | ||
377 | |||
372 | if (field->physical) { | 378 | if (field->physical) { |
373 | tab(n); | 379 | tab(n); |
374 | printk("Physical("); | 380 | printk("Physical("); |
@@ -466,6 +472,9 @@ void hid_dump_device(struct hid_device *device) { | |||
466 | unsigned i,k; | 472 | unsigned i,k; |
467 | static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; | 473 | static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; |
468 | 474 | ||
475 | if (!hid_debug) | ||
476 | return; | ||
477 | |||
469 | for (i = 0; i < HID_REPORT_TYPES; i++) { | 478 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
470 | report_enum = device->report_enum + i; | 479 | report_enum = device->report_enum + i; |
471 | list = report_enum->report_list.next; | 480 | list = report_enum->report_list.next; |
@@ -489,6 +498,9 @@ void hid_dump_device(struct hid_device *device) { | |||
489 | EXPORT_SYMBOL_GPL(hid_dump_device); | 498 | EXPORT_SYMBOL_GPL(hid_dump_device); |
490 | 499 | ||
491 | void hid_dump_input(struct hid_usage *usage, __s32 value) { | 500 | void hid_dump_input(struct hid_usage *usage, __s32 value) { |
501 | if (!hid_debug) | ||
502 | return; | ||
503 | |||
492 | printk("hid-debug: input "); | 504 | printk("hid-debug: input "); |
493 | hid_resolv_usage(usage->hid); | 505 | hid_resolv_usage(usage->hid); |
494 | printk(" = %d\n", value); | 506 | printk(" = %d\n", value); |
@@ -758,6 +770,9 @@ static char **names[EV_MAX + 1] = { | |||
758 | 770 | ||
759 | void hid_resolv_event(__u8 type, __u16 code) { | 771 | void hid_resolv_event(__u8 type, __u16 code) { |
760 | 772 | ||
773 | if (!hid_debug) | ||
774 | return; | ||
775 | |||
761 | printk("%s.%s", events[type] ? events[type] : "?", | 776 | printk("%s.%s", events[type] ? events[type] : "?", |
762 | names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); | 777 | names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); |
763 | } | 778 | } |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index bf7e307503cc..8edbd30cf795 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -321,9 +321,7 @@ static int hidinput_setkeycode(struct input_dev *dev, int scancode, | |||
321 | 321 | ||
322 | clear_bit(old_keycode, dev->keybit); | 322 | clear_bit(old_keycode, dev->keybit); |
323 | set_bit(usage->code, dev->keybit); | 323 | set_bit(usage->code, dev->keybit); |
324 | #ifdef CONFIG_HID_DEBUG | 324 | dbg_hid(KERN_DEBUG "Assigned keycode %d to HID usage code %x\n", keycode, scancode); |
325 | printk (KERN_DEBUG "Assigned keycode %d to HID usage code %x\n", keycode, scancode); | ||
326 | #endif | ||
327 | /* Set the keybit for the old keycode if the old keycode is used | 325 | /* Set the keybit for the old keycode if the old keycode is used |
328 | * by another key */ | 326 | * by another key */ |
329 | if (hidinput_find_key (hid, 0, old_keycode)) | 327 | if (hidinput_find_key (hid, 0, old_keycode)) |
@@ -346,11 +344,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
346 | 344 | ||
347 | field->hidinput = hidinput; | 345 | field->hidinput = hidinput; |
348 | 346 | ||
349 | #ifdef CONFIG_HID_DEBUG | 347 | dbg_hid("Mapping: "); |
350 | printk(KERN_DEBUG "Mapping: "); | ||
351 | hid_resolv_usage(usage->hid); | 348 | hid_resolv_usage(usage->hid); |
352 | printk(" ---> "); | 349 | dbg_hid_line(" ---> "); |
353 | #endif | ||
354 | 350 | ||
355 | if (field->flags & HID_MAIN_ITEM_CONSTANT) | 351 | if (field->flags & HID_MAIN_ITEM_CONSTANT) |
356 | goto ignore; | 352 | goto ignore; |
@@ -893,15 +889,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
893 | } | 889 | } |
894 | 890 | ||
895 | hid_resolv_event(usage->type, usage->code); | 891 | hid_resolv_event(usage->type, usage->code); |
896 | #ifdef CONFIG_HID_DEBUG | 892 | |
897 | printk("\n"); | 893 | dbg_hid_line("\n"); |
898 | #endif | 894 | |
899 | return; | 895 | return; |
900 | 896 | ||
901 | ignore: | 897 | ignore: |
902 | #ifdef CONFIG_HID_DEBUG | 898 | dbg_hid_line("IGNORED\n"); |
903 | printk("IGNORED\n"); | ||
904 | #endif | ||
905 | return; | 899 | return; |
906 | } | 900 | } |
907 | 901 | ||
@@ -970,12 +964,12 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct | |||
970 | } | 964 | } |
971 | 965 | ||
972 | if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ | 966 | if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ |
973 | dbg("Maximum Effects - %d",value); | 967 | dbg_hid("Maximum Effects - %d\n",value); |
974 | return; | 968 | return; |
975 | } | 969 | } |
976 | 970 | ||
977 | if (usage->hid == (HID_UP_PID | 0x7fUL)) { | 971 | if (usage->hid == (HID_UP_PID | 0x7fUL)) { |
978 | dbg("PID Pool Report\n"); | 972 | dbg_hid("PID Pool Report\n"); |
979 | return; | 973 | return; |
980 | } | 974 | } |
981 | 975 | ||
@@ -1083,7 +1077,7 @@ int hidinput_connect(struct hid_device *hid) | |||
1083 | if (!hidinput || !input_dev) { | 1077 | if (!hidinput || !input_dev) { |
1084 | kfree(hidinput); | 1078 | kfree(hidinput); |
1085 | input_free_device(input_dev); | 1079 | input_free_device(input_dev); |
1086 | err("Out of memory during hid input probe"); | 1080 | err_hid("Out of memory during hid input probe"); |
1087 | return -1; | 1081 | return -1; |
1088 | } | 1082 | } |
1089 | 1083 | ||
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 3efc3734cec2..3afa4a5035b7 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -133,7 +133,7 @@ static void hid_reset(struct work_struct *work) | |||
133 | hid_io_error(hid); | 133 | hid_io_error(hid); |
134 | break; | 134 | break; |
135 | default: | 135 | default: |
136 | err("can't reset device, %s-%s/input%d, status %d", | 136 | err_hid("can't reset device, %s-%s/input%d, status %d", |
137 | hid_to_usb_dev(hid)->bus->bus_name, | 137 | hid_to_usb_dev(hid)->bus->bus_name, |
138 | hid_to_usb_dev(hid)->devpath, | 138 | hid_to_usb_dev(hid)->devpath, |
139 | usbhid->ifnum, rc); | 139 | usbhid->ifnum, rc); |
@@ -226,7 +226,7 @@ static void hid_irq_in(struct urb *urb) | |||
226 | if (status) { | 226 | if (status) { |
227 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 227 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
228 | if (status != -EPERM) { | 228 | if (status != -EPERM) { |
229 | err("can't resubmit intr, %s-%s/input%d, status %d", | 229 | err_hid("can't resubmit intr, %s-%s/input%d, status %d", |
230 | hid_to_usb_dev(hid)->bus->bus_name, | 230 | hid_to_usb_dev(hid)->bus->bus_name, |
231 | hid_to_usb_dev(hid)->devpath, | 231 | hid_to_usb_dev(hid)->devpath, |
232 | usbhid->ifnum, status); | 232 | usbhid->ifnum, status); |
@@ -246,10 +246,10 @@ static int hid_submit_out(struct hid_device *hid) | |||
246 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 246 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
247 | usbhid->urbout->dev = hid_to_usb_dev(hid); | 247 | usbhid->urbout->dev = hid_to_usb_dev(hid); |
248 | 248 | ||
249 | dbg("submitting out urb"); | 249 | dbg_hid("submitting out urb\n"); |
250 | 250 | ||
251 | if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { | 251 | if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { |
252 | err("usb_submit_urb(out) failed"); | 252 | err_hid("usb_submit_urb(out) failed"); |
253 | return -1; | 253 | return -1; |
254 | } | 254 | } |
255 | 255 | ||
@@ -293,12 +293,12 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
293 | usbhid->cr->wIndex = cpu_to_le16(usbhid->ifnum); | 293 | usbhid->cr->wIndex = cpu_to_le16(usbhid->ifnum); |
294 | usbhid->cr->wLength = cpu_to_le16(len); | 294 | usbhid->cr->wLength = cpu_to_le16(len); |
295 | 295 | ||
296 | dbg("submitting ctrl urb: %s wValue=0x%04x wIndex=0x%04x wLength=%u", | 296 | dbg_hid("submitting ctrl urb: %s wValue=0x%04x wIndex=0x%04x wLength=%u\n", |
297 | usbhid->cr->bRequest == HID_REQ_SET_REPORT ? "Set_Report" : "Get_Report", | 297 | usbhid->cr->bRequest == HID_REQ_SET_REPORT ? "Set_Report" : "Get_Report", |
298 | usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); | 298 | usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); |
299 | 299 | ||
300 | if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { | 300 | if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { |
301 | err("usb_submit_urb(ctrl) failed"); | 301 | err_hid("usb_submit_urb(ctrl) failed"); |
302 | return -1; | 302 | return -1; |
303 | } | 303 | } |
304 | 304 | ||
@@ -480,7 +480,7 @@ int usbhid_wait_io(struct hid_device *hid) | |||
480 | if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && | 480 | if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && |
481 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), | 481 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), |
482 | 10*HZ)) { | 482 | 10*HZ)) { |
483 | dbg("timeout waiting for ctrl or out queue to clear"); | 483 | dbg_hid("timeout waiting for ctrl or out queue to clear\n"); |
484 | return -1; | 484 | return -1; |
485 | } | 485 | } |
486 | 486 | ||
@@ -659,7 +659,7 @@ static void hid_fixup_sony_ps3_controller(struct usb_device *dev, int ifnum) | |||
659 | USB_CTRL_GET_TIMEOUT); | 659 | USB_CTRL_GET_TIMEOUT); |
660 | 660 | ||
661 | if (result < 0) | 661 | if (result < 0) |
662 | err("%s failed: %d\n", __func__, result); | 662 | err_hid("%s failed: %d\n", __func__, result); |
663 | 663 | ||
664 | kfree(buf); | 664 | kfree(buf); |
665 | } | 665 | } |
@@ -698,7 +698,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
698 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && | 698 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && |
699 | (!interface->desc.bNumEndpoints || | 699 | (!interface->desc.bNumEndpoints || |
700 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { | 700 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { |
701 | dbg("class descriptor not present\n"); | 701 | dbg_hid("class descriptor not present\n"); |
702 | return NULL; | 702 | return NULL; |
703 | } | 703 | } |
704 | 704 | ||
@@ -707,19 +707,19 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
707 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); | 707 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); |
708 | 708 | ||
709 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { | 709 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { |
710 | dbg("weird size of report descriptor (%u)", rsize); | 710 | dbg_hid("weird size of report descriptor (%u)\n", rsize); |
711 | return NULL; | 711 | return NULL; |
712 | } | 712 | } |
713 | 713 | ||
714 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { | 714 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { |
715 | dbg("couldn't allocate rdesc memory"); | 715 | dbg_hid("couldn't allocate rdesc memory\n"); |
716 | return NULL; | 716 | return NULL; |
717 | } | 717 | } |
718 | 718 | ||
719 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); | 719 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); |
720 | 720 | ||
721 | if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { | 721 | if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { |
722 | dbg("reading report descriptor failed"); | 722 | dbg_hid("reading report descriptor failed\n"); |
723 | kfree(rdesc); | 723 | kfree(rdesc); |
724 | return NULL; | 724 | return NULL; |
725 | } | 725 | } |
@@ -728,15 +728,13 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
728 | le16_to_cpu(dev->descriptor.idProduct), rdesc, | 728 | le16_to_cpu(dev->descriptor.idProduct), rdesc, |
729 | rsize, rdesc_quirks_param); | 729 | rsize, rdesc_quirks_param); |
730 | 730 | ||
731 | #ifdef CONFIG_HID_DEBUG | 731 | dbg_hid("report descriptor (size %u, read %d) = ", rsize, n); |
732 | printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = ", rsize, n); | ||
733 | for (n = 0; n < rsize; n++) | 732 | for (n = 0; n < rsize; n++) |
734 | printk(" %02x", (unsigned char) rdesc[n]); | 733 | dbg_hid_line(" %02x", (unsigned char) rdesc[n]); |
735 | printk("\n"); | 734 | dbg_hid_line("\n"); |
736 | #endif | ||
737 | 735 | ||
738 | if (!(hid = hid_parse_report(rdesc, n))) { | 736 | if (!(hid = hid_parse_report(rdesc, n))) { |
739 | dbg("parsing report descriptor failed"); | 737 | dbg_hid("parsing report descriptor failed\n"); |
740 | kfree(rdesc); | 738 | kfree(rdesc); |
741 | return NULL; | 739 | return NULL; |
742 | } | 740 | } |
@@ -808,7 +806,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
808 | } | 806 | } |
809 | 807 | ||
810 | if (!usbhid->urbin) { | 808 | if (!usbhid->urbin) { |
811 | err("couldn't find an input interrupt endpoint"); | 809 | err_hid("couldn't find an input interrupt endpoint"); |
812 | goto fail; | 810 | goto fail; |
813 | } | 811 | } |
814 | 812 | ||
@@ -925,7 +923,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
925 | int i; | 923 | int i; |
926 | char *c; | 924 | char *c; |
927 | 925 | ||
928 | dbg("HID probe called for ifnum %d", | 926 | dbg_hid("HID probe called for ifnum %d\n", |
929 | intf->altsetting->desc.bInterfaceNumber); | 927 | intf->altsetting->desc.bInterfaceNumber); |
930 | 928 | ||
931 | if (!(hid = usb_hid_configure(intf))) | 929 | if (!(hid = usb_hid_configure(intf))) |
diff --git a/drivers/hid/usbhid/hid-lgff.c b/drivers/hid/usbhid/hid-lgff.c index c5cd4107d6af..4b7ab6a46d93 100644 --- a/drivers/hid/usbhid/hid-lgff.c +++ b/drivers/hid/usbhid/hid-lgff.c | |||
@@ -78,7 +78,7 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
78 | report->field[0]->value[1] = 0x08; | 78 | report->field[0]->value[1] = 0x08; |
79 | report->field[0]->value[2] = x; | 79 | report->field[0]->value[2] = x; |
80 | report->field[0]->value[3] = y; | 80 | report->field[0]->value[3] = y; |
81 | dbg("(x, y)=(%04x, %04x)", x, y); | 81 | dbg_hid("(x, y)=(%04x, %04x)\n", x, y); |
82 | usbhid_submit_report(hid, report, USB_DIR_OUT); | 82 | usbhid_submit_report(hid, report, USB_DIR_OUT); |
83 | break; | 83 | break; |
84 | 84 | ||
@@ -93,7 +93,7 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
93 | report->field[0]->value[1] = 0x00; | 93 | report->field[0]->value[1] = 0x00; |
94 | report->field[0]->value[2] = left; | 94 | report->field[0]->value[2] = left; |
95 | report->field[0]->value[3] = right; | 95 | report->field[0]->value[3] = right; |
96 | dbg("(left, right)=(%04x, %04x)", left, right); | 96 | dbg_hid("(left, right)=(%04x, %04x)\n", left, right); |
97 | usbhid_submit_report(hid, report, USB_DIR_OUT); | 97 | usbhid_submit_report(hid, report, USB_DIR_OUT); |
98 | break; | 98 | break; |
99 | } | 99 | } |
@@ -113,20 +113,20 @@ int hid_lgff_init(struct hid_device* hid) | |||
113 | 113 | ||
114 | /* Find the report to use */ | 114 | /* Find the report to use */ |
115 | if (list_empty(report_list)) { | 115 | if (list_empty(report_list)) { |
116 | err("No output report found"); | 116 | err_hid("No output report found"); |
117 | return -1; | 117 | return -1; |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Check that the report looks ok */ | 120 | /* Check that the report looks ok */ |
121 | report = list_entry(report_list->next, struct hid_report, list); | 121 | report = list_entry(report_list->next, struct hid_report, list); |
122 | if (!report) { | 122 | if (!report) { |
123 | err("NULL output report"); | 123 | err_hid("NULL output report"); |
124 | return -1; | 124 | return -1; |
125 | } | 125 | } |
126 | 126 | ||
127 | field = report->field[0]; | 127 | field = report->field[0]; |
128 | if (!field) { | 128 | if (!field) { |
129 | err("NULL field"); | 129 | err_hid("NULL field"); |
130 | return -1; | 130 | return -1; |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index ce6c970b5979..775b9f3b8ce3 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -526,7 +526,7 @@ static struct hid_blacklist *usbhid_exists_dquirk(const u16 idVendor, | |||
526 | } | 526 | } |
527 | 527 | ||
528 | if (bl_entry != NULL) | 528 | if (bl_entry != NULL) |
529 | dbg("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", | 529 | dbg_hid("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", |
530 | bl_entry->quirks, bl_entry->idVendor, | 530 | bl_entry->quirks, bl_entry->idVendor, |
531 | bl_entry->idProduct); | 531 | bl_entry->idProduct); |
532 | 532 | ||
@@ -554,13 +554,13 @@ int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, | |||
554 | int list_edited = 0; | 554 | int list_edited = 0; |
555 | 555 | ||
556 | if (!idVendor) { | 556 | if (!idVendor) { |
557 | dbg("Cannot add a quirk with idVendor = 0"); | 557 | dbg_hid("Cannot add a quirk with idVendor = 0\n"); |
558 | return -EINVAL; | 558 | return -EINVAL; |
559 | } | 559 | } |
560 | 560 | ||
561 | q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL); | 561 | q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL); |
562 | if (!q_new) { | 562 | if (!q_new) { |
563 | dbg("Could not allocate quirks_list_struct"); | 563 | dbg_hid("Could not allocate quirks_list_struct\n"); |
564 | return -ENOMEM; | 564 | return -ENOMEM; |
565 | } | 565 | } |
566 | 566 | ||
@@ -675,7 +675,7 @@ static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, | |||
675 | bl_entry = &hid_blacklist[n]; | 675 | bl_entry = &hid_blacklist[n]; |
676 | 676 | ||
677 | if (bl_entry != NULL) | 677 | if (bl_entry != NULL) |
678 | dbg("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", | 678 | dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", |
679 | bl_entry->quirks, bl_entry->idVendor, | 679 | bl_entry->quirks, bl_entry->idVendor, |
680 | bl_entry->idProduct); | 680 | bl_entry->idProduct); |
681 | return bl_entry; | 681 | return bl_entry; |
diff --git a/drivers/hid/usbhid/hid-tmff.c b/drivers/hid/usbhid/hid-tmff.c index ab5ba6ef891c..555bb48b4295 100644 --- a/drivers/hid/usbhid/hid-tmff.c +++ b/drivers/hid/usbhid/hid-tmff.c | |||
@@ -70,7 +70,7 @@ static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
70 | 70 | ||
71 | tmff->rumble->value[0] = left; | 71 | tmff->rumble->value[0] = left; |
72 | tmff->rumble->value[1] = right; | 72 | tmff->rumble->value[1] = right; |
73 | dbg("(left,right)=(%08x, %08x)", left, right); | 73 | dbg_hid("(left,right)=(%08x, %08x)\n", left, right); |
74 | usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); | 74 | usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); |
75 | 75 | ||
76 | return 0; | 76 | return 0; |
diff --git a/drivers/hid/usbhid/hid-zpff.c b/drivers/hid/usbhid/hid-zpff.c index a7fbffcdaf36..5a688274f6a3 100644 --- a/drivers/hid/usbhid/hid-zpff.c +++ b/drivers/hid/usbhid/hid-zpff.c | |||
@@ -21,10 +21,6 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | /* #define DEBUG */ | ||
25 | |||
26 | #define debug(format, arg...) pr_debug("hid-zpff: " format "\n" , ## arg) | ||
27 | |||
28 | #include <linux/input.h> | 24 | #include <linux/input.h> |
29 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
30 | #include <linux/hid.h> | 26 | #include <linux/hid.h> |
@@ -49,14 +45,14 @@ static int hid_zpff_play(struct input_dev *dev, void *data, | |||
49 | 45 | ||
50 | left = effect->u.rumble.strong_magnitude; | 46 | left = effect->u.rumble.strong_magnitude; |
51 | right = effect->u.rumble.weak_magnitude; | 47 | right = effect->u.rumble.weak_magnitude; |
52 | debug("called with 0x%04x 0x%04x", left, right); | 48 | dbg_hid("called with 0x%04x 0x%04x\n", left, right); |
53 | 49 | ||
54 | left = left * 0x7f / 0xffff; | 50 | left = left * 0x7f / 0xffff; |
55 | right = right * 0x7f / 0xffff; | 51 | right = right * 0x7f / 0xffff; |
56 | 52 | ||
57 | zpff->report->field[2]->value[0] = left; | 53 | zpff->report->field[2]->value[0] = left; |
58 | zpff->report->field[3]->value[0] = right; | 54 | zpff->report->field[3]->value[0] = right; |
59 | debug("running with 0x%02x 0x%02x", left, right); | 55 | dbg_hid("running with 0x%02x 0x%02x\n", left, right); |
60 | usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); | 56 | usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); |
61 | 57 | ||
62 | return 0; | 58 | return 0; |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 488d61bdbf2c..e793127f971e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -779,7 +779,7 @@ int hiddev_connect(struct hid_device *hid) | |||
779 | 779 | ||
780 | retval = usb_register_dev(usbhid->intf, &hiddev_class); | 780 | retval = usb_register_dev(usbhid->intf, &hiddev_class); |
781 | if (retval) { | 781 | if (retval) { |
782 | err("Not able to get a minor for this device."); | 782 | err_hid("Not able to get a minor for this device."); |
783 | kfree(hiddev); | 783 | kfree(hiddev); |
784 | return -1; | 784 | return -1; |
785 | } | 785 | } |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 130978780713..b76b02f7b52d 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
@@ -125,7 +125,7 @@ static void usb_kbd_irq(struct urb *urb) | |||
125 | resubmit: | 125 | resubmit: |
126 | i = usb_submit_urb (urb, GFP_ATOMIC); | 126 | i = usb_submit_urb (urb, GFP_ATOMIC); |
127 | if (i) | 127 | if (i) |
128 | err ("can't resubmit intr, %s-%s/input0, status %d", | 128 | err_hid ("can't resubmit intr, %s-%s/input0, status %d", |
129 | kbd->usbdev->bus->bus_name, | 129 | kbd->usbdev->bus->bus_name, |
130 | kbd->usbdev->devpath, i); | 130 | kbd->usbdev->devpath, i); |
131 | } | 131 | } |
@@ -151,7 +151,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type, | |||
151 | *(kbd->leds) = kbd->newleds; | 151 | *(kbd->leds) = kbd->newleds; |
152 | kbd->led->dev = kbd->usbdev; | 152 | kbd->led->dev = kbd->usbdev; |
153 | if (usb_submit_urb(kbd->led, GFP_ATOMIC)) | 153 | if (usb_submit_urb(kbd->led, GFP_ATOMIC)) |
154 | err("usb_submit_urb(leds) failed"); | 154 | err_hid("usb_submit_urb(leds) failed"); |
155 | 155 | ||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
@@ -169,7 +169,7 @@ static void usb_kbd_led(struct urb *urb) | |||
169 | *(kbd->leds) = kbd->newleds; | 169 | *(kbd->leds) = kbd->newleds; |
170 | kbd->led->dev = kbd->usbdev; | 170 | kbd->led->dev = kbd->usbdev; |
171 | if (usb_submit_urb(kbd->led, GFP_ATOMIC)) | 171 | if (usb_submit_urb(kbd->led, GFP_ATOMIC)) |
172 | err("usb_submit_urb(leds) failed"); | 172 | err_hid("usb_submit_urb(leds) failed"); |
173 | } | 173 | } |
174 | 174 | ||
175 | static int usb_kbd_open(struct input_dev *dev) | 175 | static int usb_kbd_open(struct input_dev *dev) |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 44b64f0d0555..898103b401f1 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -497,6 +497,11 @@ struct hid_descriptor { | |||
497 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) | 497 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) |
498 | 498 | ||
499 | /* HID core API */ | 499 | /* HID core API */ |
500 | |||
501 | #ifdef CONFIG_HID_DEBUG | ||
502 | extern int hid_debug; | ||
503 | #endif | ||
504 | |||
500 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | 505 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); |
501 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); | 506 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); |
502 | extern int hidinput_connect(struct hid_device *); | 507 | extern int hidinput_connect(struct hid_device *); |
@@ -533,14 +538,19 @@ static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } | |||
533 | #else | 538 | #else |
534 | static inline int hid_ff_init(struct hid_device *hid) { return -1; } | 539 | static inline int hid_ff_init(struct hid_device *hid) { return -1; } |
535 | #endif | 540 | #endif |
536 | #ifdef DEBUG | 541 | |
537 | #define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ | 542 | #ifdef CONFIG_HID_DEBUG |
538 | __FILE__ , ## arg) | 543 | #define dbg_hid(format, arg...) if (hid_debug) \ |
544 | printk(KERN_DEBUG "%s: " format ,\ | ||
545 | __FILE__ , ## arg) | ||
546 | #define dbg_hid_line(format, arg...) if (hid_debug) \ | ||
547 | printk(format, ## arg) | ||
539 | #else | 548 | #else |
540 | #define dbg(format, arg...) do {} while (0) | 549 | #define dbg_hid(format, arg...) do {} while (0) |
550 | #define dbg_hid_line dbg_hid | ||
541 | #endif | 551 | #endif |
542 | 552 | ||
543 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 553 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ |
544 | __FILE__ , ## arg) | 554 | __FILE__ , ## arg) |
545 | #endif | 555 | #endif |
546 | 556 | ||