From: Vojtech Pavlik <vojtech@suse.cz>
To: "Zephaniah E. Hull" <warp@mercury.d2dc.net>,
linux-kernel@vger.kernel.org
Subject: Re: [patch] Problem with mousedev.c
Date: Wed, 30 Oct 2002 17:11:17 +0100 [thread overview]
Message-ID: <20021030171117.A12597@ucw.cz> (raw)
In-Reply-To: <20021030160440.GA27563@babylon.d2dc.net>; from warp@mercury.d2dc.net on Wed, Oct 30, 2002 at 11:04:40AM -0500
On Wed, Oct 30, 2002 at 11:04:40AM -0500, Zephaniah E. Hull wrote:
> On Wed, Oct 30, 2002 at 04:59:22PM +0100, Vojtech Pavlik wrote:
> > On Wed, Oct 30, 2002 at 10:32:57AM -0500, Zephaniah E. Hull wrote:
> > > Sadly, if PS/2 mice are any indication, mouse makers /will/ manage to
> > > fuck things up on enough popular mice under USB as well, and there needs
> > > to be a place to shove the dirty hacks needed to make things Just Work
> > > for users..
> >
> > That place would be hid-input.c and psmouse.c. NOT mousedev.c.
>
> Agreed, at the moment my patch for dealing with the A4 mouse hits three
> files in the HID layer, and is not the cleanest, however it is attached
> for reference.
The patch is quite OK, it should not report BTN_BACK to userspace,
though, and also it should not depend on the hid-input.c assigning
BTN_BACK to the button which specifies the wheel.
> Now if I could only find (better) documentation on the various PS2
> protocols to find one that has in the spec itself handling for multiple
> wheels..
>
> --
> 1024D/E65A7801 Zephaniah E. Hull <warp@babylon.d2dc.net>
> 92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801
> CCs of replies from mailing lists are requested.
>
> "I would rather spend 10 hours reading someone else's source code than
> 10 minutes listening to Musak waiting for technical support which
> isn't."
> (By Dr. Greg Wettstein, Roger Maris Cancer Center)
> diff -ur linux.orig/drivers/usb/hid-core.c linux/drivers/usb/hid-core.c
> --- linux.orig/drivers/usb/hid-core.c 2002-10-26 20:31:21.000000000 -0400
> +++ linux/drivers/usb/hid-core.c 2002-10-27 01:45:04.000000000 -0400
> @@ -1086,6 +1086,8 @@
> #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204
> #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205
>
> +#define USB_VENDOR_ID_A4TECH 0x09DA
> +#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
> struct hid_blacklist {
> __u16 idVendor;
> __u16 idProduct;
> @@ -1115,6 +1117,7 @@
> { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
> { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
> { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
> + { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK },
> { 0, 0 }
> };
>
> diff -ur linux.orig/drivers/usb/hid-input.c linux/drivers/usb/hid-input.c
> --- linux.orig/drivers/usb/hid-input.c 2001-11-11 13:09:37.000000000 -0500
> +++ linux/drivers/usb/hid-input.c 2002-10-27 03:36:52.000000000 -0500
> @@ -269,6 +269,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);
> @@ -303,6 +308,20 @@
> struct input_dev *input = &hid->input;
> int *quirks = &hid->quirks;
>
> + 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;
> if (value < 0 || value > 8) value = 0;
> diff -ur linux.orig/drivers/usb/hid.h linux/drivers/usb/hid.h
> --- linux.orig/drivers/usb/hid.h 2002-10-26 20:31:21.000000000 -0400
> +++ linux/drivers/usb/hid.h 2002-10-27 01:43:23.000000000 -0400
> @@ -186,6 +186,8 @@
> #define HID_QUIRK_NOTOUCH 0x02
> #define HID_QUIRK_IGNORE 0x04
> #define HID_QUIRK_NOGET 0x08
> +#define HID_QUIRK_2WHEEL_MOUSE_HACK 0x10
> +#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x20
>
> /*
> * This is the global enviroment of the parser. This information is
--
Vojtech Pavlik
SuSE Labs
next prev parent reply other threads:[~2002-10-30 16:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-27 1:05 [patch] Problem with mousedev.c Zephaniah E. Hull
2002-10-28 13:27 ` Petr Vandrovec
2002-10-28 17:00 ` Zephaniah E. Hull
2002-10-28 17:40 ` Vojtech Pavlik
2002-10-30 15:32 ` Zephaniah E. Hull
2002-10-30 15:59 ` Vojtech Pavlik
2002-10-30 16:04 ` Zephaniah E. Hull
2002-10-30 16:11 ` Vojtech Pavlik [this message]
2002-10-30 16:21 ` Zephaniah E. Hull
-- strict thread matches above, loose matches on Subject: below --
2002-10-30 16:46 Petr Vandrovec
2002-10-30 18:37 ` Zephaniah E. Hull
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=20021030171117.A12597@ucw.cz \
--to=vojtech@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=warp@mercury.d2dc.net \
/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