aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/keyboard.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-07-06 00:22:43 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-07-06 00:22:43 -0400
commit0e739d28762e78c746cad8edd33223550a1c6a3f (patch)
tree6fa695c3076b737b7b1848d81d75095400821e31 /drivers/char/keyboard.c
parentc7e8dc6ee6d59bf72f5478fa6355a27750e6c7d2 (diff)
Input: introduce input_inject_event() function
Create input_inject_event() function which is to be used by input handlers as opposed to input_event() which is reserved for drivers implementing input devices. The difference is that if device is "grabbed" by some process input_inject_event() will ignore events unless sent from the handle that is currently owns the device. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r--drivers/char/keyboard.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 38de44b87506..1e946f585673 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -223,13 +223,13 @@ static void kd_nosound(unsigned long ignored)
223{ 223{
224 struct list_head *node; 224 struct list_head *node;
225 225
226 list_for_each(node,&kbd_handler.h_list) { 226 list_for_each(node, &kbd_handler.h_list) {
227 struct input_handle *handle = to_handle_h(node); 227 struct input_handle *handle = to_handle_h(node);
228 if (test_bit(EV_SND, handle->dev->evbit)) { 228 if (test_bit(EV_SND, handle->dev->evbit)) {
229 if (test_bit(SND_TONE, handle->dev->sndbit)) 229 if (test_bit(SND_TONE, handle->dev->sndbit))
230 input_event(handle->dev, EV_SND, SND_TONE, 0); 230 input_inject_event(handle, EV_SND, SND_TONE, 0);
231 if (test_bit(SND_BELL, handle->dev->sndbit)) 231 if (test_bit(SND_BELL, handle->dev->sndbit))
232 input_event(handle->dev, EV_SND, SND_BELL, 0); 232 input_inject_event(handle, EV_SND, SND_BELL, 0);
233 } 233 }
234 } 234 }
235} 235}
@@ -247,11 +247,11 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
247 struct input_handle *handle = to_handle_h(node); 247 struct input_handle *handle = to_handle_h(node);
248 if (test_bit(EV_SND, handle->dev->evbit)) { 248 if (test_bit(EV_SND, handle->dev->evbit)) {
249 if (test_bit(SND_TONE, handle->dev->sndbit)) { 249 if (test_bit(SND_TONE, handle->dev->sndbit)) {
250 input_event(handle->dev, EV_SND, SND_TONE, hz); 250 input_inject_event(handle, EV_SND, SND_TONE, hz);
251 break; 251 break;
252 } 252 }
253 if (test_bit(SND_BELL, handle->dev->sndbit)) { 253 if (test_bit(SND_BELL, handle->dev->sndbit)) {
254 input_event(handle->dev, EV_SND, SND_BELL, 1); 254 input_inject_event(handle, EV_SND, SND_BELL, 1);
255 break; 255 break;
256 } 256 }
257 } 257 }
@@ -272,15 +272,15 @@ int kbd_rate(struct kbd_repeat *rep)
272 unsigned int d = 0; 272 unsigned int d = 0;
273 unsigned int p = 0; 273 unsigned int p = 0;
274 274
275 list_for_each(node,&kbd_handler.h_list) { 275 list_for_each(node, &kbd_handler.h_list) {
276 struct input_handle *handle = to_handle_h(node); 276 struct input_handle *handle = to_handle_h(node);
277 struct input_dev *dev = handle->dev; 277 struct input_dev *dev = handle->dev;
278 278
279 if (test_bit(EV_REP, dev->evbit)) { 279 if (test_bit(EV_REP, dev->evbit)) {
280 if (rep->delay > 0) 280 if (rep->delay > 0)
281 input_event(dev, EV_REP, REP_DELAY, rep->delay); 281 input_inject_event(handle, EV_REP, REP_DELAY, rep->delay);
282 if (rep->period > 0) 282 if (rep->period > 0)
283 input_event(dev, EV_REP, REP_PERIOD, rep->period); 283 input_inject_event(handle, EV_REP, REP_PERIOD, rep->period);
284 d = dev->rep[REP_DELAY]; 284 d = dev->rep[REP_DELAY];
285 p = dev->rep[REP_PERIOD]; 285 p = dev->rep[REP_PERIOD];
286 } 286 }
@@ -988,7 +988,7 @@ static inline unsigned char getleds(void)
988 * interrupt routines for this thing allows us to easily mask 988 * interrupt routines for this thing allows us to easily mask
989 * this when we don't want any of the above to happen. 989 * this when we don't want any of the above to happen.
990 * This allows for easy and efficient race-condition prevention 990 * This allows for easy and efficient race-condition prevention
991 * for kbd_start => input_event(dev, EV_LED, ...) => ... 991 * for kbd_start => input_inject_event(dev, EV_LED, ...) => ...
992 */ 992 */
993 993
994static void kbd_bh(unsigned long dummy) 994static void kbd_bh(unsigned long dummy)
@@ -998,11 +998,11 @@ static void kbd_bh(unsigned long dummy)
998 998
999 if (leds != ledstate) { 999 if (leds != ledstate) {
1000 list_for_each(node, &kbd_handler.h_list) { 1000 list_for_each(node, &kbd_handler.h_list) {
1001 struct input_handle * handle = to_handle_h(node); 1001 struct input_handle *handle = to_handle_h(node);
1002 input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 1002 input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
1003 input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); 1003 input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02));
1004 input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); 1004 input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04));
1005 input_sync(handle->dev); 1005 input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
1006 } 1006 }
1007 } 1007 }
1008 1008
@@ -1310,10 +1310,10 @@ static void kbd_start(struct input_handle *handle)
1310 1310
1311 tasklet_disable(&keyboard_tasklet); 1311 tasklet_disable(&keyboard_tasklet);
1312 if (leds != 0xff) { 1312 if (leds != 0xff) {
1313 input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 1313 input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
1314 input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); 1314 input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02));
1315 input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); 1315 input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04));
1316 input_sync(handle->dev); 1316 input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
1317 } 1317 }
1318 tasklet_enable(&keyboard_tasklet); 1318 tasklet_enable(&keyboard_tasklet);
1319} 1319}