Skip to content

Commit 9f3b61d

Browse files
holtmannJiri Kosina
authored andcommitted
HID: hidraw: Fix returning EPOLLOUT from hidraw_poll
When polling a connected /dev/hidrawX device, it is useful to get the EPOLLOUT when writing is possible. Since writing is possible as soon as the device is connected, always return it. Right now EPOLLOUT is only returned when there are also input reports are available. This works if devices start sending reports when connected, but some HID devices might need an output report first before sending any input reports. This change will allow using EPOLLOUT here as well. Fixes: 378b803 ("hidraw: Return EPOLLOUT from hidraw_poll") Signed-off-by: Marcel Holtmann <[email protected]> Cc: [email protected] Signed-off-by: Jiri Kosina <[email protected]>
1 parent d004701 commit 9f3b61d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hid/hidraw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ static __poll_t hidraw_poll(struct file *file, poll_table *wait)
252252

253253
poll_wait(file, &list->hidraw->wait, wait);
254254
if (list->head != list->tail)
255-
return EPOLLIN | EPOLLRDNORM | EPOLLOUT;
255+
return EPOLLIN | EPOLLRDNORM;
256256
if (!list->hidraw->exist)
257257
return EPOLLERR | EPOLLHUP;
258-
return 0;
258+
return EPOLLOUT | EPOLLWRNORM;
259259
}
260260

261261
static int hidraw_open(struct inode *inode, struct file *file)

0 commit comments

Comments
 (0)