[RFC PATCH libinput 1/2] Add a string-based input API
Peter Hutterer
peter.hutterer at who-t.net
Mon Feb 11 00:50:47 UTC 2019
On Sat, Feb 09, 2019 at 12:13:39PM +0100, Samuel Thibault wrote:
> Hello,
>
> Digging back on this.
>
> Peter Hutterer, le lun. 08 déc. 2014 16:05:56 +1000, a ecrit:
> > Some devices don't rely on keycodes + xkb layout but rather send a specific
> > keysym (or multiple) in response to physical button presses. This is the case
> > for chorded keyboards for example.
> >
> > This adds a new type of key event that provides UTF8 strings. The
> > press/release pair applies to this type as well, the exact behavior of when
> > the release event is sent is implementation dependent.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > Cc: Samuel Thibault <samuel.thibault at ens-lyon.org>
> > ---
> > Not intending to merge this yet, this is supposed to spark some discussion.
> > We don't have real support for this in the kernel and I don't have access to
> > any device that really generates keysysms. PoC is in Patch 2, but in the
> > real world the device will likely be hooked up through some other means than
> > evdev.
> >
> > Until we have reliable testing and know what the details need to be for
> > device support, this remains an RFC (but now archived on the list instead of
> > just locally).
>
> Thanks for this!
>
> Unfortunately it remained a chicken-and-egg thing for these years. I
> don't know how I can plug something that would produce such events. I
> can easily write a brlapi module that takes input from a braille device
> and emits string events, I just don't know how to plug it into the
> libinput stack. Perhaps somebody could write (or point me to) a dumb
> libinput piece skeleton which I'll be able to fill?
short answer: this doesn't exist yet. libinput uses evdev devices
exclusively right now and a fair bit of rework is required to be able to add
devices not backed by an evdev fd.
There is are *very* hacky way to provide a PoC though. Look at
evdev_device_create() and search for libevdev_new_from_fd().
Use libevdev_change_fd() after that call to change the fd for any device
without libevdev re-syncing its state. If you open some socket (retrieve
it from getenv() or so) you can change the fd for something that speaks your
input without libevdev noticing. The libevdev context remains valid, so
everything else will work.
evdev_device_dispatch() then needs the changes to read the data you provide
instead of struct input_event and post the new event.
Sprinkle in a few conditions for this to only apply to the braille device
and not any other system devices and you're good to go for testing. You
probably really want to test with with sudo ./builddir/libinput-debug-events
before installing though :)
Cheers,
Peter
More information about the wayland-devel
mailing list