X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-debug.c;h=5c24fe46d8eb9c423637888f163e70dedb2281c2;hb=1d84b5424efbcce69a1c955ba181147d23d43a14;hp=89241be4ec9b070a3679c3453c7a8c4a3dc1792d;hpb=b0138a6cb7923a997d278b47c176778534d1095b;p=linux-2.6-omap-h63xx.git diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 89241be4ec9..5c24fe46d8e 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -29,11 +29,12 @@ */ #include +#include struct hid_usage_entry { unsigned page; unsigned usage; - char *description; + const char *description; }; static const struct hid_usage_entry hid_usage_table[] = { @@ -346,6 +347,9 @@ static void resolv_usage_page(unsigned page) { void hid_resolv_usage(unsigned usage) { const struct hid_usage_entry *p; + if (!hid_debug) + return; + resolv_usage_page(usage >> 16); printk("."); for (p = hid_usage_table; p->description; p++) @@ -361,13 +365,16 @@ void hid_resolv_usage(unsigned usage) { } EXPORT_SYMBOL_GPL(hid_resolv_usage); -__inline__ static void tab(int n) { - while (n--) printk(" "); +static void tab(int n) { + printk(KERN_DEBUG "%*s", n, ""); } void hid_dump_field(struct hid_field *field, int n) { int j; + if (!hid_debug) + return; + if (field->physical) { tab(n); printk("Physical("); @@ -394,8 +401,8 @@ void hid_dump_field(struct hid_field *field, int n) { tab(n); printk("Unit Exponent(%d)\n", field->unit_exponent); } if (field->unit) { - char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" }; - char *units[5][8] = { + static const char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" }; + static const char *units[5][8] = { { "None", "None", "None", "None", "None", "None", "None", "None" }, { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, @@ -450,7 +457,7 @@ void hid_dump_field(struct hid_field *field, int n) { printk("%s", HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute "); printk("%s", HID_MAIN_ITEM_WRAP & j ? "Wrap " : ""); printk("%s", HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : ""); - printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPrefferedState " : ""); + printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPreferredState " : ""); printk("%s", HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : ""); printk("%s", HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : ""); printk("%s", HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : ""); @@ -463,7 +470,10 @@ void hid_dump_device(struct hid_device *device) { struct hid_report *report; struct list_head *list; unsigned i,k; - static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; + static const char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; + + if (!hid_debug) + return; for (i = 0; i < HID_REPORT_TYPES; i++) { report_enum = device->report_enum + i; @@ -488,13 +498,16 @@ void hid_dump_device(struct hid_device *device) { EXPORT_SYMBOL_GPL(hid_dump_device); void hid_dump_input(struct hid_usage *usage, __s32 value) { - printk("hid-debug: input "); + if (!hid_debug) + return; + + printk(KERN_DEBUG "hid-debug: input "); hid_resolv_usage(usage->hid); printk(" = %d\n", value); } EXPORT_SYMBOL_GPL(hid_dump_input); -static char *events[EV_MAX + 1] = { +static const char *events[EV_MAX + 1] = { [EV_SYN] = "Sync", [EV_KEY] = "Key", [EV_REL] = "Relative", [EV_ABS] = "Absolute", [EV_MSC] = "Misc", [EV_LED] = "LED", @@ -503,10 +516,10 @@ static char *events[EV_MAX + 1] = { [EV_FF_STATUS] = "ForceFeedbackStatus", }; -static char *syncs[2] = { +static const char *syncs[2] = { [SYN_REPORT] = "Report", [SYN_CONFIG] = "Config", }; -static char *keys[KEY_MAX + 1] = { +static const char *keys[KEY_MAX + 1] = { [KEY_RESERVED] = "Reserved", [KEY_ESC] = "Esc", [KEY_1] = "1", [KEY_2] = "2", [KEY_3] = "3", [KEY_4] = "4", @@ -684,7 +697,8 @@ static char *keys[KEY_MAX + 1] = { [KEY_DEL_LINE] = "DeleteLine", [KEY_SEND] = "Send", [KEY_REPLY] = "Reply", [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save", - [KEY_DOCUMENTS] = "Documents", + [KEY_DOCUMENTS] = "Documents", [KEY_SPELLCHECK] = "SpellCheck", + [KEY_LOGOFF] = "Logoff", [KEY_FN] = "Fn", [KEY_FN_ESC] = "Fn+ESC", [KEY_FN_1] = "Fn+1", [KEY_FN_2] = "Fn+2", [KEY_FN_B] = "Fn+B", [KEY_FN_D] = "Fn+D", @@ -702,7 +716,7 @@ static char *keys[KEY_MAX + 1] = { [KEY_SWITCHVIDEOMODE] = "SwitchVideoMode", }; -static char *relatives[REL_MAX + 1] = { +static const char *relatives[REL_MAX + 1] = { [REL_X] = "X", [REL_Y] = "Y", [REL_Z] = "Z", [REL_RX] = "Rx", [REL_RY] = "Ry", [REL_RZ] = "Rz", @@ -710,7 +724,7 @@ static char *relatives[REL_MAX + 1] = { [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc", }; -static char *absolutes[ABS_MAX + 1] = { +static const char *absolutes[ABS_MAX + 1] = { [ABS_X] = "X", [ABS_Y] = "Y", [ABS_Z] = "Z", [ABS_RX] = "Rx", [ABS_RY] = "Ry", [ABS_RZ] = "Rz", @@ -726,12 +740,12 @@ static char *absolutes[ABS_MAX + 1] = { [ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc", }; -static char *misc[MSC_MAX + 1] = { +static const char *misc[MSC_MAX + 1] = { [MSC_SERIAL] = "Serial", [MSC_PULSELED] = "Pulseled", [MSC_GESTURE] = "Gesture", [MSC_RAW] = "RawData" }; -static char *leds[LED_MAX + 1] = { +static const char *leds[LED_MAX + 1] = { [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", @@ -739,16 +753,16 @@ static char *leds[LED_MAX + 1] = { [LED_MISC] = "Misc", }; -static char *repeats[REP_MAX + 1] = { +static const char *repeats[REP_MAX + 1] = { [REP_DELAY] = "Delay", [REP_PERIOD] = "Period" }; -static char *sounds[SND_MAX + 1] = { +static const char *sounds[SND_MAX + 1] = { [SND_CLICK] = "Click", [SND_BELL] = "Bell", [SND_TONE] = "Tone" }; -static char **names[EV_MAX + 1] = { +static const char **names[EV_MAX + 1] = { [EV_SYN] = syncs, [EV_KEY] = keys, [EV_REL] = relatives, [EV_ABS] = absolutes, [EV_MSC] = misc, [EV_LED] = leds, @@ -757,8 +771,10 @@ static char **names[EV_MAX + 1] = { void hid_resolv_event(__u8 type, __u16 code) { + if (!hid_debug) + return; + printk("%s.%s", events[type] ? events[type] : "?", names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); } EXPORT_SYMBOL_GPL(hid_resolv_event); -