diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-07-06 00:22:43 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-07-06 00:22:43 -0400 |
commit | 0e739d28762e78c746cad8edd33223550a1c6a3f (patch) | |
tree | 6fa695c3076b737b7b1848d81d75095400821e31 /drivers/input/input.c | |
parent | c7e8dc6ee6d59bf72f5478fa6355a27750e6c7d2 (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/input/input.c')
-rw-r--r-- | drivers/input/input.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7aeebb9071c2..e20913942927 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -35,6 +35,16 @@ static LIST_HEAD(input_handler_list); | |||
35 | 35 | ||
36 | static struct input_handler *input_table[8]; | 36 | static struct input_handler *input_table[8]; |
37 | 37 | ||
38 | /** | ||
39 | * input_event() - report new input event | ||
40 | * @handle: device that generated the event | ||
41 | * @type: type of the event | ||
42 | * @code: event code | ||
43 | * @value: value of the event | ||
44 | * | ||
45 | * This function should be used by drivers implementing various input devices | ||
46 | * See also input_inject_event() | ||
47 | */ | ||
38 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 48 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
39 | { | 49 | { |
40 | struct input_handle *handle; | 50 | struct input_handle *handle; |
@@ -183,6 +193,23 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in | |||
183 | } | 193 | } |
184 | EXPORT_SYMBOL(input_event); | 194 | EXPORT_SYMBOL(input_event); |
185 | 195 | ||
196 | /** | ||
197 | * input_inject_event() - send input event from input handler | ||
198 | * @handle: input handle to send event through | ||
199 | * @type: type of the event | ||
200 | * @code: event code | ||
201 | * @value: value of the event | ||
202 | * | ||
203 | * Similar to input_event() but will ignore event if device is "grabbed" and handle | ||
204 | * injecting event is not the one that owns the device. | ||
205 | */ | ||
206 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
207 | { | ||
208 | if (!handle->dev->grab || handle->dev->grab == handle) | ||
209 | input_event(handle->dev, type, code, value); | ||
210 | } | ||
211 | EXPORT_SYMBOL(input_inject_event); | ||
212 | |||
186 | static void input_repeat_key(unsigned long data) | 213 | static void input_repeat_key(unsigned long data) |
187 | { | 214 | { |
188 | struct input_dev *dev = (void *) data; | 215 | struct input_dev *dev = (void *) data; |