hid: only dump report traffic with debug level 2
PATCH 1/1 hid: only dump report traffic with debug level 2
Currently using debug=1 with hid module prints out all sent and received reports to the kernel log, while in many cases we only want to see the report descriptors and hid-input mappings that are printed when a device is probed.
Add new level debug=2, and only dump the report traffic with that level.
---
drivers/hid/hid-core.c +2 -2
@@ -43,8 +43,8 @@#ifdef CONFIG_HID_DEBUG int hid_debug =0 ; -module_param_named (debug, hid_debug, bool,0600 ); -MODULE_PARM_DESC (debug,"Turn HID debugging mode on and off" ); +module_param_named (debug, hid_debug, int,0600 ); +MODULE_PARM_DESC (debug,"HID debugging (0=off, 1=probing info, 2=continuous data dumping)" );EXPORT_SYMBOL_GPL (hid_debug);#endif
drivers/hid/hid-debug.c +1 -1
@@ -498,7 +498,7 @@EXPORT_SYMBOL_GPL (hid_dump_device);void hid_dump_input (struct hid_usage *usage,__s32 value) { -if (!hid_debug) +if (hid_debug <2 )return ;printk (KERN_DEBUG "hid-debug: input " );
-- Anssi Hannula
Quoted 4 lines · Anssi Hannula
Currently using debug=1 with hid module prints out all sent and received reports to the kernel log, while in many cases we only want to see the report descriptors and hid-input mappings that are printed when a device is probed.
Hi Anssi,
thanks for your patch, I agree that making this more configurable makes sense.
But I would propose staying backwards compatible, i.e. debug=1 does the whole dump, debug=2 excludes the individual reports but still dumps the report descriptor and mappings etc. What do you think?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 7 lines · Jiri Kosina
Quoted 4 lines · Anssi Hannula
Currently using debug=1 with hid module prints out all sent and received reports to the kernel log, while in many cases we only want to see the report descriptors and hid-input mappings that are printed when a device is probed.
Quoted 8 lines
Hi Anssi,
thanks for your patch, I agree that making this more configurable makes sense.
But I would propose staying backwards compatible, i.e. debug=1 does the whole dump, debug=2 excludes the individual reports but still dumps the report descriptor and mappings etc. What do you think?
Well, I think having higher debug level should mean more debugging output and that this logic is more important than backwards compatibility of a debug option, it is not like it is going to break any software or so.
But I don't care too much about it, feel free to do it the other way as well :)
Signature · 1 line
Anssi Hannula
Quoted 4 lines · Anssi Hannula
Well, I think having higher debug level should mean more debugging output and that this logic is more important than backwards compatibility of a debug option, it is not like it is going to break any software or so.
I agee. On the other hand, I am currently quite often telling people who (for example) complain about non-functioning keys on some expotic keyboard "just modprobe the hid module with debug=1, press the non-functioning key, and send me dmesg output". This would now be different depending on the kernel version they use, which I don't like too much.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 7 lines · Jiri Kosina
Quoted 4 lines · Anssi Hannula
Well, I think having higher debug level should mean more debugging output and that this logic is more important than backwards compatibility of a debug option, it is not like it is going to break any software or so.
Quoted 5 lines
I agee. On the other hand, I am currently quite often telling people who (for example) complain about non-functioning keys on some expotic keyboard "just modprobe the hid module with debug=1, press the non-functioning key, and send me dmesg output". This would now be different depending on the kernel version they use, which I don't like too much.
Wouldn't debug=2 work with older kernel versions as well?
Signature · 1 line
Anssi Hannula
Quoted 7 lines · Anssi Hannula
Quoted 6 lines
I agee. On the other hand, I am currently quite often telling people who (for example) complain about non-functioning keys on some expotic keyboard "just modprobe the hid module with debug=1, press the non-functioning key, and send me dmesg output". This would now be different depending on the kernel version they use, which I don't like too much.
Wouldn't debug=2 work with older kernel versions as well?
Of course it would, I need to have some rest, sorry for the noise :)
I will apply your patch to my tree, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs