Commit 4d4bf995 authored by Julien Moutinho's avatar Julien Moutinho Committed by Dmitry Torokhov

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: default avatarJulien Moutinho <julm+linux@savines.alpes.fr.eu.org>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 20da92de
...@@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait) ...@@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait)
{ {
struct mousedev_client *client = file->private_data; struct mousedev_client *client = file->private_data;
struct mousedev *mousedev = client->mousedev; struct mousedev *mousedev = client->mousedev;
unsigned int mask;
poll_wait(file, &mousedev->wait, wait); poll_wait(file, &mousedev->wait, wait);
return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) |
(mousedev->exist ? 0 : (POLLHUP | POLLERR)); mask = mousedev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR;
if (client->ready || client->buffer)
mask |= POLLIN | POLLRDNORM;
return mask;
} }
static const struct file_operations mousedev_fops = { static const struct file_operations mousedev_fops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment