Bug 4229 - A4Tech RP649Z mouse's second wheel does not work
Summary: A4Tech RP649Z mouse's second wheel does not work
Status: REJECTED INSUFFICIENT_DATA
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Dmitry Torokhov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-19 06:47 UTC by Patola
Modified: 2008-12-01 08:55 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.10
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
Output from usbmon when plugging in the mouse (3.47 KB, text/plain)
2006-07-22 11:46 UTC, Magnus Holmgren
Details
Preliminary patch to show what I'm talking about (3.26 KB, patch)
2006-07-23 00:47 UTC, Magnus Holmgren
Details | Diff

Description Patola 2005-02-19 06:47:44 UTC
Distribution: Debian unstable

Hardware Environment: A4TECH RP649Z Mouse. The mouse can be seen here:
http://www.a4tech.com/en/product2.asp?CID=1&SCID=5&MNO=RP-649Z

lsusb -v -s output:

Bus 003 Device 002: ID 09da:001a A4 Tech Co., Ltd Wireless Mouse & RXM-15 Receiver
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x09da A4 Tech Co., Ltd
  idProduct          0x001a Wireless Mouse & RXM-15 Receiver
  bcdDevice            0.01
  iManufacturer           1 A4Tech
  iProduct                2 RF USB Mouse
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 HID-Compliant Mouse
    bmAttributes         0xa0
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Devices
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      48
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0005  1x 5 bytes
        bInterval              10

Software Environment: Debian's XFree86 4.3.0 with evdev patch

Problem Description: The second wheel of the mouse (that would be button 8 and
9) does not work; instead, they trigger like the first wheel buttons inverted
(buttons 6 and 7).

The problem looks like the one reported here:
http://seclists.org/lists/linux-kernel/2002/Oct/9259.html

I'll paste it here for completeness----
----------------------------------------snip
On Mon, Oct 28, 2002 at 02:27:52PM +0100, Petr Vandrovec wrote:
> On Sat, Oct 26, 2002 at 09:05:38PM -0400, Zephaniah E. Hull wrote:
> > To make a long story short, mousedev.c does not properly implement the
> > EXPS/2 protocol, specificly dealing with the wheel.
> >
> > The lower 8 bits of the 4th byte are supposed to be 0x1 or 0xf to
> > indicate movement of the first wheel, and 0x2 or 0xe for the second
> > wheel.
>
> Hi,
> I was talking about this problem with Vojtech some months ago,
> and unfortunately we were not able to find correct way to implement it:
> there are mouses (probably majority) which have only one wheel, and
> which reports fast wheel movement as 2,3,4... or 0xe,0xd,.... Protocol
> is documented this way on Microsoft web pages.

Crap, I have interestingly enough never had reports of a mouse which
generates fast wheel movement in that manner, this makes things a bit
more, er, interesting.

Is this for exps2 or imps2?
(Trying to find the page from microsoft now.)
>
> Then there is another group of mices (mine A4Tech with two wheels
> being one of them) which reports vertical wheel always as 1/0xF, and
> horizontal as 2/0xE (and if you move both, they reports once horizontal
> and once vertical wheel).
>
> Unfortunately we were not able to find how to detect these mouses in
> advance, and when I asked A4Tech, I got back answer that I should use
> their mouse driver, and not one delivered by Microsoft (although Linux
> was every third word in question). From this answer I conclude that
> there is no way to autodetect it, and it has to be specified by some
> options passed to mouse driver.

We can deal with one half of this, by acting like the a4tech mice when
emulating the exps2 protocol, as far as when reading from them in PS/2
mode....

On the bright side, USB mice are fucked up in new and interesting ways!

(Have a patch for dealing with this A4Tech mouse's second wheel when it
is attached as a USB device, but until mousedev.c knows what to do with
information about the second wheel...)

Zephaniah E. Hull.
(Debian gpm maintainer.) 
------------------------------------snip


