evdev: keyboard or mouse?

Sebastian Glita glseba at yahoo.com
Wed Dec 3 06:59:03 PST 2008


Hi,

xinput --reattach did the trick.
I didn't see the messages "configure as mouse/keyboard/..." as *additive*, so I thought only one must occur.
But can one "filter" the device so that it is exactly and only a pointer? Or the reverse?
Ι rewrote a little EvdevProbe's find/configure chain. (including the last has_scroll commit)
First it goes "dry-run" to detect what can be configured.
If option UseAsPointing is true (can only be from user), it tries to
disregard, in the following, the keys, unless UseAsKeyboard is true as
well.
The same holds for option UseAsKeyboard.
If they are not specified, then there is a normal behavior, covering
any capability and naming as keyboard (so KEYBOARD is sort of like KEYPANEL).
Then it configures what was totally discovered, excluding the what
specifically was *not* requested. It's a simple
auto-include&user-exclude mechanism.
The code is also somehow clearer of what it does, separating the stages: you can easily track the *additive* style in the end.
It is of course redundant. But it answers the intuitive shallow
question regarding these situations. For me, I want to UseAsPointing
only.
I made a diff for the evdev.c file.

Thanks,
Seba


----- Original Message ----
From: Peter Hutterer <peter.hutterer at who-t.net>
To: Sebastian Glita <glseba at yahoo.com>
Cc: xorg at lists.freedesktop.org
Sent: Monday, December 1, 2008 1:41:10 AM
Subject: Re: evdev: keyboard or mouse?

On Fri, Nov 28, 2008 at 05:58:22AM -0800, Sebastian Glita wrote:
> The mice and keyboards in xf86-input-evdev/src/evdev.c:EvdevProbe handle a
> "multiple-capability" device wrong for my use.
> 
> I have a wireless USB receiver so I use both a mouse and a keyboard with the
> same token.
> 
> In `hal-device`, the device for the mouse also has "input.keys" matching
> "info.capabilities".
> 
> I tried in /etc/hal/fdi/10-x11-input.fdi to <remove> from
> "info.capabilities" the "info.keys" from this strlist. It works.

The device probing is independent of HAL, so removing this key won't affect
evdev at all.

> The problem is that in `gnome-device-setup' when I drag the name from the
> Virtual Core Pointer it goes only to a keyboard item, and not to the
> "pointer" one (its "use" matches IsXExtensionKeyboard instead of
> IsXExtensionPointer).

Unless someone has actually taken the code and advanced it, I wouldn't trust
on gnome-device-setup 100%. Try xinput --reattach <mouse name> "Virtual core
pointer" and see if that works.

> This small permutation in evdev.c works for me (it disables `has_keys' in
> favor of XI_MOUSE to XI_KEYBOARD):

please always submit code changes as diffs, otherwise it's too hard to figure
out what the actual change was.

>     if (has_axes && num_buttons)
>         has_keys = FALSE;

No. Doing so means you essentially disable all keys on the device. I've seen
keyboards that advertise buttons and axes (scrollwheel) so you'd be disabling
all these keyboards.


Cheers,
  Peter



      
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: evdev.diff
URL: <http://lists.x.org/archives/xorg/attachments/20081203/b370b960/attachment.ksh>


More information about the xorg mailing list