Virtual Touch Events for XTEST

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 23 22:57:21 UTC 2017


On Thu, Feb 23, 2017 at 07:00:34PM +0530, Prakash P wrote:
> Thanks for your valuable help peter.
> 
> As you suggested, I am able to simulate touch events by  using uinput
> "virtual touch driver" and modified xorg.conf to load it. But the only
> quirk is, I have to create a separate "virtual touch device" and xorg.conf
> for each instance of X session.
> 
> Commands I used,
> 
> 
> *> Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile
> ./12.log  -config ./session20.xorg.conf :20> *
> The session20.xog.conf contains InputClass Entry to load only the Virtual
> Touch Device. ( I removed all generic touch device Input classes from the
> default xorg.conf otherwise the virtual touch device is getting loaded for
> all x sessions.)
> 
> 
> *Section "InputClass"        Identifier "Virtual Touch Device - 0x20"
>     MatchProduct "Virtual Touch Device - 0x20"        MatchIsTouchscreen
> "on"        MatchDevicePath "/dev/input/event*"        Driver
> "evdev"EndSection*

whoah, your email client is not a friend of line breaks, is it? :)

> I am unable to figure out how to share an "uinput device" across virtual X
> sessions.

I can't see anything obviously wrong here. Unless you're using a really
really old evdev version that runs an EVIOCGRAB on the device this should
work.

> 
> The sample code for "Virtual Touch Device" can be found in
> https://drive.google.com/file/d/0B2lQr8WlvKmzUVNDN0dETUVodEU/view?usp=sharing

I really recommend using libevdev to create uinput devices. makes things a
lot easier to read.
https://www.freedesktop.org/software/libevdev/doc/latest/group__uinput.html

Cheers,
   Peter

> 
> Thanks,
> Prakash
> 
> On 23 February 2017 at 08:29, Peter Hutterer <peter.hutterer at who-t.net>
> wrote:
> 
> > On Wed, Feb 22, 2017 at 12:25:07PM +0530, Prakash P wrote:
> > > ​​
> > > Hi,
> > >
> > > I want to create an virtual test environment for my web application. I
> > got
> > > it working with the help of xvfb and running google-chrome inside it. I
> > am
> > > able to send keytrokes and mouse events through the xdotool
> > > http://www.semicomplete.com/projects/xdotool which internally uses
> > XTEST.
> > >
> > > I do have some test cases where I have to send touch events to the chrome
> > > browser. Unfortunately the xdotool does not support sending touch
> > events. I
> > > am unable to find any info about whether XTEST supports touch events or
> > not..
> >
> > it doesn't support touch events, so going down that route isn't possible.
> >
> > > I tried creating a "virtual touch device" using user mode input subsystem
> > > "uinput" which works only on the logged in x-org session. I am able to
> > send
> > > touch events [Code attached in the bottom].
> > >
> > > But the Xvfb dont care about the virtual uinput devices the "xinput list"
> > > revealed only the following.
> > >
> > > >sudo DISPLAY=localhost:2.0 xinput list
> >
> > xvfb only initializes dummy input devices that don't do anything.
> >
> > > *⎡ Virtual core pointer                          id=2    [master pointer
> > > (3)]⎜   ↳ Virtual core XTEST pointer                id=4    [slave
> > > pointer  (2)]⎜   ↳ Xvfb mouse                                id=6
> > > [slave  pointer  (2)]⎣ Virtual core keyboard
> > > id=3    [master keyboard (2)]    ↳ Virtual core XTEST
> > > keyboard               id=5    [slave  keyboard (3)]    ↳ Xvfb
> > > keyboard                             id=7    [slave  keyboard (3)]*
> > >
> > >
> > > I also tried the virtual uinput device with "Xorg X11 dummy video driver"
> > > https://xpra.org/trac/wiki/Xdummy which is also not detecting the my
> > > "virtual touch device" ( I ran the xorg as non root).
> > >
> > >
> > > I am struck. I don't know where to proceed further.
> > > Is there any other options available? Do I have to implement something
> > else?
> >
> > The only option I can see is to run a full Xorg with the uinput touch
> > device. Short of that, I don't think anything will help.
> >
> > Cheers,
> >    Peter
> >
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Thanks,
> > > Prakash
> > >
> > >
> > > Notes,
> > > 1. Starting X virtual frame buffer -  "Xvfb :2 -screen 0 1600x900x24"
> > > 2. virtual touch device uinput code -
> > > https://drive.google.com/open?id=0B2lQr8WlvKmzZjhJOHB0b0x4ZGc   (with
> > the
> > > help of  http://thiemonge.org/getting-started-with-uinput )
> > > 3. For the xvfb - I used CentOS 7.3 with Xorg -  1.17.2, pixman 0.34.0,
> > > kernel -3.10.0
> > > 4. For the x dummy driver - I used ubuntu 16.10 with Xorg 1.18.4, pixman
> > -
> > > 0.33.6 , kernel -4.10.
> > >
> > >
> > > --
> > > Anyone who has never made a mistake has never tried anything new.
> >
> >
> 
> 
> -- 
> Anyone who has never made a mistake has never tried anything new.


More information about the xorg-devel mailing list