Steps to reproduce:
1. plug in your mouse
2. configure XFree86 (XF86Config04) like that for the mouse:
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "ZAxisMapping" "8 9 6 7"
#Option "Dev Name" "A4Tech RF USB Mouse"
Option "Dev Phys" "usb-*/input0"
#       Option      "Protocol" "evdev"
#       Option      "Protocol" "ExplorerPS/2"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"
        Option      "Buttons" "9"
        Option      "Resolution" "800"
EndSection
3. The mouse won't have all their buttons working correctly: buttons 6 and 7
never make events. I use this configuration for ~/.Xmodmap:
pointer = 1 2 3 6 7 8 9 4 5

That at least I have the first wheel trigger the 4 and 5 buttons and thus
working correctly. But the second wheel triggers the 5 and 4 buttons.
--------------------
I have tried using evdev (with evdev module loaded) protocol, auto protocol,
ExplorerPS/2 and such. All of them worked the same. Trying to fix my problem, I
have even editted hid-core.c and changed these lines

#define USB_VENDOR_ID_A4TECH            0x09DA
#define USB_DEVICE_ID_A4TECH_WCP32PU    0x0006

to that:

#define USB_VENDOR_ID_A4TECH            0x09DA
#define USB_DEVICE_ID_A4TECH_WCP32PU    0x001A

So that it would reflect my mouse (because of the line         {
USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU,
HID_QUIRK_2WHEEL_MOUSE_HACK_BACK },

But it didn't work either :-(
Comment 1 Patola 2005-05-20 00:30:28 UTC
My god, 3 months open and not yet a single commentary, not even a status change.
I certainly don't expect too much, but isn't this unbearably few? I mean,
c'mon!!! If you don't make this stuff work, go home and say you won't fix it,
that would be more honest. I just realized I had wasted my time pasting all
these comments.
Comment 2 Magnus Holmgren 2006-07-22 11:41:33 UTC
I've bought such a mouse now. From the usbmon output it appears that the mouse 
sends five-byte packets. The first four bytes are buttons, X, Y, and Z. The 
fifth is set to 8 if Z refers to the second (horizontal) wheel, otherwise 0. 
That would explain why horizontal wheel motion is interpreted as a REL_WHEEL 
event of +/- 1 together with a REL_MISC event of 8.
Comment 3 Magnus Holmgren 2006-07-22 11:46:41 UTC
Created attachment 8602 [details]
Output from usbmon when plugging in the mouse

Can someone help interpret this data?
Comment 4 Magnus Holmgren 2006-07-22 15:18:13 UTC
Comment on attachment 8602 [details]
Output from usbmon when plugging in the mouse

Ah, whatever. The truth is this: the mouse reports a relative input with usage
0x000100b8. It should be analogous to HID_QUIRK_2WHEEL_MOUSE_HACK_5 and _7,
which use button 5 and 7, respectively, to signal that the horizontal wheel is
the one that turned, and not the vertical one. There is just one big
difference: The buttons field comes *before* the relatives field, but the b8
input comes *after* the wheel input. Since all inputs are reported in order as
separate events from hid-core.c, it looks like hid_input_field() has to be
modified to implement this quirk.
Comment 5 Magnus Holmgren 2006-07-23 00:47:38 UTC
Created attachment 8603 [details]
Preliminary patch to show what I'm talking about

Some remaining questions:

Do all mice with the same device id (09da:001a) have this GenericDesktop.00b8
input? (I.e. do models with just one wheel have a different device id, and if
they don't, do they still send GenericDesktop.00b8 always set to 0?

What should the device id constant be called? Where does "WCP32PU" come from?
Comment 6 Natalie Protasevich 2007-11-17 22:13:30 UTC
How is the new kernel working for you? It's been a lot of fixes/updates to the subsystem since.
Thanks.
Comment 7 Natalie Protasevich 2008-03-05 17:56:17 UTC
I don't think the patch ever been submitted/reviewed. Would someone like to submit it to lkml?

Note You need to log in before you can comment on or make changes to this bug.