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>
This commit is contained in:
parent
975a683271
commit
596cfdd80a
@ -244,12 +244,39 @@ static int uhid_hid_output_raw(struct hid_device *hid, __u8 *buf, size_t count,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
|
||||||
|
size_t count)
|
||||||
|
{
|
||||||
|
struct uhid_device *uhid = hid->driver_data;
|
||||||
|
unsigned long flags;
|
||||||
|
struct uhid_event *ev;
|
||||||
|
|
||||||
|
if (count < 1 || count > UHID_DATA_MAX)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ev = kzalloc(sizeof(*ev), GFP_KERNEL);
|
||||||
|
if (!ev)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ev->type = UHID_OUTPUT;
|
||||||
|
ev->u.output.size = count;
|
||||||
|
ev->u.output.rtype = UHID_OUTPUT_REPORT;
|
||||||
|
memcpy(ev->u.output.data, buf, count);
|
||||||
|
|
||||||
|
spin_lock_irqsave(&uhid->qlock, flags);
|
||||||
|
uhid_queue(uhid, ev);
|
||||||
|
spin_unlock_irqrestore(&uhid->qlock, flags);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
static struct hid_ll_driver uhid_hid_driver = {
|
static struct hid_ll_driver uhid_hid_driver = {
|
||||||
.start = uhid_hid_start,
|
.start = uhid_hid_start,
|
||||||
.stop = uhid_hid_stop,
|
.stop = uhid_hid_stop,
|
||||||
.open = uhid_hid_open,
|
.open = uhid_hid_open,
|
||||||
.close = uhid_hid_close,
|
.close = uhid_hid_close,
|
||||||
.parse = uhid_hid_parse,
|
.parse = uhid_hid_parse,
|
||||||
|
.output_report = uhid_hid_output_report,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
|
Loading…
Reference in New Issue
Block a user