xf86-input monitor filedescriptors

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 26 14:44:44 PST 2012


On Fri, Feb 24, 2012 at 03:09:05PM +0100, David Herrmann wrote:
> Hi
> 
> I am working on an input-driver for xorg and I was wondering how I can
> add multiple FDs to be monitored for events? I can set pInfo->fd and
> then call xf86AddEnabledDevice() but I need to watch multiple FDs for
> my driver. Is there a simple way to do this?

xf86AddEnabledDevice doesn't really care about the pInfo struct other than
to get the fd and use it as *closure pointer in your callback so the
following should work.

foreach fd:
   pInfo->fd = fd;
   xf86AddEnabledDevice(pInfo);

of course, since the ReadInput hook doesn't give you the fd that had data
available you'll need to work around that bit.

the bigger question however is: why do you need multiple fd's, why you do
you need a new input driver and is there some better way to fix this? some
more information would help answering the last question.
 
Cheers,
  Peter


> Furthermore, setting pInfo->fd to an epoll-fd gives me weird behavior.
> My callback gets called correctly but the call is delayed until
> another input-device has also input available.
> 
> Regards
> David
> _______________________________________________
> 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