From 58037eb961f859607b161c50d9d4ecb374de1e8f Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Wed, 30 May 2007 15:07:13 +0200 Subject: HID: make debugging output runtime-configurable There have been many reports recently about broken HID devices, the diagnosis of which required users to recompile their kernels in order to be able to provide debugging output needed for coding a quirk for a particular device. This patch makes CONFIG_HID_DEBUG default y if !EMBEDDED and makes it possible to control debugging output produced by HID code by supplying 'debug=1' module parameter. Signed-off-by: Jiri Kosina --- include/linux/hid.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/hid.h b/include/linux/hid.h index 827ee748fd4c..eb53d9a9ae54 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -488,6 +488,11 @@ struct hid_descriptor { #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) /* HID core API */ + +#ifdef CONFIG_HID_DEBUG +extern int hid_debug; +#endif + extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); extern int hidinput_connect(struct hid_device *); @@ -523,14 +528,19 @@ static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } #else static inline int hid_ff_init(struct hid_device *hid) { return -1; } #endif -#ifdef DEBUG -#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ - __FILE__ , ## arg) + +#ifdef CONFIG_HID_DEBUG +#define dbg_hid(format, arg...) if (hid_debug) \ + printk(KERN_DEBUG "%s: " format ,\ + __FILE__ , ## arg) +#define dbg_hid_line(format, arg...) if (hid_debug) \ + printk(format, ## arg) #else -#define dbg(format, arg...) do {} while (0) +#define dbg_hid(format, arg...) do {} while (0) +#define dbg_hid_line dbg_hid #endif -#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ +#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ __FILE__ , ## arg) #endif -- cgit v1.2.3 From defd208681b721dbf2b69347cca5302d60246405 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Sat, 19 May 2007 16:28:04 +0200 Subject: HID: force hid-input for Microsoft SideWinder GameVoice device Microsoft SideWinder GameVoice driver is a trivial device with a few buttons (0x09 HID usage) and an audio connector, which just forwards the audio input into oridinary sound card present in the computer. Despite this fact, the only interface of this device reports itself as a Telephony/Headset type of HID device. This is apparently incorrect - the device itself doesn't provide any audio/telephony functionality. This is achieved in userland application which only needs to receive the button events from the HID driver. This patch establishes a new quirk which forces hid-input to claim a device it will otherwise leave untouched. Reported-by: Tomas Carnecky Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/hid.h b/include/linux/hid.h index 827ee748fd4c..6e45d1056e1b 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -276,6 +276,7 @@ struct hid_item { #define HID_QUIRK_DUPLICATE_USAGES 0x00200000 #define HID_QUIRK_RESET_LEDS 0x00400000 #define HID_QUIRK_SWAPPED_MIN_MAX 0x00800000 +#define HID_QUIRK_HIDINPUT 0x01000000 /* * This is the global environment of the parser. This information is -- cgit v1.2.3 From 92d9e6e607eb7f8f1d2a43935f45cf300cf6fdf8 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Mon, 18 Jun 2007 13:30:11 +0200 Subject: HID: support for Petalynx Maxter remote control Petalynx Maxter remote control [1] 0x18b1/0x0037 emits 0xfa and 0xfc from consumer page (reserved in HUT 1.12) for back and more keys. It also emits a few usages from LOGIVENDOR page, which need adding. Also, this device has broken report descriptor - the reported maximum is too low - it doesn't contain the range for 'back' and 'more' keys, so we need to bump it up before the report descriptor is being parsed. Besides all this, it also requires NOGET quirk. This patch does so. [1] http://www.elmak.pl/index.php?option=com_phpshop&page=shop.browse&category_id=14&ext=opis&lang=en Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/hid.h b/include/linux/hid.h index 6e45d1056e1b..e41067951dd9 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -277,6 +277,7 @@ struct hid_item { #define HID_QUIRK_RESET_LEDS 0x00400000 #define HID_QUIRK_SWAPPED_MIN_MAX 0x00800000 #define HID_QUIRK_HIDINPUT 0x01000000 +#define HID_QUIRK_PETALYNX_DESCRIPTOR 0x02000000 /* * This is the global environment of the parser. This information is -- cgit v1.2.3 From ea9a4a8b0e5a34eca6613e39d21be879d92ecff5 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Tue, 19 Jun 2007 14:09:14 +0200 Subject: HID: separate quirks for report descriptor fixup Lately there have been quite a lot of bug reports against broken devices which require us to fix their report descriptor in the runtime, before it is passed to the HID parser. Those devices have eaten quite an amount of our quirks space, which isn't particularly necessary - the quirks are not needed after the report descriptor is parsed, and they just consume bits. Therefore this patch separates the quirks for report descriptor fixup, and moves their handling into separate code. The quirks are then forgotten as soon as the report descriptor has been parsed. Module parameter 'rdesc_quirks' is introduced to be able to modify these quirks in runtime in a similar way to 'quirks' parameter for ordinary HID quirks. Signed-off-by: Jiri Kosina --- include/linux/hid.h | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/linux/hid.h b/include/linux/hid.h index e41067951dd9..4daf5eea78a1 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -263,21 +263,26 @@ struct hid_item { #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 #define HID_QUIRK_MIGHTYMOUSE 0x00000400 -#define HID_QUIRK_CYMOTION 0x00000800 -#define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000 -#define HID_QUIRK_POWERBOOK_FN_ON 0x00002000 -#define HID_QUIRK_INVERT_HWHEEL 0x00004000 -#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000 -#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00010000 -#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000 -#define HID_QUIRK_IGNORE_MOUSE 0x00040000 -#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00080000 -#define HID_QUIRK_LOGITECH_DESCRIPTOR 0x00100000 -#define HID_QUIRK_DUPLICATE_USAGES 0x00200000 -#define HID_QUIRK_RESET_LEDS 0x00400000 -#define HID_QUIRK_SWAPPED_MIN_MAX 0x00800000 -#define HID_QUIRK_HIDINPUT 0x01000000 -#define HID_QUIRK_PETALYNX_DESCRIPTOR 0x02000000 +#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800 +#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000 +#define HID_QUIRK_INVERT_HWHEEL 0x00002000 +#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00004000 +#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 +#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 +#define HID_QUIRK_IGNORE_MOUSE 0x00020000 +#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000 +#define HID_QUIRK_DUPLICATE_USAGES 0x00080000 +#define HID_QUIRK_RESET_LEDS 0x00100000 +#define HID_QUIRK_HIDINPUT 0x00200000 + +/* + * Separate quirks for runtime report descriptor fixup + */ + +#define HID_QUIRK_RDESC_CYMOTION 0x00000001 +#define HID_QUIRK_RDESC_LOGITECH 0x00000002 +#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 +#define HID_QUIRK_RDESC_PETALYNX 0x00000008 /* * This is the global environment of the parser. This information is @@ -508,6 +513,7 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, const u32 quirks); int usbhid_quirks_init(char **quirks_param); void usbhid_quirks_exit(void); +void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); #ifdef CONFIG_HID_FF int hid_ff_init(struct hid_device *hid); -- cgit v1.2.3 From 5f9c464aaa1ba3a773c47004e98eb1f3aa2ab2a4 Mon Sep 17 00:00:00 2001 From: Ryo Dairiki Date: Mon, 25 Jun 2007 10:31:12 +0200 Subject: HID: support for logitech cordless desktop LX500 special mapping This keyboard has wireless mouse which has left, middle, right buttons and 2-dimensional scrolling wheel. Unfornetuly, this wheel reports side scrolling events and 11 or 12 button events at the same time. I've wrote a patch to fix this mapping. I'm not sure if this mapping is proper for buttons, because , for example, there is no entry for "burn cd" in input.h. The patch also supress 11 and 12 button events from mouse when you scroll the wheel left and right. With this patch, only side scrolling events are reported. (This mouse has only 4 buttons and 2D wheel. There is no such buttons like 11 and 12.) Signed-off-by: Jiri Kosina --- include/linux/hid.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/hid.h b/include/linux/hid.h index 4daf5eea78a1..44b64f0d0555 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -274,6 +274,8 @@ struct hid_item { #define HID_QUIRK_DUPLICATE_USAGES 0x00080000 #define HID_QUIRK_RESET_LEDS 0x00100000 #define HID_QUIRK_HIDINPUT 0x00200000 +#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 +#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 /* * Separate quirks for runtime report descriptor fixup -- cgit v1.2.3