Skip to content

Commit

Permalink
Input: small tweak to autorepeat handling
Browse files Browse the repository at this point in the history
If a device does not support autorepeat or does not emit any key events we
should not be scanning all events in a packet to decide if we should start
or stop autorepeat function.

Signed-off-by: Anshul Garg <anshul.g@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Anshul Garg authored and Dmitry Torokhov committed Jan 8, 2015
1 parent 061a5ad commit 5ab1714
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ static void input_pass_values(struct input_dev *dev,
add_input_randomness(vals->type, vals->code, vals->value);

/* trigger auto repeat for key events */
for (v = vals; v != vals + count; v++) {
if (v->type == EV_KEY && v->value != 2) {
if (v->value)
input_start_autorepeat(dev, v->code);
else
input_stop_autorepeat(dev);
if (test_bit(EV_REP, dev->evbit) && test_bit(EV_KEY, dev->evbit)) {
for (v = vals; v != vals + count; v++) {
if (v->type == EV_KEY && v->value != 2) {
if (v->value)
input_start_autorepeat(dev, v->code);
else
input_stop_autorepeat(dev);
}
}
}
}
Expand Down

0 comments on commit 5ab1714

Please sign in to comment.