From 4d4bf995ea873cc213c5abc5402af46ef490b8fd Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 15 Jul 2010 23:27:56 -0700 Subject: 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 Signed-off-by: Dmitry Torokhov --- drivers/input/mousedev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/input/mousedev.c') diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index d7a7a2fce745..d8f68f77007b 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait) { struct mousedev_client *client = file->private_data; struct mousedev *mousedev = client->mousedev; + unsigned int mask; 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 = { -- cgit v1.2.1