]> git.itanic.dy.fi Git - linux-stable/commitdiff
hidraw: Return EPOLLOUT from hidraw_poll
authorFabian Henneke <fabian.henneke@gmail.com>
Tue, 9 Jul 2019 11:03:37 +0000 (13:03 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:03:20 +0000 (19:03 +0100)
commit 378b80370aa1fe50f9c48a3ac8af3e416e73b89f upstream.

Always return EPOLLOUT from hidraw_poll when a device is connected.
This is safe since writes are always possible (but will always block).

hidraw does not support non-blocking writes and instead always calls
blocking backend functions on write requests. Hence, so far, a call to
poll never returned EPOLLOUT, which confuses tools like socat.

Signed-off-by: Fabian Henneke <fabian.henneke@gmail.com>
In-reply-to: <CA+hv5qkyis03CgYTWeWX9cr0my-d2Oe+aZo+mjmWRXgjrGqyrw@mail.gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
[bwh: Backported to 3.16: s/EPOLL/POLL/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/hid/hidraw.c

index 627a24d3ea7c59ec0593ca67f09a3321a323cfe9..27d2f5a48a11c6671d54bbb63f5fed704cbfc44f 100644 (file)
@@ -265,7 +265,7 @@ static unsigned int hidraw_poll(struct file *file, poll_table *wait)
 
        poll_wait(file, &list->hidraw->wait, wait);
        if (list->head != list->tail)
-               return POLLIN | POLLRDNORM;
+               return POLLIN | POLLRDNORM | POLLOUT;
        if (!list->hidraw->exist)
                return POLLERR | POLLHUP;
        return 0;