Skip to content

Commit 4d4bf99

Browse files
Julien Moutinhodtor
authored andcommitted
Input: mousedev - signal that device is writable in mousedev_poll()
The Microsoft ImPS/2 mouse protocol being bidirectionnal (sic) one may have to write in /dev/input/mice; and that works better if select() does not hang. Signed-off-by: Julien Moutinho <julm+linux@savines.alpes.fr.eu.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 20da92d commit 4d4bf99

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎drivers/input/mousedev.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait)
765765
{
766766
struct mousedev_client *client = file->private_data;
767767
struct mousedev *mousedev = client->mousedev;
768+
unsigned int mask;
768769

769770
poll_wait(file, &mousedev->wait, wait);
770-
return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) |
771-
(mousedev->exist ? 0 : (POLLHUP | POLLERR));
771+
772+
mask = mousedev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR;
773+
if (client->ready || client->buffer)
774+
mask |= POLLIN | POLLRDNORM;
775+
776+
return mask;
772777
}
773778

774779
static const struct file_operations mousedev_fops = {

0 commit comments

Comments
 (0)