From f345c37c37641beceb0e52f61bb4cbc72904ee09 Mon Sep 17 00:00:00 2001 From: Pekka Sarnila Date: Thu, 6 Mar 2008 13:23:14 +0100 Subject: HID: fixup fullspeed interval on highspeed Afatech DVB-T IR kbd Many vendors highspeed devices give erroneously fullspeed interval value in endpoint descriptor for interrupt endpoints. This quirk fixes up that by recalculating the right value for highspeed device. At the time of hid configuration this quirk calculates which highspeed interval value gives same interval delay as, or next smaller then, what it would be if the original value would be interpreted as fullspeed value. In subsequent urbs that new value is used instead. Forming the 'hid->name' in usb_hid_config() was moved up to accommodate more descriptive printk reporting the fixup. In this patch the quirk is set for one such device: Afatech DVB-T 2 infrared HID-keyboard. It reports value 16 which means 4,069s in highspeed while obviously 16ms was intended. In this case quirk calculates new value to be 8 which gives when interpreted as highspeed value 16ms as wanted. The behavior of the device was verified to be what expected both before and after the patch. Signed-off-by: Pekka Sarnila Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index 74ff575..af1f7e5 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -284,6 +284,7 @@ struct hid_item { #define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000 #define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 #define HID_QUIRK_MICROSOFT_KEYS 0x08000000 +#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 /* * Separate quirks for runtime report descriptor fixup -- cgit v1.1 From 974faac46455076c709a745f546b348017ad18dc Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Fri, 14 Mar 2008 15:53:49 +0100 Subject: HID: quirk for MS Wireless Desktop Receiver (model 1028) Microsoft's wireless desktop receiver (Model 1028) has a bug in the report descriptor -- namely, in four seperate places it uses USAGE_MIN and _MAX when it quite obviously doesn't intend to. In other words, it reports that it has pretty much _everything_ in 'consumer' and 'generic desktop'. And then the X evdev driver believes I have a mouse with 36 absolute axes and a huge pile of keys and buttons, when I in fact, should have zero. 255/256 in three of the cases, and 0-1024 in another. This patch fixes the report descriptor of this device before it enters the HID parser. Signed-off-by: Jim Duchek Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index af1f7e5..e9701f2 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -297,6 +297,7 @@ struct hid_item { #define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 +#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 /* * This is the global environment of the parser. This information is -- cgit v1.1 From 5f1ab74f650b392ebcaa7cf3283e56d8dc6c7e56 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Fri, 14 Mar 2008 16:53:07 +0100 Subject: HID: Sunplus Wireless Desktop needs report descriptor fixup This device has reports lower logical maximum compared to the real usages for Zoom+ and Zoom- it emits. This patch bumps the values in the report descriptor up, and also adjusts HID_MAX_USAGE accordingly. Reported-by: Khelben Blackstaff Signed-off-by: Jiri Kosina --- include/linux/hid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index e9701f2..5bf6282 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -298,6 +298,7 @@ struct hid_item { #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 +#define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100 /* * This is the global environment of the parser. This information is @@ -322,7 +323,7 @@ struct hid_global { * This is the local environment. It is persistent up the next main-item. */ -#define HID_MAX_USAGES 8192 +#define HID_MAX_USAGES 12288 #define HID_DEFAULT_NUM_COLLECTIONS 16 struct hid_local { -- cgit v1.1 From 1b184cf37f5cf098f07725b483a2055e95725476 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 9 Mar 2008 16:29:24 +0100 Subject: HID: make function from dbg_hid To check paramters even if debug is disabled, convert dbg_hid to inline function with __attribute__(format) checking. Signed-off-by: Jiri Slaby Signed-off-by: Jiri Kosina --- include/linux/hid.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index 5bf6282..69ba584 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -569,7 +569,11 @@ static inline int hid_ff_init(struct hid_device *hid) { return -1; } #define dbg_hid_line(format, arg...) if (hid_debug) \ printk(format, ## arg) #else -#define dbg_hid(format, arg...) do {} while (0) +static inline int __attribute__((format(printf, 1, 2))) +dbg_hid(const char *fmt, ...) +{ + return 0; +} #define dbg_hid_line dbg_hid #endif -- cgit v1.1 From 1d1bdd20008416a744c0c844e231e7ba69c11699 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 19 Mar 2008 21:55:04 +0100 Subject: HID: move wait from hid to usbhid Since only place where this is used is usbhid, move it there. Signed-off-by: Jiri Slaby Signed-off-by: Jiri Kosina --- include/linux/hid.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index 69ba584..9db600f 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -455,8 +455,6 @@ struct hid_device { /* device report descriptor */ void *hidraw; int minor; /* Hiddev minor number */ - wait_queue_head_t wait; /* For sleeping */ - int open; /* is the device open by anyone? */ char name[128]; /* Device name */ char phys[64]; /* Device physical location */ -- cgit v1.1 From c17f9c901c4e62cbf857b831bcc3070380449b88 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Tue, 1 Apr 2008 01:51:11 +0200 Subject: HID: force feedback driver for Logitech Rumblepad 2 Add force feedback support for Logitech Rumblepad 2. Tested-By: Edgar Simo Signed-off-by: Anssi Hannula Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index 9db600f..cd526af 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -547,6 +547,7 @@ void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char int hid_ff_init(struct hid_device *hid); int hid_lgff_init(struct hid_device *hid); +int hid_lg2ff_init(struct hid_device *hid); int hid_plff_init(struct hid_device *hid); int hid_tmff_init(struct hid_device *hid); int hid_zpff_init(struct hid_device *hid); -- cgit v1.1 From abdff0f7749a6696ba2a4238b675cbc55abcdb7a Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 31 Mar 2008 01:53:56 +0200 Subject: HID: make hid_input_field and usbhid_modify_dquirk static This patch makes the following needlessly global functions static: - hid-core.c:hid_input_field() - usbhid/hid-quirks.c:usbhid_modify_dquirk() Signed-off-by: Adrian Bunk Signed-off-by: Jiri Kosina --- include/linux/hid.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index cd526af..fe4ac31 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -531,14 +531,12 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); -void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt); void hid_output_report(struct hid_report *report, __u8 *data); void hid_free_device(struct hid_device *device); struct hid_device *hid_parse_report(__u8 *start, unsigned size); /* HID quirks API */ 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 **); -- cgit v1.1 From 69626f23bce6521367ac1e6a2a6e8fba8f0a848a Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Mon, 31 Mar 2008 16:27:30 +0200 Subject: HID: fix race between open() and disconnect() in usbhid There is a window: task A task B spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ usb_set_intfdata(intf, NULL); spin_unlock_irq(&usbhid->inlock); usb_kill_urb(usbhid->urbin); usb_kill_urb(usbhid->urbout); usb_kill_urb(usbhid->urbctrl); del_timer_sync(&usbhid->io_retry); cancel_work_sync(&usbhid->reset_work); if (!hid->open++) { res = usb_autopm_get_interface(usbhid->intf); if (res < 0) { hid->open--; return -EIO; } } if (hid_start_in(hid)) if (hid->claimed & HID_CLAIMED_INPUT) hidinput_disconnect(hid); in which an open() to an already disconnected device will submit an URB to an undead device. In case disconnect() was called by an ioctl, this'll oops. Fix by introducing a new flag and checking it in hid_start_in(). Signed-off-by: Oliver Neukum Signed-off-by: Jiri Kosina --- include/linux/hid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/hid.h b/include/linux/hid.h index fe4ac31..d951ec4 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -424,6 +424,7 @@ struct hid_control_fifo { #define HID_RESET_PENDING 4 #define HID_SUSPENDED 5 #define HID_CLEAR_HALT 6 +#define HID_DISCONNECTED 7 struct hid_input { struct list_head list; -- cgit v1.1 From 0dd91544429188b496a8136e3cffb337ff6f056b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 8 Apr 2008 10:20:36 +0200 Subject: HID: export headers properly I have people whining about using these headers in userspace, and they have __KERNEL__ markings which implies they're supposed to be exported. I also added the required linux/types.h include to hidraw.h since it uses the __u## kernel types. Signed-off-by: Mike Frysinger Cc: Jiri Kosina Cc: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Jiri Kosina --- include/linux/Kbuild | 2 ++ include/linux/hidraw.h | 1 + 2 files changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index b3d9ccd..5d74172 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -210,7 +210,9 @@ unifdef-y += hdlcdrv.h unifdef-y += hdlc.h unifdef-y += hdreg.h unifdef-y += hdsmart.h +unifdef-y += hid.h unifdef-y += hiddev.h +unifdef-y += hidraw.h unifdef-y += hpet.h unifdef-y += i2c.h unifdef-y += i2c-dev.h diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h index 0536f29..dbb5c8c 100644 --- a/include/linux/hidraw.h +++ b/include/linux/hidraw.h @@ -16,6 +16,7 @@ */ #include +#include struct hidraw_report_descriptor { __u32 size; -- cgit v1.1