Re: [PATCH 09/19] Input: MT - Handle frame synchronization in core

From
Henrik Rydberg <hidden>
Date
2012-08-20 15:57:14
Also in
lkml
Reply to
Benjamin Tissoires, 2012-08-20
quoted
Collect common frame synchronization tasks in a new function,
input_mt_sync_frame(). Depending on the flags set, it drops
unseen contacts and performs pointer emulation.
I was really wondering why you needed to put in input-mt something
that appeared only in hid-multitouch.... until I noted that you are
going to use it for bcm5974.
True, you were only copied in on the patch specific to
hid-multitouch. The core changes will naturally be used for some other
drivers as well.
Maybe you should add a comment on it (otherwise, it seams like you're
just adding unused code). Maybe this would also help people
understanding the *frame thing.
More comments on those plans, agreed. The "frame thing" is really only
an input core change; it can most likely be better explained as well,
but it really should not matter to drivers.
quoted
+void input_mt_sync_frame(struct input_dev *dev)
+{
+       struct input_mt *mt = dev->mt;
+       struct input_mt_slot *s;
+
+       if (!mt)
+               return;
+
+       if (mt->flags & INPUT_MT_DROP_UNUSED) {
+               for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
+                       if (s->frame == mt->frame)
+                               continue;
+                       input_mt_slot(dev, s - mt->slots);
+                       input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
Shouldn't we rely on input_mt_report_slot_state instead of doing it by hand?
No, input_mt_report_slot_state() is a driver api function with side
effects which are not desired here.
 
quoted
+               }
+       }
+
+       if (mt->flags & INPUT_MT_POINTER)
+               input_mt_report_pointer_emulation(dev, true);
+
+       if (mt->flags & INPUT_MT_DIRECT)
+               input_mt_report_pointer_emulation(dev, false);
The function input_mt_report_pointer_emulation could be called twice
if the driver has both INPUT_MT_POINTER and INPUT_MT_DIRECT flags. Are
they mutual exclusive?
You are right, and they are not. Will fix.

Thanks,
Henrik
Thread (45 messages) 45 messages, 8 authors, last reply 2012-08-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help