diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-06-10 09:16:23 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-06-18 07:42:02 -0400 |
commit | f80e13601c51a836b2aac583b8a3b4327c0c27ce (patch) | |
tree | e8aec7e0ce0523153a53404cb97454b74c702dc1 /drivers/hid | |
parent | e7191474a5459e6ba7039fadca6a32f3a5731909 (diff) |
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')
-rw-r--r-- | drivers/hid/uhid.c | 18 |
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) | |||
112 | static int uhid_hid_input(struct input_dev *input, unsigned int type, | 112 | static int uhid_hid_input(struct input_dev *input, unsigned int type, |
113 | unsigned int code, int value) | 113 | unsigned int code, int value) |
114 | { | 114 | { |
115 | struct hid_device *hid = input_get_drvdata(input); | ||
116 | struct uhid_device *uhid = hid->driver_data; | ||
117 | unsigned long flags; | ||
118 | struct uhid_event *ev; | ||
119 | |||
120 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); | ||
121 | if (!ev) | ||
122 | return -ENOMEM; | ||
123 | |||
124 | ev->type = UHID_OUTPUT_EV; | ||
125 | ev->u.output_ev.type = type; | ||
126 | ev->u.output_ev.code = code; | ||
127 | ev->u.output_ev.value = value; | ||
128 | |||
129 | spin_lock_irqsave(&uhid->qlock, flags); | ||
130 | uhid_queue(uhid, ev); | ||
131 | spin_unlock_irqrestore(&uhid->qlock, flags); | ||
132 | |||
115 | return 0; | 133 | return 0; |
116 | } | 134 | } |
117 | 135 | ||