• D
    HID: uhid: implement read() on uhid devices · d937ae5f
    David Herrmann 提交于
    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: NDavid Herrmann <dh.herrmann@googlemail.com>
    Signed-off-by: NJiri Kosina <jkosina@suse.cz>
    d937ae5f
uhid.c 4.2 KB