how to get fake input events to a Xinput2 master device?

Peter Hutterer peter.hutterer at who-t.net
Fri Nov 21 22:57:17 PST 2008


On Sat, Nov 22, 2008 at 01:52:48AM +0100, Christian Beier wrote:
> (1) Master Devices created on the fly:
> I know it's possible to create MD's via xinput, but i've got no idea
> how to get application-generated events (from x11vnc) to a specific
> master device. Via XTEST maybe? But according to
> http://www.x.org/docs/Xext/xtestlib.pdf there's no way to address a
> specific master device. I've read the Xlib docs as well and found
> nothing on that. The Xinput docs weren't fruitful neither... But I'm
> sure there must be a way to do it in userspace?

XTestFakeDeviceButtonEvent, etc. It injects the event server-sided as if the
event was created by the input driver (although there isn't one for MDs), so
it'll generate the appropriate core/device events. I only tested that to some
extent, so please file a bug if it doesn't quite work right.
Having said that, injecting events into a MD directly is a bit troublesome due
to the design of the MD/SD device hierarchy. This is one more thing that needs
fixing before XI2 actually comes out.

> (2) Fake Slave Devices
> If there's no way of doing things like in (1), i would have to rely on
> faking slave devices and attach these to master devices. As a slave
> device represents a physical device, i think there's no way of creating
> one via xinput. So i thought about sth. like creating a SD with the
> uinput kernel driver and making it known to hal. Or maybe via the evdev
> driver and pointing it to a device file that gets fed from x11vnc?

IMHO long-term uinput gives you much more flexibility than doing anything with
xtest. I'd definitely go for that approach.

Cheers,
  Peter



More information about the xorg mailing list