aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-debug.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2007-05-30 09:07:13 -0400
committerJiri Kosina <jkosina@suse.cz>2007-07-09 08:03:35 -0400
commit58037eb961f859607b161c50d9d4ecb374de1e8f (patch)
treec192854fa4cfc16cce272b800a0393e21429191e /drivers/hid/hid-debug.c
parent7dcca30a32aadb0520417521b0c44f42d09fe05c (diff)
HID: make debugging output runtime-configurable
There have been many reports recently about broken HID devices, the diagnosis of which required users to recompile their kernels in order to be able to provide debugging output needed for coding a quirk for a particular device. This patch makes CONFIG_HID_DEBUG default y if !EMBEDDED and makes it possible to control debugging output produced by HID code by supplying 'debug=1' module parameter. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-debug.c')
-rw-r--r--drivers/hid/hid-debug.c15
1 files changed, 15 insertions, 0 deletions
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) {
347void hid_resolv_usage(unsigned usage) { 347void 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) {
369void hid_dump_field(struct hid_field *field, int n) { 372void 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) {
489EXPORT_SYMBOL_GPL(hid_dump_device); 498EXPORT_SYMBOL_GPL(hid_dump_device);
490 499
491void hid_dump_input(struct hid_usage *usage, __s32 value) { 500void 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
759void hid_resolv_event(__u8 type, __u16 code) { 771void 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}