Re: [Question : drivers/input ] Fixing Event Filter Mechanism in input subsystem
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2014-12-22 17:26:28
Hi Anshul, On Mon, Dec 22, 2014 at 10:36:09PM +0530, Anshul Garg wrote:
In function input_pass_values in input.c file , input core sends all
events to each handler associated with the input device ,
rcu_read_lock();
handle = rcu_dereference(dev->grab);
if (handle) {
count = input_to_handler(handle, vals, count);
} else {
list_for_each_entry_rcu(handle, &dev->h_list, d_node)
if (handle->open)
count = input_to_handler(handle, vals, count);
}
after this in input_to_handler function events are filtered and sent
to the handler.
for (v = vals; v != vals + count; v++) {
if (handler->filter &&
handler->filter(handle, v->type, v->code, v->value))
continue;
if (end != v)
*end = *v;
end++;
}
But as per previous event filter mechanism all the events should be
parsed from all
handlers after that remaining events should be sent to handlers list.
And in comments also its mentioned as
/*
* Pass event first through all filters and then, if event has not been
* filtered out, through all open handles.*/
So current approach to filter events seems to be incorrect.
Please help to clarify my query.When you "grab" input device your handler gets exclusive access to all events coming form it. Neither filer handlers nor regular input handlers receive events from this device until you release it. So I believe it works as intended. Thanks. -- Dmitry