[PATCH libinput] evdev: Let dispatch instances set their own capabilities

Jonas Ådahl jadahl at gmail.com
Sun Jul 27 14:28:25 PDT 2014


It's up to a evdev device backend to configure seat capabilities it
supports. Even though it may be possible for a touchpad to have extra
keys, there is currently no support for sending keyboard events from the
touchpad driver, and if that would be implemented, it'd be a detail of
the touchpad driver, not the generic evdev device part.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---

On Thu, Jul 17, 2014 at 02:25:18PM +1000, Peter Hutterer wrote:
> On Wed, Jul 16, 2014 at 10:39:10PM +0200, Jonas Ådahl wrote:
> > The feature set configured otherwise would not work anyway as it
> > would need using the fallback dispatch to function.
> > 
> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> > ---
> >  src/evdev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/evdev.c b/src/evdev.c
> > index f980812..fec24f5 100644
> > --- a/src/evdev.c
> > +++ b/src/evdev.c
> > @@ -700,9 +700,11 @@ evdev_configure_device(struct evdev_device *device)
> >  		    !libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN) &&
> >  		    (has_abs || has_mt)) {
> >  			device->dispatch = evdev_mt_touchpad_create(device);
> > +			device->seat_caps |= EVDEV_DEVICE_POINTER;
> >  			log_info(libinput,
> >  				 "input device '%s', %s is a touchpad\n",
> >  				 device->devname, device->devnode);
> > +			return device->dispatch == NULL ? -1 : 0;
> 
> for something that is a touchpad with extra keys you're losing the keyboard
> seat_cap here. same for touch, which iirc you can get for wireless receivers
> where you may have more than one device multiplexed. which the touchpad code
> probably won't handle yet anyway, but still.

That is more or less my point. I rewrote the patch a bit, making the
actual dispatch init function configure its own seat capabilities. If
we make the touchpad driver handle keyboard events, we should only
advertise such a capability when we actually know it will work.

Jonas

 src/evdev-mt-touchpad.c | 2 ++
 src/evdev.c             | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index b58a6ca..d831b83 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -824,6 +824,8 @@ tp_init(struct tp_dispatch *tp,
 	if (tp_init_palmdetect(tp, device) != 0)
 		return -1;
 
+	device->seat_caps |= EVDEV_DEVICE_POINTER;
+
 	return 0;
 }
 
diff --git a/src/evdev.c b/src/evdev.c
index f980812..aa4cfae 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -703,6 +703,7 @@ evdev_configure_device(struct evdev_device *device)
 			log_info(libinput,
 				 "input device '%s', %s is a touchpad\n",
 				 device->devname, device->devnode);
+			return device->dispatch == NULL ? -1 : 0;
 		}
 		for (i = KEY_ESC; i < KEY_MAX; i++) {
 			if (i >= BTN_MISC && i < KEY_OK)
-- 
1.8.5.1



More information about the wayland-devel mailing list