From: Anshul Garg <aksgarg1...@gmail.com>

As input_pass_values function is called everytime when EV_SYN is sent
from input driver or input event buffer becomes full. So avoid running
auto repeat code if input device doesn't support EV_KEY and EV_REP
event type.

Signed-off-by: Anshul Garg <anshu...@samsung.com>
---
 drivers/input/input.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 213e3a1..601171b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -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_KEY, dev->evbit) && test_bit(EV_REP, 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);
+                       }
                }
        }
 }
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to