[PATCH xf86-input-libinput] Drain the fd after opening

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 16 17:25:16 PST 2015


On Wed, Dec 16, 2015 at 11:14:28PM +0100, walter harms wrote:
> 
> 
> Am 16.12.2015 01:15, schrieb Peter Hutterer:
> > Make sure we discard any events that may have been enqueued before we
> > re-opened the fd. Specifically, if we're using systemd-logind the fd remains
> > open when we disable/enable the device, allowing events to queue up on the
> > fd. These events are then replayed once the device is re-opened.
> > 
> > This only applies to a device being disabled via the protocol, on VT switch
> > logind closes the fd and we don't see enqueued events.
> > 
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  src/xf86libinput.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/xf86libinput.c b/src/xf86libinput.c
> > index ee2165a..2fde9ed 100644
> > --- a/src/xf86libinput.c
> > +++ b/src/xf86libinput.c
> > @@ -1175,6 +1175,8 @@ open_restricted(const char *path, int flags, void *data)
> >  	}
> >  
> >  	fd = xf86OpenSerial(pInfo->options);
> > +	xf86FlushInput(fd);
> > +
> >  	return fd < 0 ? -errno : fd;
> >  }
> >  
> 
> can  xf86FlushInput() handle fd<0 ?

ah, good point, this will indeed mess up errno, patch coming up in a second.

Cheers,
   Peter

> perhaps it would be better to make clear that this is an error case like:
> 
> fd = xf86OpenSerial(pInfo->options);
> 
> if (fd<0)
> 	return -errno ;
> 
> xf86FlushInput(fd);
> return fd;
> 
> just my 2 cents,
> re,
>  wh
> 
> 
> 
> 
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list