From: Fabian Henneke Date: Tue, 9 Jul 2019 11:03:37 +0000 (+0200) Subject: hidraw: Return EPOLLOUT from hidraw_poll X-Git-Tag: v3.16.83~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcec894fc7aea9b106aae4d04e71e9888150335e;p=thirdparty%2Fkernel%2Fstable.git hidraw: Return EPOLLOUT from hidraw_poll 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 In-reply-to: Signed-off-by: Jiri Kosina [bwh: Backported to 3.16: s/EPOLL/POLL/] Signed-off-by: Ben Hutchings --- diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 627a24d3ea7c5..27d2f5a48a11c 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -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;