From a82e49b8aeb9f8dafdf6cf2e617c8b95bf056257 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Mon, 8 May 2006 14:40:13 -0700 Subject: [PATCH] USB HID/HIDBP, INPUT DRIVERS: fix various usb/input/hid-input.c bugs that make Apple Mighty Mouse work poorly Transposed lines of code in drivers/usb/input/hid-input.c causes the capability bits for a new HID device to be set before quirks are applied at configuration time. When an HID event is then sent up to the input layer, it may then be discarded as irrelevant because the wrong capability bit is set. Further, the quirks for the Apple Mighty Mouse are not quite right: the horizontal scrolling needs its axis reversed, and the left and center buttons are transposed. Also, the mouse is labeled in the kernel with its earlier name (I think) of Apple PowerMouse. Steps to reproduce problem: Plug in an Apple Mighty Mouse. Note that horizontal scrolling doesn't work at all, and in fact doesn't generate any input events on /dev/input/eventN. Note also that pushing the middle button performs the right button action, and vice versa. Once you have the horizontal scrolling working, note that it is backward WRT both to vertical scrolling and to common sense. This patch maybe should be broken up, as it does address two problems. The transposed code in hidinput_configure_usage() probably creates bugs beyond just the Mighty Mouse. The rest of the patch renames POWERMOUSE to MIGHTYMOUSE everywhere (which I *believe* is correct), fixes the MIGHTYMOUSE quirk to swap the center and right mouse buttons, and adds a new quirk HID_QUIRK_INVERT_HWHEEL also assigned to the MIGHTYMOUSE with code in hidinput_hid_event() to implement it. Signed-off-by: Bart Massey Signed-off-by: Greg Kroah-Hartman --- drivers/usb/input/hid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/usb/input/hid.h') diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 9c62837b5b8..7efbfff8add 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -247,10 +247,11 @@ struct hid_item { #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 -#define HID_QUIRK_2WHEEL_POWERMOUSE 0x00000400 +#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 /* * This is the global environment of the parser. This information is -- cgit v1.2.3 From 0f28b55db543001d360e4319bfc3f2c4e28ba05f Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 15 May 2006 14:49:04 -0400 Subject: [PATCH] usbhid: automatically set HID_QUIRK_NOGET for keyboards and mice It seems to be relatively common for USB keyboards and mice to dislike being polled for reports. Since there's no need to poll a keyboard or a mouse, this patch (as685) automatically sets the HID_QUIRK_NOGET flag for devices that advertise themselves as either sort of device with boot protocol support. This won't cure all the problems since some devices don't support the boot protocol, but it's simple and easy and it should fix quite a few problems. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/input/hid.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/usb/input/hid.h') diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 7efbfff8add..778e575de35 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -40,6 +40,14 @@ #define USB_INTERFACE_CLASS_HID 3 +/* + * USB HID interface subclass and protocol codes + */ + +#define USB_INTERFACE_SUBCLASS_BOOT 1 +#define USB_INTERFACE_PROTOCOL_KEYBOARD 1 +#define USB_INTERFACE_PROTOCOL_MOUSE 2 + /* * HID class requests */ -- cgit v1.2.3