diff options
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; |