aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.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/input/input.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/input/input.c')
-rw-r--r--drivers/input/input.c27
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
36static struct input_handler *input_table[8]; 36static 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 */
38void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 48void 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}
184EXPORT_SYMBOL(input_event); 194EXPORT_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 */
206void 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}
211EXPORT_SYMBOL(input_inject_event);
212
186static void input_repeat_key(unsigned long data) 213static void input_repeat_key(unsigned long data)
187{ 214{
188 struct input_dev *dev = (void *) data; 215 struct input_dev *dev = (void *) data;