lkml.org 
[lkml]   [2005]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateTue, 1 Feb 2005 10:24:39 -0500
FromDmitry Torokhov <>
SubjectRe: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
On Tue, 1 Feb 2005 08:52:15 -0600, David Fries <dfries@mail.win.org> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2010