aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index f075fbbfb1e7..fbe522d0ead7 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -69,6 +69,22 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz)
69 return value; 69 return value;
70} 70}
71 71
72static void input_start_autorepeat(struct input_dev *dev, int code)
73{
74 if (test_bit(EV_REP, dev->evbit) &&
75 dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
76 dev->timer.data) {
77 dev->repeat_key = code;
78 mod_timer(&dev->timer,
79 jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
80 }
81}
82
83static void input_stop_autorepeat(struct input_dev *dev)
84{
85 del_timer(&dev->timer);
86}
87
72/* 88/*
73 * Pass event first through all filters and then, if event has not been 89 * Pass event first through all filters and then, if event has not been
74 * filtered out, through all open handles. This function is called with 90 * filtered out, through all open handles. This function is called with
@@ -105,6 +121,15 @@ static void input_pass_event(struct input_dev *dev,
105 } 121 }
106 122
107 rcu_read_unlock(); 123 rcu_read_unlock();
124
125 /* trigger auto repeat for key events */
126 if (type == EV_KEY && value != 2) {
127 if (value)
128 input_start_autorepeat(dev, code);
129 else
130 input_stop_autorepeat(dev);
131 }
132
108} 133}
109 134
110/* 135/*
@@ -142,22 +167,6 @@ static void input_repeat_key(unsigned long data)
142 spin_unlock_irqrestore(&dev->event_lock, flags); 167 spin_unlock_irqrestore(&dev->event_lock, flags);
143} 168}
144 169
145static void input_start_autorepeat(struct input_dev *dev, int code)
146{
147 if (test_bit(EV_REP, dev->evbit) &&
148 dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
149 dev->timer.data) {
150 dev->repeat_key = code;
151 mod_timer(&dev->timer,
152 jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
153 }
154}
155
156static void input_stop_autorepeat(struct input_dev *dev)
157{
158 del_timer(&dev->timer);
159}
160
161#define INPUT_IGNORE_EVENT 0 170#define INPUT_IGNORE_EVENT 0
162#define INPUT_PASS_TO_HANDLERS 1 171#define INPUT_PASS_TO_HANDLERS 1
163#define INPUT_PASS_TO_DEVICE 2 172#define INPUT_PASS_TO_DEVICE 2
@@ -252,11 +261,6 @@ static void input_handle_event(struct input_dev *dev,
252 261
253 __change_bit(code, dev->key); 262 __change_bit(code, dev->key);
254 disposition = INPUT_PASS_TO_HANDLERS; 263 disposition = INPUT_PASS_TO_HANDLERS;
255
256 if (value)
257 input_start_autorepeat(dev, code);
258 else
259 input_stop_autorepeat(dev);
260 } 264 }
261 } 265 }
262 break; 266 break;