From: "Zephaniah E. Hull" <warp@mercury.d2dc.net>

--i9LlY+UWpKt15+FH
Content-Type: multipart/mixed; boundary="sdtB3X0nJg68CQEu"
Content-Disposition: inline

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 30, 2004 at 12:20:39PM +0100, Vojtech Pavlik wrote:
> On Fri, Jan 30, 2004 at 06:18:05AM -0500, Zephaniah E. Hull wrote:
> > On Fri, Jan 30, 2004 at 12:02:05PM +0100, Vojtech Pavlik wrote:
> > > On Fri, Jan 30, 2004 at 05:48:29AM -0500, Zephaniah E. Hull wrote:
> > > > On Tue, Jan 27, 2004 at 11:34:02PM -0800, Andrew Morton wrote:
> > > > >=20
> > > > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6=
=2E2-rc2/2.6.2-rc2-mm1/
> > > > >=20
> > > > > - From now on, -mm kernels will contain the latest contents of:
> > > > >=20
> > > > > 	Vojtech's tree:		input.patch
> > > >=20
> > > > This one seems to have a rather problematic patch, which I can't fi=
nd
> > > > any explanation for.
> > >=20
> > > There is another revision of the same mouse from A4Tech (owned by
> > > Jaroslav Kysela), that reports itself as Cypress and has the buttons a
> > > bit differently.
> > >=20
> > > If it indeed collides with your mouse, then we need somehow to specify
> > > which button carries the wheel information in the quirk list.
> >=20
> > Ugh, that is not fun, it does indeed conflict.
> > How about HID_QUIRK_2WHEEL_MOUSE_HACK_EXTRA and
> > HID_QUIRK_2WHEEL_MOUSE_HACK_BACK as quirk names?
>=20
> Sounds OK.

Ok, attached.
It is against 2.6.2-rc2-mm2, and has been tested.
(Yes, I know about the line lengths.  If they are a problem, I can
tweak.)



---

 drivers/usb/input/hid-core.c  |    4 ++--
 drivers/usb/input/hid-input.c |    7 ++++---
 drivers/usb/input/hid.h       |   19 ++++++++++---------
 3 files changed, 16 insertions(+), 14 deletions(-)

diff -puN drivers/usb/input/hid-core.c~input-2wheel-mouse-fix drivers/usb/input/hid-core.c
--- 25/drivers/usb/input/hid-core.c~input-2wheel-mouse-fix	2004-01-30 09:21:53.000000000 -0800
+++ 25-akpm/drivers/usb/input/hid-core.c	2004-01-30 09:21:53.000000000 -0800
@@ -1425,8 +1425,8 @@ struct hid_blacklist {
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
 
-	{ USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK },
-	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK },
+	{ USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_BACK },
+	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_EXTRA },
 
 	{ USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
diff -puN drivers/usb/input/hid.h~input-2wheel-mouse-fix drivers/usb/input/hid.h
--- 25/drivers/usb/input/hid.h~input-2wheel-mouse-fix	2004-01-30 09:21:53.000000000 -0800
+++ 25-akpm/drivers/usb/input/hid.h	2004-01-30 09:21:53.000000000 -0800
@@ -201,15 +201,16 @@ struct hid_item {
  * HID device quirks.
  */
 
-#define HID_QUIRK_INVERT		0x001
-#define HID_QUIRK_NOTOUCH		0x002
-#define HID_QUIRK_IGNORE		0x004
-#define HID_QUIRK_NOGET			0x008
-#define HID_QUIRK_HIDDEV		0x010
-#define HID_QUIRK_BADPAD		0x020
-#define HID_QUIRK_MULTI_INPUT		0x040
-#define HID_QUIRK_2WHEEL_MOUSE_HACK	0x080
-#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON	0x100
+#define HID_QUIRK_INVERT			0x001
+#define HID_QUIRK_NOTOUCH			0x002
+#define HID_QUIRK_IGNORE			0x004
+#define HID_QUIRK_NOGET				0x008
+#define HID_QUIRK_HIDDEV			0x010
+#define HID_QUIRK_BADPAD			0x020
+#define HID_QUIRK_MULTI_INPUT			0x040
+#define HID_QUIRK_2WHEEL_MOUSE_HACK_BACK	0x080
+#define HID_QUIRK_2WHEEL_MOUSE_HACK_EXTRA	0x100
+#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
 
 /*
  * This is the global environment of the parser. This information is
diff -puN drivers/usb/input/hid-input.c~input-2wheel-mouse-fix drivers/usb/input/hid-input.c
--- 25/drivers/usb/input/hid-input.c~input-2wheel-mouse-fix	2004-01-30 09:21:53.000000000 -0800
+++ 25-akpm/drivers/usb/input/hid-input.c	2004-01-30 09:21:53.000000000 -0800
@@ -377,7 +377,8 @@ static void hidinput_configure_usage(str
 
 	set_bit(usage->type, input->evbit);
 	if ((usage->type == EV_REL)
-			&& (device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK)
+			&& (device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_BACK
+				| HID_QUIRK_2WHEEL_MOUSE_HACK_EXTRA))
 			&& (usage->code == REL_WHEEL)) {
 		set_bit(REL_HWHEEL, bit);
 	}
@@ -431,8 +432,8 @@ void hidinput_hid_event(struct hid_devic
 
 	input_regs(input, regs);
 
-	if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK)
-			&& (usage->code == BTN_BACK || usage->code == BTN_EXTRA)) {
+	if (((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_EXTRA) && (usage->code == BTN_EXTRA))
+		|| (hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_BACK) && (usage->code == BTN_BACK)) {
 		if (value)
 			hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
 		else

_