diff options
| author | Frank Praznik <frank.praznik@oh.rr.com> | 2014-01-22 13:49:43 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-01-29 08:23:42 -0500 |
| commit | 596cfdd80ab8ad11c750511da2c8c9a33f188ba0 (patch) | |
| tree | 7266007b518015bee998d610cec35087cfee9f4b | |
| parent | 975a683271e690e7e467b274f22efadf1e696b5e (diff) | |
HID: Add the transport-driver function to the uhid driver
Add the uhid_output_report transport-driver function to the uhid driver.
Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| -rw-r--r-- | drivers/hid/uhid.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index cedc6da93c19..f5a2b1931143 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
| @@ -244,12 +244,39 @@ static int uhid_hid_output_raw(struct hid_device *hid, __u8 *buf, size_t count, | |||
| 244 | return count; | 244 | return count; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf, | ||
| 248 | size_t count) | ||
| 249 | { | ||
| 250 | struct uhid_device *uhid = hid->driver_data; | ||
| 251 | unsigned long flags; | ||
| 252 | struct uhid_event *ev; | ||
| 253 | |||
| 254 | if (count < 1 || count > UHID_DATA_MAX) | ||
| 255 | return -EINVAL; | ||
| 256 | |||
| 257 | ev = kzalloc(sizeof(*ev), GFP_KERNEL); | ||
| 258 | if (!ev) | ||
| 259 | return -ENOMEM; | ||
| 260 | |||
| 261 | ev->type = UHID_OUTPUT; | ||
| 262 | ev->u.output.size = count; | ||
| 263 | ev->u.output.rtype = UHID_OUTPUT_REPORT; | ||
| 264 | memcpy(ev->u.output.data, buf, count); | ||
| 265 | |||
| 266 | spin_lock_irqsave(&uhid->qlock, flags); | ||
| 267 | uhid_queue(uhid, ev); | ||
| 268 | spin_unlock_irqrestore(&uhid->qlock, flags); | ||
| 269 | |||
| 270 | return count; | ||
| 271 | } | ||
| 272 | |||
| 247 | static struct hid_ll_driver uhid_hid_driver = { | 273 | static struct hid_ll_driver uhid_hid_driver = { |
| 248 | .start = uhid_hid_start, | 274 | .start = uhid_hid_start, |
| 249 | .stop = uhid_hid_stop, | 275 | .stop = uhid_hid_stop, |
| 250 | .open = uhid_hid_open, | 276 | .open = uhid_hid_open, |
| 251 | .close = uhid_hid_close, | 277 | .close = uhid_hid_close, |
| 252 | .parse = uhid_hid_parse, | 278 | .parse = uhid_hid_parse, |
| 279 | .output_report = uhid_hid_output_report, | ||
| 253 | }; | 280 | }; |
| 254 | 281 | ||
| 255 | #ifdef CONFIG_COMPAT | 282 | #ifdef CONFIG_COMPAT |
