blob: 2e8bae9a974f74a300ec1065c38b96a9ce3f4aaf [file] [log] [blame]
From da5ca61e55d9d4c32385cd4d5bf79de453dad4d8 Mon Sep 17 00:00:00 2001
From: Fabian Henneke <fabian.henneke@gmail.com>
Date: Tue, 9 Jul 2019 13:03:37 +0200
Subject: [PATCH] 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 <fabian.henneke@gmail.com>
In-reply-to: <CA+hv5qkyis03CgYTWeWX9cr0my-d2Oe+aZo+mjmWRXgjrGqyrw@mail.gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 62ef47a730b0..bbc6ec1aa5cb 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -252,7 +252,7 @@ static __poll_t hidraw_poll(struct file *file, poll_table *wait)
poll_wait(file, &list->hidraw->wait, wait);
if (list->head != list->tail)
- return EPOLLIN | EPOLLRDNORM;
+ return EPOLLIN | EPOLLRDNORM | EPOLLOUT;
if (!list->hidraw->exist)
return EPOLLERR | EPOLLHUP;
return 0;
--
2.7.4