XInput extension, xf86XInput, evdev and a spaceball

Steffen Seeger seeger at physik.tu-chemnitz.de
Sun Aug 30 05:28:37 PDT 2009


Hello everybody,
[This is quite specific to the input layers, so may be 
Oliver McFadden or Peter Hutterer may know,
but any help is appreciated.]

I am trying to get an older 3D controller (SpaceTec SpaceBall 3003C)
to work with Fedora11. It's just so nice to have when controlling 3D
objects :-). The typical use is mouse/keyboard in one hand to controll 
focus/windowmanager/menus/actions and the other on the spaceball
to control position and tilt of an 3D cursor or object.

I want to use it via the XInput extension, as this seems the best
way to stay OS independent. I got it working somehow, but trying 
to sort out the last issues I got stuck somewhere between the evdev
driver, XInput extension and dix layer.

The evdev layer is working, the device gets detected and 'kcmshell4 joystick'
shows the valuator and button states as expected. Handing some magic
configuration potion to haldaemon made the evdev driver recognize the
device as well.

However, my problem is that the device gets reported (and used) as
XExtensionPointer device, which is not how you typically use that device.
The effect is that moving the spaceball you control the valuators
of the XInput device, but also the core pointer position.
This moves the core pointer, the core pointer sprite and possibly focus
to the center of the screen each time the spaceball is touched.
Also, the spaceball is not reported as a XI_SPACEBALL type device
as applications might expect. I got around this problem with some
minor if's and else's in the evdev driver, mainly stripping
XI86_POINTER_CAPABLE from pInfo->flags.
With those modifications in the evdev driver, the core pointer doesn't
move any longer, but the events still get posted as core pointer motion
events (it just decouples motion of the pointer sprite from 
valuator position).

After some investigation found this to be possibly due some strange and
possibly inconsistent heuristics in dix/events.c:IsPointerDevice() and
Xi/listdev.c:CopySwapDevice().  Everything with valuators and buttons
is considered as a PointerDevice (either core or extended).
Changing that assumption to consider only devices with two valuators and
buttons as PointerDevice and making consistent use of IsPointerDevice().
made indeed the spaceball appear as XExtensionDevice.
[Note: Don't know how this change affects touchpads with pressure evaluation].

But: No valuator events are reported.

The reason seams to be that the evdev input driver properly collects the
valuator state and calls
	hw/common/xfree/xf86Xinput.c:xf86PostMotionEventsP()
which finally calls 
	dix/getevents.c:GetPointerEvents()
which does not seem to care about valuator only devices (but
somehow scales axis x and y to have screen coordinates).

This is where I got lost: How to report button and motion events for
a plain XExtensionDevice that does not have reasonable use as core
keyboard or pointer (e.g. something like a knob box)...?


All the best,
Steffen

PS: I am currently not subscribed to xorg-devel, so can you please
cc any replies? Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xserver-1.6.1-spaceball.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20090830/788c2cd0/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xf86-input-evdev-2.2.99.1-spaceball.patch
Type: text/x-patch
Size: 2578 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20090830/788c2cd0/attachment-0001.bin 


More information about the xorg-devel mailing list