Supporting mice with >3 buttons

From: Blake Scholl (bscholl+@cmu.edu)
Date: Thu Jan 06 2000 - 21:09:42 EST


Hi,

    I've been doing small amount of work on getting the 2 side buttons
(buttons 4 and 5) on my USB Explorer Mouse to work under Linux. Perhaps
I could get some feedback on whether my understanding of the current
situation is correct and what might be a good, long-term solution for
supporting mouse devices.

    From reading kernel sources, it is my present understanding that the
PS/2 mouse protocol used by the psaux and USB mouse devices support only
3 mouse buttons -- extra bits in the buttons byte of the protocol seem
to be used for indicating the sign of motion along the x,y, and z axes.
Last time I checked (2.3.35), both the USB mouse drivers (mouse.c and
now in mousedev.c) and the psaux drivers (psaux.c) both mask off
everything but the lower 3 button bits received read from the mouse.

    I'm a little confused as to why the extra sign bits are necessary,
since the ps2 protocol sends dx, dy, and dz as signed 2's compliment
numbers.

    As a proof of concept, I made slight modifications to mouse.c so
that it will pass to user-level the exact buttons byte read from
hardware. I also made slight changes to xf86_mouse.c from XFree86-3.3.5
to recognize the changes. The extra buttons worked as expected under X
without a hitch. (Unfortunately, "Zaxismapping" to support the scroll
wheel under X makes it difficult to use 5 buttons and a scroll wheel at
the same time, but this is an X issue not a kernel one.)

    In the future, would it make sense to perhaps write some sort of a
"smart" kernel mouse driver and protocol, which could supply the
user-level with extra information, such as number of buttons, axes,
etc., allowing a single protocol to support a wide variety of mice,
including ones which haven't been developed yet. Or, would meaning
putting a lot of driver smarts in the kernel that rightfully belong at
the user level?

    Given that since changes to the ps2 protocol require corresponding X
modifications, what kind of modification would be appropriate in the
standard kernel? Perhaps a CONFIG_USB_MOUSE_EXTRABUTTONS or the like?

Thanks for the feedback and info.

Blake

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:07 EST