evdev and buttons.

Zephaniah E. Hull warp at aehallh.com
Thu Feb 9 02:53:08 PST 2006


This is in reference to the evdev driver rewrite in bug #5696.

Currently, this supports keyboards and mice just fine, and absolute
handling is on the way and mostly trivial. (Though, hard to test on this
end, no absolute devices handy.)

The catch has to do with buttons.

The evdev interface has space allocated for 96 buttons, with 65 of those
defined.

Those are in groups, each group having space for 16 buttons, though to
date the most used in a group is 15 buttons.

The groups defined are BTN_MISC, BTN_MOUSE, BTN_JOYSTICK, BTN_GAMEPAD,
BTN_DIGI, and BTN_WHEEL.

Right now the patch only supports BTN_MOUSE, mapping those to be the
first buttons.

This works fine for mice, but starts to break for touchpads (which at
minimum also have a BTN_TOUCH), and fails entirely for joysticks (which
are another type of absolute pointer device, not very useful as core
pointers though).

Things are further complicated by the fact that some devices have
buttons in multiple groups, which eliminates one option entirely.


The remaining options are as follows:

1: Swap BTN_MISC and BTN_MOUSE so mouse buttons are still the first
buttons, and report the rest of the buttons as they fall.

This puts the joystick trigger as button 33, and for someone plugging in
a USB steering wheel they would have the gear shift as buttons 81 and
82.

This is, not really optimal, but it would work.
(And a mixture of xsetpointer and xmodmap can of course remap those
however it would like, though a new tool that can modify the pointer
mappings without changing the core pointer should be written, it's on my
todo list.)


2: Treat buttons much like we treat rel axies, and compress them so that
the first button found is button 1, the second is button 2, etc.

This has the strong benefit of not having buttons with insane numbers,
and with not having 'holes'.

But it makes it impossible for applications to 'know' that button 33 is
the joystick trigger.

Probably not a huge loss, but present.

It should be noted that the wacom driver (which is not a huge concern,
as it already exists and uses evdev) uses the BTN_MISC range for the
tablets, along with the BTN_MOUSE range for the mouse buttons, other
tablets may do this as well and be a problem.


3: Swap BTN_MOUSE and BTN_MISC as in 1, but compact as in 2.

Avoids the wacom problem.


4: Something else that I have not thought of yet, feel free to offer
suggestions.


So, before I go and figure out the best way to implement these, I could
use some feedback on the prefered solution.

And no, I'm afraid that I simply will not be implementing all of them
and letting the user select which in the config, that's _waaay_ too much
ugly code for my comfort.


Zephaniah E. Hull.

-- 
	  1024D/E65A7801 Zephaniah E. Hull <warp at aehallh.com>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

<cas> well there ya go.  say something stupid in irc and have it
      immortalised forever in someone's .sig file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20060209/2066285a/attachment.pgp>


More information about the xorg mailing list