aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/linux/hid-debug.h32
-rw-r--r--include/linux/hid.h4
2 files changed, 23 insertions, 13 deletions
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h
index 50d568ec178a..516e12c33235 100644
--- a/include/linux/hid-debug.h
+++ b/include/linux/hid-debug.h
@@ -2,7 +2,7 @@
2#define __HID_DEBUG_H 2#define __HID_DEBUG_H
3 3
4/* 4/*
5 * Copyright (c) 2007 Jiri Kosina 5 * Copyright (c) 2007-2009 Jiri Kosina
6 */ 6 */
7 7
8/* 8/*
@@ -22,24 +22,30 @@
22 * 22 *
23 */ 23 */
24 24
25#ifdef CONFIG_HID_DEBUG 25#ifdef CONFIG_DEBUG_FS
26 26
27void hid_dump_input(struct hid_usage *, __s32); 27void hid_dump_input(struct hid_usage *, __s32);
28void hid_dump_device(struct hid_device *); 28void hid_dump_device(struct hid_device *, struct seq_file *);
29void hid_dump_field(struct hid_field *, int); 29void hid_dump_field(struct hid_field *, int, struct seq_file *);
30void hid_resolv_usage(unsigned); 30void hid_resolv_usage(unsigned, struct seq_file *);
31void hid_resolv_event(__u8, __u16); 31void hid_debug_register(struct hid_device *, const char *);
32void hid_debug_unregister(struct hid_device *);
33void hid_debug_init(void);
34void hid_debug_exit(void);
32 35
33#else 36#else
34 37
35#define hid_dump_input(a,b) do { } while (0) 38#define hid_dump_input(a,b) do { } while (0)
36#define hid_dump_device(c) do { } while (0) 39#define hid_dump_device(c) do { } while (0)
37#define hid_dump_field(a,b) do { } while (0) 40#define hid_dump_field(a,b) do { } while (0)
38#define hid_resolv_usage(a) do { } while (0) 41#define hid_resolv_usage(a) do { } while (0)
39#define hid_resolv_event(a,b) do { } while (0) 42#define hid_resolv_event(a,b) do { } while (0)
40 43#define hid_debug_register(a, b) do { } while (0)
41#endif /* CONFIG_HID_DEBUG */ 44#define hid_debug_unregister(a) do { } while (0)
45#define hid_debug_init() do { } while (0)
46#define hid_debug_exit() do { } while (0)
42 47
48#endif
43 49
44#endif 50#endif
45 51
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a72876e43589..da09ab140ef1 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -451,6 +451,10 @@ struct hid_device { /* device report descriptor */
451 char phys[64]; /* Device physical location */ 451 char phys[64]; /* Device physical location */
452 char uniq[64]; /* Device unique identifier (serial #) */ 452 char uniq[64]; /* Device unique identifier (serial #) */
453 453
454 /* debugfs */
455 struct dentry *debug_dir;
456 struct dentry *debug_rdesc;
457
454 void *driver_data; 458 void *driver_data;
455 459
456 /* temporary hid_ff handling (until moved to the drivers) */ 460 /* temporary hid_ff handling (until moved to the drivers) */