libinput user devices use case

Peter Hutterer peter.hutterer at who-t.net
Sun Oct 6 23:59:04 BST 2019


Hi Nicolas, team :)

On Sun, Oct 06, 2019 at 05:47:00PM +0200, Nicolas Fella wrote:
> Hi Peter,
> 
> I enjoyed your talk at XDC and come to you with a potential use case for
> libinput user devices.
> 
> I'm one of the developers of KDE Connect (https://community.kde.org/
> KDEConnect), which amongst other things allows one to send mouse/keyboard
> events from the phone to a PC. On X11 we use XTest for mouse and libFakeKey
> for keyboard input. On Wayland we use a KWin-specific protocol for mouse input,
> but we don't have support for other compositors and no support for keyboard
> input at all. Obviously that's something we'd like to change.
> 
> Would it be possible/reasonable to use libinput user devices to make KDE
> Connect act as such a device and inject fake events into other applications?
> This would not only solve the issue of supporting multiple compositors but
> would also enable interesting new use cases such as making the phone act as a
> real (multitouch) touchpad or touchscreen.
> 
> What do you think?

simply said: I'm not sure. libinput user devices are a bit of a special case
for everything, they're designed to emulate *any* input device but the
drawback of that is that you'll have to speak the correct protocol which
isn't always that simple.

I think for what you need - where you need to emulate very specific *events*
(not devices) a wayland protocol or back channel that emulates those will be
a better fit. if gives you better, more explicit control over the content of
these events. e.g. an explicit "move 3 pixels to the left" which is
something you cannot do over evdev as the movement is device-specific.

keyboard events are relatively trival as long as you want to emulate
keycodes, which is all evdev would allow you to do anyway.

the real issue with any sort of input emulation in wayland is not the "how"
but the "who", i.e. who's authorized to send those events. user devices
don't solve that question either. if you can figure out the answer to that,
then the custom wayland protocol would be simple enough too.

Cheers,
   Peter



More information about the KDEConnect mailing list