]> Pileus Git - ~andy/linux/commit
HID: uhid: implement read() on uhid devices
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 10 Jun 2012 13:16:16 +0000 (15:16 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 18 Jun 2012 11:42:00 +0000 (13:42 +0200)
commitd937ae5fae17e63aaa97f029be221a6516b25475
tree2ef5c99a73fe3d9c9ef2e85bdf72d0807b170d5b
parent1f9dec1e0164b48da9b268a02197f38caa69b118
HID: uhid: implement read() on uhid devices

User-space can use read() to get a single event from uhid devices. read()
does never return multiple events. This allows us to extend the event
structure and still keep backwards compatibility.

If user-space wants to get multiple events in one syscall, they should use
the readv()/writev() syscalls which are supported by uhid.

This introduces a new lock which helps us synchronizing simultaneous reads
from user-space. We also correctly return -EINVAL/-EFAULT only on errors
and retry the read() when some other thread captured the event faster than
we did.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/uhid.c