public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: [patch] input: Implement HID quirk for A4Tech mice [3/13]
Date: Sat, 14 Jun 2003 22:37:08 +0200	[thread overview]
Message-ID: <20030614223708.B25997@ucw.cz> (raw)
In-Reply-To: <20030614223629.A25997@ucw.cz>; from vojtech@suse.cz on Sat, Jun 14, 2003 at 10:36:29PM +0200


You can pull this changeset from:
	bk://kernel.bkbits.net/vojtech/input

===================================================================

ChangeSet@1.1215.104.20, 2003-06-09 13:52:46+02:00, warp@mercury.d2dc.net
  input: Implement a HID quirk for 2-wheel A4Tech mice.


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

===================================================================

diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	Sat Jun 14 22:22:02 2003
+++ b/drivers/usb/input/hid-core.c	Sat Jun 14 22:22:02 2003
@@ -1351,6 +1351,9 @@
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5	0x0100
 
+#define USB_VENDOR_ID_A4TECH		0x09DA
+#define USB_DEVICE_ID_A4TECH_WCP32PU	0x0006
+
 struct hid_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
@@ -1398,6 +1401,7 @@
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK },
 	{ 0, 0 }
 };
 
diff -Nru a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
--- a/drivers/usb/input/hid-input.c	Sat Jun 14 22:22:02 2003
+++ b/drivers/usb/input/hid-input.c	Sat Jun 14 22:22:02 2003
@@ -376,6 +376,11 @@
 	}
 
 	set_bit(usage->type, input->evbit);
+	if ((usage->type == EV_REL)
+			&& (device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK)
+			&& (usage->code == REL_WHEEL)) {
+		set_bit(REL_HWHEEL, bit);
+	}
 
 	while (usage->code <= max && test_and_set_bit(usage->code, bit)) {
 		usage->code = find_next_zero_bit(bit, max + 1, usage->code);
@@ -425,6 +430,20 @@
 		return;
 
 	input_regs(input, regs);
+
+	if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK)
+			&& (usage->code == BTN_BACK)) {
+		if (value)
+			hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
+		else
+			hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
+		return;
+	}
+	if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON)
+			&& (usage->code == REL_WHEEL)) {
+		input_event(input, usage->type, REL_HWHEEL, value);
+		return;
+	}
 
 	if (usage->hat_min != usage->hat_max) {
 		value = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1;
diff -Nru a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	Sat Jun 14 22:22:01 2003
+++ b/drivers/usb/input/hid.h	Sat Jun 14 22:22:01 2003
@@ -201,13 +201,15 @@
  * HID device quirks.
  */
 
-#define HID_QUIRK_INVERT	0x01
-#define HID_QUIRK_NOTOUCH	0x02
-#define HID_QUIRK_IGNORE	0x04
-#define HID_QUIRK_NOGET		0x08
-#define HID_QUIRK_HIDDEV	0x10
-#define HID_QUIRK_BADPAD        0x20
-#define HID_QUIRK_MULTI_INPUT	0x40
+#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
 
 /*
  * This is the global environment of the parser. This information is

  reply	other threads:[~2003-06-14 20:23 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-14 20:35 [patch] input: Implement device grabbing [1/13] Vojtech Pavlik
2003-06-14 20:36 ` [patch] input: Fix sunkbd keybit bitfield filling [2/13] Vojtech Pavlik
2003-06-14 20:37   ` Vojtech Pavlik [this message]
2003-06-14 20:39     ` [patch] input: Add hiragana/katakana keys to atkbd.c [4/13] Vojtech Pavlik
2003-06-14 20:40       ` [patch] input: Add PCI PS/2 controller support [5/13] Vojtech Pavlik
2003-06-14 20:40         ` [patch] input: Turn numlock ON on HP HIL machines [6/13] Vojtech Pavlik
2003-06-14 20:41           ` [patch] input: Add keys for HP HIL [7/13] Vojtech Pavlik
2003-06-14 20:42             ` [patch] input: Fix CLOCK_TICK_RATE usage ... [8/13] Vojtech Pavlik
2003-06-14 20:43               ` [patch] input: Fix i8042 interrupts on I2000 ia64 machines [9/13] Vojtech Pavlik
2003-06-14 20:44                 ` [patch] input: Fix sending reports in USB HID [10/13] Vojtech Pavlik
2003-06-14 20:45                   ` [patch] input: Fix hiddev_ioctl() [11/13] Vojtech Pavlik
2003-06-14 20:45                     ` [patch] input: Fix minor errors in input-programming.txt [12/13] Vojtech Pavlik
2003-06-14 20:46                       ` [patch] input: Add Synaptics touchpad support [13/13] Vojtech Pavlik
2003-06-14 21:05               ` [patch] input: Fix CLOCK_TICK_RATE usage ... [8/13] Riley Williams
2003-06-14 21:14                 ` Vojtech Pavlik
2003-06-15 10:51                   ` Riley Williams
2003-06-16 18:57                     ` David Mosberger
2003-06-17 22:11                       ` Riley Williams
2003-06-17 22:19                         ` David Mosberger
2003-06-17 22:21                           ` Vojtech Pavlik
2003-06-17 22:34                             ` David Mosberger
2003-06-17 22:42                               ` Vojtech Pavlik
2003-06-17 22:48                                 ` Russell King
2003-06-17 22:53                                   ` Vojtech Pavlik
2003-06-19 12:13                                   ` David Woodhouse
2003-06-19 14:19                                     ` Russell King
2003-06-17 23:08                                 ` David Mosberger
2003-06-17 23:14                                   ` Vojtech Pavlik
2003-06-17 23:24                                     ` David Mosberger
2003-06-17 23:31                                       ` Vojtech Pavlik
2003-06-18  0:47                                         ` george anzinger
2003-06-25  8:03                                         ` Riley Williams
2003-06-25 17:20                                           ` David Mosberger
2003-06-25 17:56                                             ` Riley Williams
2003-06-25 18:49                                               ` David Mosberger
2003-06-25 19:58                                             ` Vojtech Pavlik
2003-06-25 20:09                                               ` David Mosberger
2003-06-25 20:25                                               ` Assorted warnings while building 2.5.73 J.C. Wren
2003-06-18 14:47                                       ` [patch] input: Fix CLOCK_TICK_RATE usage ... [8/13] Hollis Blanchard
2003-06-18 18:50                                         ` David Mosberger
2003-06-17 22:21                         ` Russell King
2003-06-17 22:38                           ` Vojtech Pavlik
2003-06-18  0:46                             ` george anzinger
2003-06-18  1:00                           ` george anzinger
2003-06-14 20:51         ` [patch] input: Add PCI PS/2 controller support [5/13] Oliver Neukum
2003-06-14 21:03           ` Vojtech Pavlik
2003-06-14 21:04           ` Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030614223708.B25997@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox