Thread (8 messages) 8 messages, 4 authors, 2016-10-28

Re: [PATCH] Input: mt: only perform pointer emulation on drivers desiring this functionality

flat view

From: Roderick Colenbrander <hidden>
Date: 2016-10-27 23:27:09

Hi Henrik,

Please see my comments inline.

Thanks,
Roderick

On Thu, Oct 27, 2016 at 3:46 PM, Henrik Rydberg [off-list ref] wrote:
Hi Roderick,
quoted
Pointer emulation is undesired on drivers, which didn't request this
capability like the hid-sony driver for the Dualshock 4. This gamepad already
reports ABS_X / ABS_Y for gamepad stick purposes. Pointer emulation would
inject touchpad values into these sticks, which is undesired.

This patch checks the flags INPUT_MT_POINTER / INPUT_MT_DIRECT from within
input_mt_sync_frame to only allow pointer emulation when the feature was
requested by the driver as the flags were set in input_mt_init_slots.
So why call input_mt_sync_frame() in the first place?

The existing drivers that use ABS_X / ABS_Y independently do not call that
function. It seems your recent hid-sony patches adds it, which leads to broken
behavior.
As part of the review, it was recommended to call input_mt_sync_frame
to make sure we don't lose certain events.
Later on after more validation, we noticed this issue which we weren't aware of.
quoted
---
 drivers/input/input-mt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index a1bbec9..30c8128 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -305,7 +305,8 @@ void input_mt_sync_frame(struct input_dev *dev)
      if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
              use_count = true;

-     input_mt_report_pointer_emulation(dev, use_count);
+     if (mt->flags & (INPUT_MT_POINTER | INPUT_MT_DIRECT))
+             input_mt_report_pointer_emulation(dev, use_count);

      mt->frame++;
 }
That said, I am not against this patch at all, I think it is good, but the
commit message should address the effect on the large number of existing drivers
that use this functionality. Is any of them affected by this patch? As you
probably know, we do not like to break userspace.

From what I can see, only hid-multitouch (Benjamin?) and hid-sony use
input_mt_init_slots() in such a way that MT_POINTER or MT_DIRECT cannot be
directly inferred. So if Benjamin sees no issues with this, I am ok with the change.

Thanks,
Henrik
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help