Re: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2

From: Dmitry Torokhov
Date: Tue Feb 01 2005 - 10:28:54 EST


On Tue, 1 Feb 2005 08:52:15 -0600, David Fries <dfries@xxxxxxxxxxxx> wrote:
> Currently a blocking read, select, or poll call will not return if a
> joystick device is unplugged. This patch allows them to return.
>
...
> static unsigned int joydev_poll(struct file *file, poll_table *wait)
> {
> + int mask = 0;
> struct joydev_list *list = file->private_data;
> poll_wait(file, &list->joydev->wait, wait);
> - if (list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey)
> - return POLLIN | POLLRDNORM;
> - return 0;
> + if(!list->joydev->exist)
> + mask |= POLLERR;

Probably need POLLHUP in addition (or instead of POLLERR).

> if (joydev->open)
> + {
> input_close_device(handle);
> + wake_up_interruptible(&joydev->wait);
> + }
> else
> + {
> joydev_free(joydev);
> + }

Opening braces should go on the same line as the statement (if (...) {).
--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/