Skip to content

Commit

Permalink
hidraw: Return EPOLLOUT from hidraw_poll
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fabian Henneke authored and Jiri Kosina committed Aug 5, 2019
1 parent 4832a4d commit 378b803
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hidraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 378b803

Please sign in to comment.