aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2009-06-12 09:20:55 -0400
committerJiri Kosina <jkosina@suse.cz>2009-06-12 09:20:55 -0400
commita635f9dd83f3382577f4544a96df12356e951a40 (patch)
treec6fa27df6d01c34e304a32c9f423d569f7358346 /drivers/hid/hid-input.c
parent8ebf975608aaebd7feb33d77f07ba21a6380e086 (diff)
HID: use debugfs for report dumping descriptor
It is a little bit inconvenient for people who have some non-standard HID hardware (usually violating the HID specification) to have to recompile kernel with CONFIG_HID_DEBUG to be able to see kernel's perspective of the HID report descriptor and observe the parsed events. Plus the messages are then mixed up inconveniently with the rest of the dmesg stuff. This patch implements /sys/kernel/debug/hid/<device>/rdesc file, which represents the kernel's view of report descriptor (both the raw report descriptor data and parsed contents). With all the device-specific debug data being available through debugfs, there is no need for keeping CONFIG_HID_DEBUG, as the 'debug' parameter to the hid module will now only output only driver-specific debugging options, which has absolutely minimal memory footprint, just a few error messages and one global flag (hid_debug). We use the current set of output formatting functions. The ones that need to be used both for one-shot rdesc seq_file and also for continuous flow of data (individual reports, as being sent by the device) distinguish according to the passed seq_file parameter, and if it is NULL, it still output to kernel ringbuffer, otherwise the corresponding seq_file is used for output. The format of the output is preserved. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 7f183b7147e..5862b0f3b55 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -159,17 +159,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
159 159
160 field->hidinput = hidinput; 160 field->hidinput = hidinput;
161 161
162 dbg_hid("Mapping: ");
163 hid_resolv_usage(usage->hid);
164 dbg_hid_line(" ---> ");
165
166 if (field->flags & HID_MAIN_ITEM_CONSTANT) 162 if (field->flags & HID_MAIN_ITEM_CONSTANT)
167 goto ignore; 163 goto ignore;
168 164
169 /* only LED usages are supported in output fields */ 165 /* only LED usages are supported in output fields */
170 if (field->report_type == HID_OUTPUT_REPORT && 166 if (field->report_type == HID_OUTPUT_REPORT &&
171 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { 167 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) {
172 dbg_hid_line(" [non-LED output field] ");
173 goto ignore; 168 goto ignore;
174 } 169 }
175 170
@@ -561,15 +556,9 @@ mapped:
561 set_bit(MSC_SCAN, input->mscbit); 556 set_bit(MSC_SCAN, input->mscbit);
562 } 557 }
563 558
564 hid_resolv_event(usage->type, usage->code);
565
566 dbg_hid_line("\n");
567
568 return;
569
570ignore: 559ignore:
571 dbg_hid_line("IGNORED\n");
572 return; 560 return;
561
573} 562}
574 563
575void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) 564void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)