Input: Hard-keys input support using libinput and weston 1.8.0

Vikas Patil vikasmpatil at gmail.com
Sun Nov 1 22:21:03 PST 2015


On Mon, Nov 2, 2015 at 7:56 AM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
>
> On Fri, Oct 30, 2015 at 11:43:34AM +0530, Vikas Patil wrote:
> > I have a requirement where Hard-Keys input events (e.g. Home button, Back
> > button, Volume buttons or Volume Rotary Knobs) needs to be injected into
> > weston compositor and passed to application or application can listen on
> > those events using wayland/weston some way.
>hardkey button
> probably best to explain the use-case you have in a bit more detail, there
> may be more than one solution (or zero, come to think of it :)
>

I like to provide a wayland/weston APIs to application developer to
handle hardkey button events (something similar wl_touch, wl_keyboard
usage, in my case it can be wl_hardkey may be). I have five hard-keys
on IVI device connected via GPIO (button 1, button 2, power button,
rotatry knob (connected to two gpio)). These keys usage it not clear
to me at the moment but any application can use I think. Will give
more information once I get.

Is there any other method available without providing standard wayland
API to application developer to detect hard key evevnt and act on it?

One possible way to implement this is to inject hardkey event as
keyboard event to "evdev but not sure what all changes are required in
complete input stack? I think need to start with evdev modification to
throw the events with require data.


> > Does weston 1.8.0 and libinput supports such kind of inputs? Or Do I need
> > to extend the full path of input (evdev -> libinput -> weston) to support
> > this? How much effort require for this?Thanks
> >
> > Could you give some suggestions/ideas to start this as I am very new to
> > input handling? It would be also helpful if you could refer me some
> > docs/links to understand this?
>
> libinput forwards key events from evdev devices pretty much as-is, weston
> handles it depending on the keyboard layout. so one solution is to create a
> uinput device that generates those events and let the rest of the stack do
> the thing it does anyway. That requires root privs to create the uinput
> device though.
>

Thanks for the suggestion. Will look into uinput. Does this means
application then would be able to handle the hardkey as mapped key
(e.g. button 1 mapped tp A) events inside app?

> http://wayland.freedesktop.org/libinput/doc/latest/ has a simple
> architecture diagram.
> you can't inject events into libinput directly, and afaik there is no
> waylan protocol extension to allow you to this there either.
>


Best Regards,
Vikash


More information about the wayland-devel mailing list