diff options
author | Jiri Kosina <jkosina@suse.cz> | 2009-06-12 09:20:57 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-06-12 09:20:57 -0400 |
commit | cd667ce24796700e1a0e6e7528efc61c96ff832e (patch) | |
tree | 6279001dbecb476588873402668aa761ee2f4a8f /include/linux | |
parent | a635f9dd83f3382577f4544a96df12356e951a40 (diff) |
HID: use debugfs for events/reports dumping
This is a followup patch to the one implemeting rdesc representation in debugfs
rather than being dependent on compile-time CONFIG_HID_DEBUG setting.
The API of the appropriate formatting functions is slightly modified -- if
they are passed seq_file pointer, the one-shot output for 'rdesc' file mode
is used, and therefore the message is formatted into the corresponding seq_file
immediately.
Otherwise the called function allocated a new buffer, formats the text into the
buffer and returns the pointer to it, so that it can be queued into the ring-buffer
of the processess blocked waiting on input on 'events' file in debugfs.
'debug' parameter to the 'hid' module is now used solely for the prupose of inetrnal
driver state debugging (parser, transport, etc).
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hid-debug.h | 18 | ||||
-rw-r--r-- | include/linux/hid.h | 26 |
2 files changed, 24 insertions, 20 deletions
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h index 516e12c33235..ec08ac1ad687 100644 --- a/include/linux/hid-debug.h +++ b/include/linux/hid-debug.h | |||
@@ -24,14 +24,27 @@ | |||
24 | 24 | ||
25 | #ifdef CONFIG_DEBUG_FS | 25 | #ifdef CONFIG_DEBUG_FS |
26 | 26 | ||
27 | void hid_dump_input(struct hid_usage *, __s32); | 27 | void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); |
28 | void hid_dump_device(struct hid_device *, struct seq_file *); | 28 | void hid_dump_device(struct hid_device *, struct seq_file *); |
29 | void hid_dump_field(struct hid_field *, int, struct seq_file *); | 29 | void hid_dump_field(struct hid_field *, int, struct seq_file *); |
30 | void hid_resolv_usage(unsigned, struct seq_file *); | 30 | char *hid_resolv_usage(unsigned, struct seq_file *); |
31 | void hid_debug_register(struct hid_device *, const char *); | 31 | void hid_debug_register(struct hid_device *, const char *); |
32 | void hid_debug_unregister(struct hid_device *); | 32 | void hid_debug_unregister(struct hid_device *); |
33 | void hid_debug_init(void); | 33 | void hid_debug_init(void); |
34 | void hid_debug_exit(void); | 34 | void hid_debug_exit(void); |
35 | void hid_debug_event(struct hid_device *, char *); | ||
36 | |||
37 | #define HID_DEBUG_BUFSIZE 512 | ||
38 | |||
39 | struct hid_debug_list { | ||
40 | char *hid_debug_buf; | ||
41 | int head; | ||
42 | int tail; | ||
43 | struct fasync_struct *fasync; | ||
44 | struct hid_device *hdev; | ||
45 | struct list_head node; | ||
46 | struct mutex read_mutex; | ||
47 | }; | ||
35 | 48 | ||
36 | #else | 49 | #else |
37 | 50 | ||
@@ -44,6 +57,7 @@ void hid_debug_exit(void); | |||
44 | #define hid_debug_unregister(a) do { } while (0) | 57 | #define hid_debug_unregister(a) do { } while (0) |
45 | #define hid_debug_init() do { } while (0) | 58 | #define hid_debug_init() do { } while (0) |
46 | #define hid_debug_exit() do { } while (0) | 59 | #define hid_debug_exit() do { } while (0) |
60 | #define hid_debug_event(a,b) do { } while (0) | ||
47 | 61 | ||
48 | #endif | 62 | #endif |
49 | 63 | ||
diff --git a/include/linux/hid.h b/include/linux/hid.h index da09ab140ef1..60fa52913f89 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -451,10 +451,6 @@ 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 | |||
458 | void *driver_data; | 454 | void *driver_data; |
459 | 455 | ||
460 | /* temporary hid_ff handling (until moved to the drivers) */ | 456 | /* temporary hid_ff handling (until moved to the drivers) */ |
@@ -468,6 +464,14 @@ struct hid_device { /* device report descriptor */ | |||
468 | 464 | ||
469 | /* handler for raw output data, used by hidraw */ | 465 | /* handler for raw output data, used by hidraw */ |
470 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 466 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); |
467 | |||
468 | /* debugging support via debugfs */ | ||
469 | unsigned short debug; | ||
470 | struct dentry *debug_dir; | ||
471 | struct dentry *debug_rdesc; | ||
472 | struct dentry *debug_events; | ||
473 | struct list_head debug_list; | ||
474 | wait_queue_head_t debug_wait; | ||
471 | }; | 475 | }; |
472 | 476 | ||
473 | static inline void *hid_get_drvdata(struct hid_device *hdev) | 477 | static inline void *hid_get_drvdata(struct hid_device *hdev) |
@@ -625,9 +629,7 @@ struct hid_ll_driver { | |||
625 | 629 | ||
626 | /* HID core API */ | 630 | /* HID core API */ |
627 | 631 | ||
628 | #ifdef CONFIG_HID_DEBUG | ||
629 | extern int hid_debug; | 632 | extern int hid_debug; |
630 | #endif | ||
631 | 633 | ||
632 | extern int hid_add_device(struct hid_device *); | 634 | extern int hid_add_device(struct hid_device *); |
633 | extern void hid_destroy_device(struct hid_device *); | 635 | extern void hid_destroy_device(struct hid_device *); |
@@ -783,21 +785,9 @@ int hid_pidff_init(struct hid_device *hid); | |||
783 | #define hid_pidff_init NULL | 785 | #define hid_pidff_init NULL |
784 | #endif | 786 | #endif |
785 | 787 | ||
786 | #ifdef CONFIG_HID_DEBUG | ||
787 | #define dbg_hid(format, arg...) if (hid_debug) \ | 788 | #define dbg_hid(format, arg...) if (hid_debug) \ |
788 | printk(KERN_DEBUG "%s: " format ,\ | 789 | printk(KERN_DEBUG "%s: " format ,\ |
789 | __FILE__ , ## arg) | 790 | __FILE__ , ## arg) |
790 | #define dbg_hid_line(format, arg...) if (hid_debug) \ | ||
791 | printk(format, ## arg) | ||
792 | #else | ||
793 | static inline int __attribute__((format(printf, 1, 2))) | ||
794 | dbg_hid(const char *fmt, ...) | ||
795 | { | ||
796 | return 0; | ||
797 | } | ||
798 | #define dbg_hid_line dbg_hid | ||
799 | #endif /* HID_DEBUG */ | ||
800 | |||
801 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 791 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ |
802 | __FILE__ , ## arg) | 792 | __FILE__ , ## arg) |
803 | #endif /* HID_FF */ | 793 | #endif /* HID_FF */ |