summaryrefslogtreecommitdiff
path: root/drivers/hid/uhid.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-06-10 17:16:23 +0400
committerJiri Kosina <jkosina@suse.cz>2012-06-18 15:42:02 +0400
commitf80e13601c51a836b2aac583b8a3b4327c0c27ce (patch)
treee8aec7e0ce0523153a53404cb97454b74c702dc1 /drivers/hid/uhid.c
parente7191474a5459e6ba7039fadca6a32f3a5731909 (diff)
downloadlinux-f80e13601c51a836b2aac583b8a3b4327c0c27ce.tar.xz
HID: uhid: forward output request to user-space
If the hid-driver wants to send standardized data to the device it uses a linux input_event. We forward this to the user-space transport-level driver so they can perform the requested action on the device. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/uhid.c')
-rw-r--r--drivers/hid/uhid.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 0226ba3f5307..4dd693e1c8b8 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -112,6 +112,24 @@ static void uhid_hid_close(struct hid_device *hid)
static int uhid_hid_input(struct input_dev *input, unsigned int type,
unsigned int code, int value)
{
+ struct hid_device *hid = input_get_drvdata(input);
+ struct uhid_device *uhid = hid->driver_data;
+ unsigned long flags;
+ struct uhid_event *ev;
+
+ ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
+ if (!ev)
+ return -ENOMEM;
+
+ ev->type = UHID_OUTPUT_EV;
+ ev->u.output_ev.type = type;
+ ev->u.output_ev.code = code;
+ ev->u.output_ev.value = value;
+
+ spin_lock_irqsave(&uhid->qlock, flags);
+ uhid_queue(uhid, ev);
+ spin_unlock_irqrestore(&uhid->qlock, flags);
+
return 0;
}