From 58037eb961f859607b161c50d9d4ecb374de1e8f Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Wed, 30 May 2007 15:07:13 +0200 Subject: 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 --- drivers/hid/hid-debug.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/hid/hid-debug.c') diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 83c4126b37c..a13757b7898 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -347,6 +347,9 @@ static void resolv_usage_page(unsigned page) { void hid_resolv_usage(unsigned usage) { const struct hid_usage_entry *p; + if (!hid_debug) + return; + resolv_usage_page(usage >> 16); printk("."); for (p = hid_usage_table; p->description; p++) @@ -369,6 +372,9 @@ __inline__ static void tab(int n) { void hid_dump_field(struct hid_field *field, int n) { int j; + if (!hid_debug) + return; + if (field->physical) { tab(n); printk("Physical("); @@ -466,6 +472,9 @@ void hid_dump_device(struct hid_device *device) { unsigned i,k; static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; + if (!hid_debug) + return; + for (i = 0; i < HID_REPORT_TYPES; i++) { report_enum = device->report_enum + i; list = report_enum->report_list.next; @@ -489,6 +498,9 @@ void hid_dump_device(struct hid_device *device) { EXPORT_SYMBOL_GPL(hid_dump_device); void hid_dump_input(struct hid_usage *usage, __s32 value) { + if (!hid_debug) + return; + printk("hid-debug: input "); hid_resolv_usage(usage->hid); printk(" = %d\n", value); @@ -758,6 +770,9 @@ static char **names[EV_MAX + 1] = { void hid_resolv_event(__u8 type, __u16 code) { + if (!hid_debug) + return; + printk("%s.%s", events[type] ? events[type] : "?", names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); } -- cgit