lkml.org 
[lkml]   [2005]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
Date
On Sunday 06 February 2005 08:12, Vojtech Pavlik wrote:
> On Tue, Feb 01, 2005 at 10:24:39AM -0500, Dmitry Torokhov wrote:
> > 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 (...) {).
>  
> How about this patch?

Looks fine now. Hmm, wait a sec... Don't we also need kill_fasync calls in
disconnect routines as well?

--
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-2014 Jasper Spaans. Advertise on this site