]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
hidraw: Return EPOLLOUT from hidraw_poll
authorFabian Henneke <fabian.henneke@gmail.com>
Tue, 9 Jul 2019 11:03:37 +0000 (13:03 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1861934
[ Upstream commit 378b80370aa1fe50f9c48a3ac8af3e416e73b89f ]

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: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/hid/hidraw.c

index 5652bd0ffb4d610a8249aa591536fdeb851f5243..1ac82e194818d5c3a4b7c48fec43299cdac1dc4f 100644 (file)
@@ -260,7 +260,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;