提交 c080d89a 编写于 作者: J Jiri Kosina

HID: hid debug from hid-debug.h to hid layer

hid-debug.h contains a lot of code, and should not therefore
be a header.

This patch moves the code to generic hid layer as .c source, and
introduces CONFIG_HID_DEBUG to conditionally compile it, instead
of playing with #define DEBUG and including hid-debug.h.
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 20eb1279
...@@ -22,5 +22,19 @@ config HID ...@@ -22,5 +22,19 @@ config HID
If unsure, say Y If unsure, say Y
config HID_DEBUG
bool "HID debugging support"
depends on HID
---help---
This option lets the HID layer output diagnostics about its internal
state, resolve HID usages, dump HID fields, etc. Individual HID drivers
use this debugging facility to output information about individual HID
devices, etc.
This feature is useful for those who are either debugging the HID parser
or any HID hardware device.
If unsure, say N
endmenu endmenu
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
hid-objs := hid-core.o hid-input.o hid-objs := hid-core.o hid-input.o
# Optional parts of multipart objects. # Optional parts of multipart objects.
ifeq ($(CONFIG_HID_DEBUG),y)
obj-$(CONFIG_HID) += hid.o hid-objs += hid-debug.o
endif
ifeq ($(CONFIG_INPUT_DEBUG),y) ifeq ($(CONFIG_INPUT_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
endif endif
obj-$(CONFIG_HID) += hid.o
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/wait.h> #include <linux/wait.h>
#undef DEBUG
#undef DEBUG_DATA #undef DEBUG_DATA
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/hiddev.h> #include <linux/hiddev.h>
#include <linux/hid-debug.h>
/* /*
* Version Information * Version Information
......
此差异已折叠。
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#undef DEBUG #undef DEBUG
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/hid-debug.h>
static int hid_pb_fnmode = 1; static int hid_pb_fnmode = 1;
module_param_named(pb_fnmode, hid_pb_fnmode, int, 0644); module_param_named(pb_fnmode, hid_pb_fnmode, int, 0644);
...@@ -254,7 +255,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -254,7 +255,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
#ifdef DEBUG #ifdef DEBUG
printk(KERN_DEBUG "Mapping: "); printk(KERN_DEBUG "Mapping: ");
resolv_usage(usage->hid); hid_resolv_usage(usage->hid);
printk(" ---> "); printk(" ---> ");
#endif #endif
...@@ -682,8 +683,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -682,8 +683,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
field->dpad = usage->code; field->dpad = usage->code;
} }
#ifdef DEBUG hid_resolv_event(usage->type, usage->code);
resolv_event(usage->type, usage->code); #ifdef CONFIG_HID_DEBUG
printk("\n"); printk("\n");
#endif #endif
return; return;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/hiddev.h> #include <linux/hiddev.h>
#include <linux/hid-debug.h>
#include "usbhid.h" #include "usbhid.h"
/* /*
......
此差异已折叠。
...@@ -472,16 +472,6 @@ struct hid_descriptor { ...@@ -472,16 +472,6 @@ struct hid_descriptor {
struct hid_class_descriptor desc[1]; struct hid_class_descriptor desc[1];
} __attribute__ ((packed)); } __attribute__ ((packed));
#ifdef DEBUG
#include "hid-debug.h"
#else
#define hid_dump_input(a,b) do { } while (0)
#define hid_dump_device(c) do { } while (0)
#define hid_dump_field(a,b) do { } while (0)
#define resolv_usage(a) do { } while (0)
#define resolv_event(a,b) do { } while (0)
#endif
/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
/* We ignore a few input applications that are not widely used */ /* We ignore a few input applications that are not widely used */
#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册